| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_DELE
GATE_IMPL_H_ | 5 #ifndef SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_DELE
GATE_IMPL_H_ |
| 6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_DELE
GATE_IMPL_H_ | 6 #define SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_DELE
GATE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/single_thread_task_runner.h" |
| 8 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
| 9 #include "base/trace_event/memory_dump_request_args.h" | 10 #include "base/trace_event/memory_dump_request_args.h" |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "services/resource_coordinator/public/cpp/memory/coordinator.h" | 12 #include "services/resource_coordinator/public/cpp/memory/coordinator.h" |
| 12 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume
ntation.mojom.h" | 13 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume
ntation.mojom.h" |
| 13 #include "services/service_manager/public/cpp/interface_provider.h" | 14 #include "services/service_manager/public/cpp/interface_provider.h" |
| 14 | 15 |
| 15 namespace memory_instrumentation { | 16 namespace memory_instrumentation { |
| 16 | 17 |
| 17 class MemoryDumpManagerDelegateImpl | 18 class MemoryDumpManagerDelegateImpl |
| 18 : public base::trace_event::MemoryDumpManagerDelegate, | 19 : public base::trace_event::MemoryDumpManagerDelegate, |
| 19 public mojom::ProcessLocalDumpManager { | 20 public mojom::ProcessLocalDumpManager { |
| 20 public: | 21 public: |
| 21 // Use to bind to a remote coordinator. | 22 // Use to bind to a remote coordinator. |
| 22 MemoryDumpManagerDelegateImpl( | 23 MemoryDumpManagerDelegateImpl( |
| 23 service_manager::InterfaceProvider* interface_provider); | 24 service_manager::InterfaceProvider* interface_provider); |
| 24 | 25 |
| 25 // Use to bind to a coordinator in the same process. | 26 // Use to bind to a coordinator in the same process. |
| 26 MemoryDumpManagerDelegateImpl(Coordinator* coordinator); | 27 MemoryDumpManagerDelegateImpl(Coordinator* coordinator, |
| 28 base::SingleThreadTaskRunner* task_runner); |
| 27 ~MemoryDumpManagerDelegateImpl() override; | 29 ~MemoryDumpManagerDelegateImpl() override; |
| 28 | 30 |
| 29 bool IsCoordinator() const; | 31 bool IsCoordinator() const override; |
| 30 | 32 |
| 31 // The base::trace_event::MemoryDumpManager calls this. | 33 // The base::trace_event::MemoryDumpManager calls this. |
| 32 void RequestGlobalMemoryDump( | 34 void RequestGlobalMemoryDump( |
| 33 const base::trace_event::MemoryDumpRequestArgs& args, | 35 const base::trace_event::MemoryDumpRequestArgs& args, |
| 34 const base::trace_event::MemoryDumpCallback& callback) override; | 36 const base::trace_event::MemoryDumpCallback& callback) override; |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 // The ProcessLocalDumpManager interface. The coordinator calls this. | 39 // The ProcessLocalDumpManager interface. The coordinator calls this. |
| 38 void RequestProcessMemoryDump( | 40 void RequestProcessMemoryDump( |
| 39 const base::trace_event::MemoryDumpRequestArgs& args, | 41 const base::trace_event::MemoryDumpRequestArgs& args, |
| 40 const RequestProcessMemoryDumpCallback& callback) override; | 42 const RequestProcessMemoryDumpCallback& callback) override; |
| 41 | 43 |
| 42 bool is_coordinator_; | 44 bool is_coordinator_; |
| 43 mojom::CoordinatorPtr coordinator_; | 45 mojom::CoordinatorPtr coordinator_; |
| 44 mojo::Binding<mojom::ProcessLocalDumpManager> binding_; | 46 mojo::Binding<mojom::ProcessLocalDumpManager> binding_; |
| 47 base::SingleThreadTaskRunner* task_runner_; |
| 45 | 48 |
| 46 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegateImpl); | 49 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegateImpl); |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 } // namespace memory_instrumentation | 52 } // namespace memory_instrumentation |
| 50 | 53 |
| 51 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_D
ELEGATE_IMPL_H_ | 54 #endif // SERVICES_RESOURCE_COORDINATOR_PUBLIC_CPP_MEMORY_MEMORY_DUMP_MANAGER_D
ELEGATE_IMPL_H_ |
| OLD | NEW |