| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wunused-private-field" |
| #elif defined(_MSC_VER) |
| #pragma warning(push) |
| #pragma warning(disable:4056) |
| #pragma warning(disable:4065) |
| #pragma warning(disable:4756) |
| #endif |
| |
| |
| #include "components/services/heap_profiling/public/mojom/heap_profiling_service.mojom-blink-test-utils.h" |
| |
| #include <utility> |
| |
| #include "base/bind.h" |
| #include "base/run_loop.h" |
| #include "mojo/public/cpp/bindings/lib/wtf_serialization.h" |
| #include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom-blink.h" |
| #include "mojo/public/mojom/base/process_id.mojom-blink.h" |
| |
| |
| #ifndef COMPONENTS_SERVICES_HEAP_PROFILING_PUBLIC_MOJOM_HEAP_PROFILING_SERVICE_MOJOM_BLINK_JUMBO_H_ |
| #define COMPONENTS_SERVICES_HEAP_PROFILING_PUBLIC_MOJOM_HEAP_PROFILING_SERVICE_MOJOM_BLINK_JUMBO_H_ |
| #endif |
| |
| |
| namespace heap_profiling { |
| namespace mojom { |
| namespace blink { |
| |
| |
| void ProfilingServiceInterceptorForTesting::AddProfilingClient(::mojo_base::mojom::blink::ProcessIdPtr pid, ::heap_profiling::mojom::blink::ProfilingClientPtr client, ProcessType process_type, ::heap_profiling::mojom::blink::ProfilingParamsPtr params) { |
| GetForwardingInterface()->AddProfilingClient(std::move(pid), std::move(client), std::move(process_type), std::move(params)); |
| } |
| void ProfilingServiceInterceptorForTesting::GetProfiledPids(GetProfiledPidsCallback callback) { |
| GetForwardingInterface()->GetProfiledPids(std::move(callback)); |
| } |
| ProfilingServiceAsyncWaiter::ProfilingServiceAsyncWaiter( |
| ProfilingService* proxy) : proxy_(proxy) {} |
| |
| ProfilingServiceAsyncWaiter::~ProfilingServiceAsyncWaiter() = default; |
| |
| void ProfilingServiceAsyncWaiter::GetProfiledPids( |
| WTF::Vector<::mojo_base::mojom::blink::ProcessIdPtr>* out_pids) { |
| base::RunLoop loop; |
| proxy_->GetProfiledPids( |
| base::BindOnce( |
| [](base::RunLoop* loop, |
| WTF::Vector<::mojo_base::mojom::blink::ProcessIdPtr>* out_pids |
| , |
| WTF::Vector<::mojo_base::mojom::blink::ProcessIdPtr> pids) {*out_pids = std::move(pids); |
| loop->Quit(); |
| }, |
| &loop, |
| out_pids)); |
| loop.Run(); |
| } |
| |
| |
| |
| |
| |
| } // namespace blink |
| } // namespace mojom |
| } // namespace heap_profiling |
| |
| #if defined(__clang__) |
| #pragma clang diagnostic pop |
| #elif defined(_MSC_VER) |
| #pragma warning(pop) |
| #endif |