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

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

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 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/process_local_dump_man ager_impl.h" 5 #include "services/resource_coordinator/public/cpp/memory/process_local_dump_man ager_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"
(...skipping 21 matching lines...) Expand all
32 : binding_(this), 32 : binding_(this),
33 config_(config), 33 config_(config),
34 task_runner_(nullptr), 34 task_runner_(nullptr),
35 pending_memory_dump_guid_(0) { 35 pending_memory_dump_guid_(0) {
36 if (config.connector() != nullptr) { 36 if (config.connector() != nullptr) {
37 config.connector()->BindInterface(config.service_name(), 37 config.connector()->BindInterface(config.service_name(),
38 mojo::MakeRequest(&coordinator_)); 38 mojo::MakeRequest(&coordinator_));
39 } else { 39 } else {
40 task_runner_ = base::ThreadTaskRunnerHandle::Get(); 40 task_runner_ = base::ThreadTaskRunnerHandle::Get();
41 config.coordinator()->BindCoordinatorRequest( 41 config.coordinator()->BindCoordinatorRequest(
42 mojo::MakeRequest(&coordinator_)); 42 service_manager::BindSourceInfo(), mojo::MakeRequest(&coordinator_));
43 } 43 }
44 coordinator_->RegisterProcessLocalDumpManager( 44 coordinator_->RegisterProcessLocalDumpManager(
45 binding_.CreateInterfacePtrAndBind()); 45 binding_.CreateInterfacePtrAndBind());
46 46
47 // Only one process should handle periodic dumping. 47 // Only one process should handle periodic dumping.
48 bool is_coordinator_process = !!config.coordinator(); 48 bool is_coordinator_process = !!config.coordinator();
49 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( 49 base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
50 base::BindRepeating(&ProcessLocalDumpManagerImpl::RequestGlobalMemoryDump, 50 base::BindRepeating(&ProcessLocalDumpManagerImpl::RequestGlobalMemoryDump,
51 base::Unretained(this)), 51 base::Unretained(this)),
52 is_coordinator_process); 52 is_coordinator_process);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 pending_memory_dump_guid_ = 0; 103 pending_memory_dump_guid_ = 0;
104 } 104 }
105 callback.Run(dump_guid, success); 105 callback.Run(dump_guid, success);
106 } 106 }
107 107
108 void ProcessLocalDumpManagerImpl::SetAsNonCoordinatorForTesting() { 108 void ProcessLocalDumpManagerImpl::SetAsNonCoordinatorForTesting() {
109 task_runner_ = nullptr; 109 task_runner_ = nullptr;
110 } 110 }
111 111
112 } // namespace memory_instrumentation 112 } // namespace memory_instrumentation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698