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

Side by Side Diff: chrome/browser/metrics/leak_detector/leak_detector_remote_controller.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/metrics/leak_detector/leak_detector_remote_controller.h " 5 #include "chrome/browser/metrics/leak_detector/leak_detector_remote_controller.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/metrics/leak_detector/protobuf_to_mojo_converter.h" 10 #include "components/metrics/leak_detector/protobuf_to_mojo_converter.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 13
14 namespace metrics { 14 namespace metrics {
15 15
16 namespace { 16 namespace {
17 17
18 // All instances of LeakDetectorRemoteController will need to reference a single 18 // All instances of LeakDetectorRemoteController will need to reference a single
19 // LocalController instance, referenced by this pointer. All remote LeakDetector 19 // LocalController instance, referenced by this pointer. All remote LeakDetector
20 // clients will get their params from and send leak reports to this instance. 20 // clients will get their params from and send leak reports to this instance.
21 LeakDetectorRemoteController::LocalController* g_local_controller = nullptr; 21 LeakDetectorRemoteController::LocalController* g_local_controller = nullptr;
22 22
23 } // namespace 23 } // namespace
24 24
25 LeakDetectorRemoteController::~LeakDetectorRemoteController() {} 25 LeakDetectorRemoteController::~LeakDetectorRemoteController() {}
26 26
27 // static 27 // static
28 void LeakDetectorRemoteController::Create(mojom::LeakDetectorRequest request) { 28 void LeakDetectorRemoteController::Create(
29 const service_manager::BindSourceInfo& source_info,
30 mojom::LeakDetectorRequest request) {
29 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 31 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
30 std::unique_ptr<LeakDetectorRemoteController> controller = 32 std::unique_ptr<LeakDetectorRemoteController> controller =
31 base::WrapUnique(new LeakDetectorRemoteController); 33 base::WrapUnique(new LeakDetectorRemoteController);
32 base::Closure error_handler = 34 base::Closure error_handler =
33 base::Bind(&LeakDetectorRemoteController::OnRemoteProcessShutdown, 35 base::Bind(&LeakDetectorRemoteController::OnRemoteProcessShutdown,
34 base::Unretained(controller.get())); 36 base::Unretained(controller.get()));
35 auto binding = 37 auto binding =
36 mojo::MakeStrongBinding(std::move(controller), std::move(request)); 38 mojo::MakeStrongBinding(std::move(controller), std::move(request));
37 binding->set_connection_error_handler(error_handler); 39 binding->set_connection_error_handler(error_handler);
38 } 40 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // static 87 // static
86 void LeakDetectorRemoteController::SetLocalControllerInstance( 88 void LeakDetectorRemoteController::SetLocalControllerInstance(
87 LocalController* controller) { 89 LocalController* controller) {
88 // This must be on the same thread as the Mojo-based functions of this class, 90 // This must be on the same thread as the Mojo-based functions of this class,
89 // to avoid race conditions on |g_local_controller|. 91 // to avoid race conditions on |g_local_controller|.
90 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 92 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
91 g_local_controller = controller; 93 g_local_controller = controller;
92 } 94 }
93 95
94 } // namespace metrics 96 } // namespace metrics
OLDNEW
« no previous file with comments | « chrome/browser/metrics/leak_detector/leak_detector_remote_controller.h ('k') | chrome/browser/net_benchmarking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698