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

Side by Side Diff: services/shell/public/cpp/lib/interface_provider.cc

Issue 2007473004: [Autofill] Migrate ContentAutofillDriver<-->AutofillAgent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 5 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 "services/shell/public/cpp/interface_provider.h" 5 #include "services/shell/public/cpp/interface_provider.h"
6 6
7 namespace shell { 7 namespace shell {
8 8
9 InterfaceProvider::InterfaceProvider() : weak_factory_(this) { 9 InterfaceProvider::InterfaceProvider() : weak_factory_(this) {
10 pending_request_ = GetProxy(&interface_provider_); 10 pending_request_ = GetProxy(&interface_provider_);
11 } 11 }
12 InterfaceProvider::~InterfaceProvider() {} 12 InterfaceProvider::~InterfaceProvider() {}
13 13
14 void InterfaceProvider::Bind(mojom::InterfaceProviderPtr interface_provider) { 14 void InterfaceProvider::Bind(mojom::InterfaceProviderPtr interface_provider) {
15 DCHECK(pending_request_.is_pending()); 15 DCHECK(pending_request_.is_pending());
16 mojo::FuseInterface(std::move(pending_request_), 16 mojo::FuseInterface(std::move(pending_request_),
17 interface_provider.PassInterface()); 17 interface_provider.PassInterface());
18 } 18 }
19 19
20 void InterfaceProvider::SetConnectionLostClosure( 20 void InterfaceProvider::SetConnectionLostClosure(
21 const base::Closure& connection_lost_closure) { 21 const base::Closure& connection_lost_closure) {
22 interface_provider_.set_connection_error_handler(connection_lost_closure); 22 if (interface_provider_)
yzshen1 2016/06/29 22:25:44 Why this check is needed? It seems this is never n
leonhsl(Using Gerrit) 2016/06/29 23:28:35 With the render_frame_host_impl.cc changes, Interf
yzshen1 2016/06/30 16:58:17 But the GetProxy() at line 10 guarantees that it i
leonhsl(Using Gerrit) 2016/07/01 13:04:59 Yeah you are right.. As pending_request_ is used n
23 interface_provider_.set_connection_error_handler(connection_lost_closure);
23 } 24 }
24 25
25 base::WeakPtr<InterfaceProvider> InterfaceProvider::GetWeakPtr() { 26 base::WeakPtr<InterfaceProvider> InterfaceProvider::GetWeakPtr() {
26 return weak_factory_.GetWeakPtr(); 27 return weak_factory_.GetWeakPtr();
27 } 28 }
28 29
29 void InterfaceProvider::GetInterface( 30 void InterfaceProvider::GetInterface(
30 const std::string& name, 31 const std::string& name,
31 mojo::ScopedMessagePipeHandle request_handle) { 32 mojo::ScopedMessagePipeHandle request_handle) {
32 // Local binders can be registered via TestApi. 33 // Local binders can be registered via TestApi.
33 auto it = binders_.find(name); 34 auto it = binders_.find(name);
34 if (it != binders_.end()) { 35 if (it != binders_.end()) {
35 it->second.Run(std::move(request_handle)); 36 it->second.Run(std::move(request_handle));
36 return; 37 return;
37 } 38 }
38 interface_provider_->GetInterface(name, std::move(request_handle)); 39 if (interface_provider_)
yzshen1 2016/06/29 22:25:44 ditto.
leonhsl(Using Gerrit) 2016/07/01 13:04:59 Done.
40 interface_provider_->GetInterface(name, std::move(request_handle));
39 } 41 }
40 42
41 void InterfaceProvider::ClearBinders() { 43 void InterfaceProvider::ClearBinders() {
42 binders_.clear(); 44 binders_.clear();
43 } 45 }
44 46
45 } // namespace shell 47 } // namespace shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698