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

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

Issue 2166953006: Eliminate FrameMojoShell. (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/mojo_shell_context.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mojo/mojo_shell_context.cc
diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc
index 37b9e7011651132e7af28ddc1e70f69754d23e21..6053190a128b624411371295894ad3501f90d0ec 100644
--- a/content/browser/mojo/mojo_shell_context.cc
+++ b/content/browser/mojo/mojo_shell_context.cc
@@ -173,54 +173,7 @@ class MojoShellContext::BuiltinManifestProvider
DISALLOW_COPY_AND_ASSIGN(BuiltinManifestProvider);
};
-// Thread-safe proxy providing access to the shell context from any thread.
-class MojoShellContext::Proxy {
- public:
- Proxy(MojoShellContext* shell_context)
- : shell_context_(shell_context),
- task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
-
- ~Proxy() {}
-
- void ConnectToApplication(
- const std::string& user_id,
- const std::string& name,
- const std::string& requestor_name,
- shell::mojom::InterfaceProviderRequest request,
- shell::mojom::InterfaceProviderPtr exposed_services,
- const shell::mojom::Connector::ConnectCallback& callback) {
- if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) {
- if (shell_context_) {
- shell_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
- // be unretained here.
- task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread,
- base::Unretained(shell_context_), user_id, name,
- requestor_name, base::Passed(&request),
- base::Passed(&exposed_services), callback));
- }
- }
-
- private:
- MojoShellContext* shell_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;
-
MojoShellContext::MojoShellContext() {
- proxy_.Get().reset(new Proxy(this));
-
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE);
std::unique_ptr<shell::NativeRunnerFactory> native_runner_factory(
@@ -317,39 +270,9 @@ MojoShellContext::~MojoShellContext() {
}
// static
-void MojoShellContext::ConnectToApplication(
- const std::string& user_id,
- const std::string& name,
- const std::string& requestor_name,
- shell::mojom::InterfaceProviderRequest request,
- shell::mojom::InterfaceProviderPtr exposed_services,
- const shell::mojom::Connector::ConnectCallback& callback) {
- proxy_.Get()->ConnectToApplication(user_id, name, requestor_name,
- std::move(request),
- std::move(exposed_services), callback);
-}
-
-// static
shell::Connector* MojoShellContext::GetConnectorForIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return g_io_thread_connector.Get().get();
}
-void MojoShellContext::ConnectToApplicationOnOwnThread(
- const std::string& user_id,
- const std::string& name,
- const std::string& requestor_name,
- shell::mojom::InterfaceProviderRequest request,
- shell::mojom::InterfaceProviderPtr exposed_services,
- const shell::mojom::Connector::ConnectCallback& callback) {
- std::unique_ptr<shell::ConnectParams> params(new shell::ConnectParams);
- shell::Identity source_id(requestor_name, user_id);
- params->set_source(source_id);
- params->set_target(shell::Identity(name, user_id));
- params->set_remote_interfaces(std::move(request));
- params->set_local_interfaces(std::move(exposed_services));
- params->set_connect_callback(callback);
- service_manager_->Connect(std::move(params));
-}
-
} // namespace content
« no previous file with comments | « content/browser/mojo/mojo_shell_context.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698