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

Unified Diff: content/browser/mojo/service_manager_context_impl.cc

Issue 2163883005: WIP: Obtain Bootstrap from utility process Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/mojo/service_manager_context_impl.h ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mojo/service_manager_context_impl.cc
diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/service_manager_context_impl.cc
similarity index 90%
rename from content/browser/mojo/mojo_shell_context.cc
rename to content/browser/mojo/service_manager_context_impl.cc
index 37b9e7011651132e7af28ddc1e70f69754d23e21..a7643104eaa360baf3e5cbf8a652bd833a307758 100644
--- a/content/browser/mojo/mojo_shell_context.cc
+++ b/content/browser/mojo/service_manager_context_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/mojo/mojo_shell_context.h"
+#include "content/browser/mojo/service_manager_context_impl.h"
#include <unordered_map>
#include <utility>
@@ -128,7 +128,7 @@ void LaunchAppInGpuProcess(const std::string& app_name,
// A ManifestProvider which resolves application names to builtin manifest
// resources for the catalog service to consume.
-class MojoShellContext::BuiltinManifestProvider
+class ServiceManagerContextImpl::BuiltinManifestProvider
: public catalog::ManifestProvider {
public:
BuiltinManifestProvider() {}
@@ -174,10 +174,10 @@ class MojoShellContext::BuiltinManifestProvider
};
// Thread-safe proxy providing access to the shell context from any thread.
-class MojoShellContext::Proxy {
+class ServiceManagerContextImpl::Proxy {
public:
- Proxy(MojoShellContext* shell_context)
- : shell_context_(shell_context),
+ Proxy(ServiceManagerContextImpl* context)
+ : context_(context),
task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
~Proxy() {}
@@ -190,35 +190,35 @@ class MojoShellContext::Proxy {
shell::mojom::InterfaceProviderPtr exposed_services,
const shell::mojom::Connector::ConnectCallback& callback) {
if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) {
- if (shell_context_) {
- shell_context_->ConnectToApplicationOnOwnThread(
+ if (context_) {
+ context_->ConnectToApplicationOnOwnThread(
user_id, name, requestor_name, std::move(request),
std::move(exposed_services), callback);
}
} else {
- // |shell_context_| outlives the main MessageLoop, so it's safe for it to
+ // |context_| outlives the main MessageLoop, so it's safe for it to
// be unretained here.
task_runner_->PostTask(
FROM_HERE,
- base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread,
- base::Unretained(shell_context_), user_id, name,
+ base::Bind(&ServiceManagerContextImpl::ConnectToApplicationOnOwnThread,
+ base::Unretained(context_), user_id, name,
requestor_name, base::Passed(&request),
base::Passed(&exposed_services), callback));
}
}
private:
- MojoShellContext* shell_context_;
+ ServiceManagerContextImpl* context_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(Proxy);
};
// static
-base::LazyInstance<std::unique_ptr<MojoShellContext::Proxy>>
- MojoShellContext::proxy_ = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<std::unique_ptr<ServiceManagerContextImpl::Proxy>>
+ ServiceManagerContextImpl::proxy_ = LAZY_INSTANCE_INITIALIZER;
-MojoShellContext::MojoShellContext() {
+ServiceManagerContextImpl::ServiceManagerContextImpl() {
proxy_.Get().reset(new Proxy(this));
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
@@ -273,8 +273,9 @@ MojoShellContext::MojoShellContext() {
entry.second);
}
- // This is safe to assign directly from any thread, because MojoShellContext
- // must be constructed before anyone can call GetConnectorForIOThread().
+ // This is safe to assign directly from any thread, because
+ // ServiceManagerContextImpl must be constructed before anyone can call
+ // GetConnectorForIOThread().
g_io_thread_connector.Get() =
MojoShellConnection::GetForProcess()->GetConnector()->Clone();
@@ -308,7 +309,7 @@ MojoShellContext::MojoShellContext() {
#endif
}
-MojoShellContext::~MojoShellContext() {
+ServiceManagerContextImpl::~ServiceManagerContextImpl() {
if (MojoShellConnection::GetForProcess())
MojoShellConnection::DestroyForProcess();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
@@ -317,7 +318,7 @@ MojoShellContext::~MojoShellContext() {
}
// static
-void MojoShellContext::ConnectToApplication(
+void ServiceManagerContextImpl::ConnectToApplication(
const std::string& user_id,
const std::string& name,
const std::string& requestor_name,
@@ -330,12 +331,12 @@ void MojoShellContext::ConnectToApplication(
}
// static
-shell::Connector* MojoShellContext::GetConnectorForIOThread() {
+shell::Connector* ServiceManagerContextImpl::GetConnectorForIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return g_io_thread_connector.Get().get();
}
-void MojoShellContext::ConnectToApplicationOnOwnThread(
+void ServiceManagerContextImpl::ConnectToApplicationOnOwnThread(
const std::string& user_id,
const std::string& name,
const std::string& requestor_name,
@@ -352,4 +353,9 @@ void MojoShellContext::ConnectToApplicationOnOwnThread(
service_manager_->Connect(std::move(params));
}
+// static
+std::unique_ptr<ServiceManagerContext> ServiceManagerContext::Create() {
+ return base::WrapUnique(new ServiceManagerContextImpl);
+}
+
} // namespace content
« no previous file with comments | « content/browser/mojo/service_manager_context_impl.h ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698