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

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

Issue 2131493002: ShellConnection -> ServiceContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@st
Patch Set: . 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 "content/common/mojo/mojo_shell_connection_impl.h" 5 #include "content/common/mojo/mojo_shell_connection_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
11 #include "content/common/mojo/embedded_application_runner.h" 11 #include "content/common/mojo/embedded_application_runner.h"
12 #include "services/shell/public/cpp/service.h" 12 #include "services/shell/public/cpp/service.h"
13 #include "services/shell/public/cpp/shell_connection.h" 13 #include "services/shell/public/cpp/service_context.h"
14 #include "services/shell/runner/common/client_util.h" 14 #include "services/shell/runner/common/client_util.h"
15 15
16 namespace content { 16 namespace content {
17 namespace { 17 namespace {
18 18
19 using MojoShellConnectionPtr = 19 using MojoShellConnectionPtr =
20 base::ThreadLocalPointer<MojoShellConnection>; 20 base::ThreadLocalPointer<MojoShellConnection>;
21 21
22 // Env is thread local so that aura may be used on multiple threads. 22 // Env is thread local so that aura may be used on multiple threads.
23 base::LazyInstance<MojoShellConnectionPtr>::Leaky lazy_tls_ptr = 23 base::LazyInstance<MojoShellConnectionPtr>::Leaky lazy_tls_ptr =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return base::WrapUnique(new MojoShellConnectionImpl(std::move(request))); 63 return base::WrapUnique(new MojoShellConnectionImpl(std::move(request)));
64 } 64 }
65 65
66 MojoShellConnection::~MojoShellConnection() {} 66 MojoShellConnection::~MojoShellConnection() {}
67 67
68 //////////////////////////////////////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////////////////
69 // MojoShellConnectionImpl, public: 69 // MojoShellConnectionImpl, public:
70 70
71 MojoShellConnectionImpl::MojoShellConnectionImpl( 71 MojoShellConnectionImpl::MojoShellConnectionImpl(
72 shell::mojom::ServiceRequest request) 72 shell::mojom::ServiceRequest request)
73 : shell_connection_(new shell::ShellConnection(this, std::move(request))) {} 73 : shell_connection_(new shell::ServiceContext(this, std::move(request))) {}
74 74
75 MojoShellConnectionImpl::~MojoShellConnectionImpl() {} 75 MojoShellConnectionImpl::~MojoShellConnectionImpl() {}
76 76
77 //////////////////////////////////////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////////
78 // MojoShellConnectionImpl, shell::Service implementation: 78 // MojoShellConnectionImpl, shell::Service implementation:
79 79
80 void MojoShellConnectionImpl::OnStart(shell::Connector* connector, 80 void MojoShellConnectionImpl::OnStart(shell::Connector* connector,
81 const shell::Identity& identity, 81 const shell::Identity& identity,
82 uint32_t id) { 82 uint32_t id) {
83 for (auto& client : embedded_services_) 83 for (auto& client : embedded_services_)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 shell::mojom::ServiceRequest request, 143 shell::mojom::ServiceRequest request,
144 const mojo::String& name) { 144 const mojo::String& name) {
145 auto it = request_handlers_.find(name); 145 auto it = request_handlers_.find(name);
146 if (it != request_handlers_.end()) 146 if (it != request_handlers_.end())
147 it->second.Run(std::move(request)); 147 it->second.Run(std::move(request));
148 } 148 }
149 149
150 //////////////////////////////////////////////////////////////////////////////// 150 ////////////////////////////////////////////////////////////////////////////////
151 // MojoShellConnectionImpl, MojoShellConnection implementation: 151 // MojoShellConnectionImpl, MojoShellConnection implementation:
152 152
153 shell::ShellConnection* MojoShellConnectionImpl::GetShellConnection() { 153 shell::ServiceContext* MojoShellConnectionImpl::GetShellConnection() {
154 return shell_connection_.get(); 154 return shell_connection_.get();
155 } 155 }
156 156
157 shell::Connector* MojoShellConnectionImpl::GetConnector() { 157 shell::Connector* MojoShellConnectionImpl::GetConnector() {
158 DCHECK(shell_connection_); 158 DCHECK(shell_connection_);
159 return shell_connection_->connector(); 159 return shell_connection_->connector();
160 } 160 }
161 161
162 const shell::Identity& MojoShellConnectionImpl::GetIdentity() const { 162 const shell::Identity& MojoShellConnectionImpl::GetIdentity() const {
163 DCHECK(shell_connection_); 163 DCHECK(shell_connection_);
(...skipping 29 matching lines...) Expand all
193 } 193 }
194 194
195 void MojoShellConnectionImpl::AddServiceRequestHandler( 195 void MojoShellConnectionImpl::AddServiceRequestHandler(
196 const std::string& name, 196 const std::string& name,
197 const ServiceRequestHandler& handler) { 197 const ServiceRequestHandler& handler) {
198 auto result = request_handlers_.insert(std::make_pair(name, handler)); 198 auto result = request_handlers_.insert(std::make_pair(name, handler));
199 DCHECK(result.second); 199 DCHECK(result.second);
200 } 200 }
201 201
202 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/public/common/mojo_shell_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698