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

Side by Side Diff: content/common/mojo/mojo_shell_connection_impl.cc

Issue 2157143002: Move interface registration to OnConnect in RPH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 "content/common/mojo/mojo_shell_connection_impl.h" 5 #include "content/common/mojo/mojo_shell_connection_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!started_) 79 if (!started_)
80 return; 80 return;
81 81
82 bool posted = io_task_runner_->PostTask( 82 bool posted = io_task_runner_->PostTask(
83 FROM_HERE, base::Bind(&IOThreadContext::ShutDownOnIOThread, this)); 83 FROM_HERE, base::Bind(&IOThreadContext::ShutDownOnIOThread, this));
84 DCHECK(posted); 84 DCHECK(posted);
85 } 85 }
86 86
87 // Safe to call any time before Start() is called. 87 // Safe to call any time before Start() is called.
88 void AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) { 88 void AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) {
89 DCHECK(!started_); 89 //DCHECK(!started_);
90 connection_filters_.emplace_back(std::move(filter)); 90 connection_filters_.emplace_back(std::move(filter));
91 } 91 }
92 92
93 // Safe to call any time before Start() is called. 93 // Safe to call any time before Start() is called.
94 void SetDefaultBinderForBrowserConnection( 94 void SetDefaultBinderForBrowserConnection(
95 const shell::InterfaceRegistry::Binder& binder) { 95 const shell::InterfaceRegistry::Binder& binder) {
96 DCHECK(!started_); 96 DCHECK(!started_);
97 default_browser_binder_ = base::Bind( 97 default_browser_binder_ = base::Bind(
98 &IOThreadContext::CallBinderOnTaskRunner, 98 &IOThreadContext::CallBinderOnTaskRunner,
99 base::ThreadTaskRunnerHandle::Get(), binder); 99 base::ThreadTaskRunnerHandle::Get(), binder);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 383
384 void MojoShellConnectionImpl::SetupInterfaceRequestProxies( 384 void MojoShellConnectionImpl::SetupInterfaceRequestProxies(
385 shell::InterfaceRegistry* registry, 385 shell::InterfaceRegistry* registry,
386 shell::InterfaceProvider* provider) { 386 shell::InterfaceProvider* provider) {
387 // It's safe to bind |registry| as a raw pointer because the caller must 387 // It's safe to bind |registry| as a raw pointer because the caller must
388 // guarantee that it outlives |this|, and |this| is bound as a weak ptr here. 388 // guarantee that it outlives |this|, and |this| is bound as a weak ptr here.
389 context_->SetDefaultBinderForBrowserConnection( 389 context_->SetDefaultBinderForBrowserConnection(
390 base::Bind(&MojoShellConnectionImpl::GetInterface, 390 base::Bind(&MojoShellConnectionImpl::GetInterface,
391 weak_factory_.GetWeakPtr(), registry)); 391 weak_factory_.GetWeakPtr(), registry));
392 392
393 // Forward all remote interface requests on |provider| to our IO-thread 393 if (provider) {
394 // context. This will ensure they're forwarded to the provider on the 394 // Forward all remote interface requests on |provider| to our IO-thread
395 // incoming browser connection. 395 // context. This will ensure they're forwarded to the provider on the
396 provider->Forward(base::Bind(&IOThreadContext::GetRemoteInterface, context_)); 396 // incoming browser connection.
397 provider->Forward(base::Bind(&IOThreadContext::GetRemoteInterface,
398 context_));
399 }
397 } 400 }
398 401
399 void MojoShellConnectionImpl::AddConnectionFilter( 402 void MojoShellConnectionImpl::AddConnectionFilter(
400 std::unique_ptr<ConnectionFilter> filter) { 403 std::unique_ptr<ConnectionFilter> filter) {
401 context_->AddConnectionFilter(std::move(filter)); 404 context_->AddConnectionFilter(std::move(filter));
402 } 405 }
403 406
404 void MojoShellConnectionImpl::AddEmbeddedService( 407 void MojoShellConnectionImpl::AddEmbeddedService(
405 const std::string& name, 408 const std::string& name,
406 const MojoApplicationInfo& info) { 409 const MojoApplicationInfo& info) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 444 }
442 445
443 void MojoShellConnectionImpl::GetInterface( 446 void MojoShellConnectionImpl::GetInterface(
444 shell::mojom::InterfaceProvider* provider, 447 shell::mojom::InterfaceProvider* provider,
445 const mojo::String& interface_name, 448 const mojo::String& interface_name,
446 mojo::ScopedMessagePipeHandle request_handle) { 449 mojo::ScopedMessagePipeHandle request_handle) {
447 provider->GetInterface(interface_name, std::move(request_handle)); 450 provider->GetInterface(interface_name, std::move(request_handle));
448 } 451 }
449 452
450 } // namespace content 453 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698