Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: services/resource_coordinator/public/cpp/memory/memory_dump_manager_delegate_impl.cc

Issue 2755813002: Begin to wean child processes off reliance on a persistent service_manager::Connection to the brows… (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de legate_impl.h" 5 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de legate_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/trace_event/memory_dump_request_args.h" 11 #include "base/trace_event/memory_dump_request_args.h"
12 #include "mojo/public/cpp/bindings/interface_request.h" 12 #include "mojo/public/cpp/bindings/interface_request.h"
13 #include "services/resource_coordinator/public/cpp/memory/coordinator.h" 13 #include "services/resource_coordinator/public/cpp/memory/coordinator.h"
14 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h" 14 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h"
15 #include "services/service_manager/public/cpp/interface_provider.h" 15 #include "services/service_manager/public/cpp/connector.h"
16 16
17 namespace memory_instrumentation { 17 namespace memory_instrumentation {
18 18
19 MemoryDumpManagerDelegateImpl::Config::~Config() {} 19 MemoryDumpManagerDelegateImpl::Config::~Config() {}
20 20
21 MemoryDumpManagerDelegateImpl::MemoryDumpManagerDelegateImpl( 21 MemoryDumpManagerDelegateImpl::MemoryDumpManagerDelegateImpl(
22 const MemoryDumpManagerDelegateImpl::Config& config) 22 const MemoryDumpManagerDelegateImpl::Config& config)
23 : binding_(this), 23 : binding_(this),
24 config_(config), 24 config_(config),
25 task_runner_(nullptr), 25 task_runner_(nullptr),
26 pending_memory_dump_guid_(0) { 26 pending_memory_dump_guid_(0) {
27 if (config.interface_provider() != nullptr) { 27 if (config.connector() != nullptr) {
28 config.interface_provider()->GetInterface(mojo::MakeRequest(&coordinator_)); 28 config.connector()->BindInterface(config.service_name(),
29 mojo::MakeRequest(&coordinator_));
29 } else { 30 } else {
30 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 31 task_runner_ = base::ThreadTaskRunnerHandle::Get();
31 config.coordinator()->BindCoordinatorRequest( 32 config.coordinator()->BindCoordinatorRequest(
32 mojo::MakeRequest(&coordinator_)); 33 mojo::MakeRequest(&coordinator_));
33 } 34 }
34 coordinator_->RegisterProcessLocalDumpManager( 35 coordinator_->RegisterProcessLocalDumpManager(
35 binding_.CreateInterfacePtrAndBind()); 36 binding_.CreateInterfacePtrAndBind());
36 } 37 }
37 38
38 MemoryDumpManagerDelegateImpl::~MemoryDumpManagerDelegateImpl() {} 39 MemoryDumpManagerDelegateImpl::~MemoryDumpManagerDelegateImpl() {}
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 DCHECK_NE(0U, pending_memory_dump_guid_); 87 DCHECK_NE(0U, pending_memory_dump_guid_);
87 pending_memory_dump_guid_ = 0; 88 pending_memory_dump_guid_ = 0;
88 callback.Run(dump_guid, success); 89 callback.Run(dump_guid, success);
89 } 90 }
90 91
91 void MemoryDumpManagerDelegateImpl::SetAsNonCoordinatorForTesting() { 92 void MemoryDumpManagerDelegateImpl::SetAsNonCoordinatorForTesting() {
92 task_runner_ = nullptr; 93 task_runner_ = nullptr;
93 } 94 }
94 95
95 } // namespace memory_instrumentation 96 } // namespace memory_instrumentation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698