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

Unified Diff: content/renderer/mojo/blink_service_registry_impl.cc

Issue 2003023002: Introduce the Blink NotificationService, move permission checks there (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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/renderer/mojo/blink_service_registry_impl.h ('k') | third_party/WebKit/Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/mojo/blink_service_registry_impl.cc
diff --git a/content/renderer/mojo/blink_service_registry_impl.cc b/content/renderer/mojo/blink_service_registry_impl.cc
index 6a2fdf09a6abd87bca03d0ce8fa6ed7dc3724586..f0e2b438c8857c7b4e2bdc3e00edd05e73b48c3d 100644
--- a/content/renderer/mojo/blink_service_registry_impl.cc
+++ b/content/renderer/mojo/blink_service_registry_impl.cc
@@ -6,19 +6,31 @@
#include <utility>
+#include "base/single_thread_task_runner.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "content/common/mojo/service_registry_impl.h"
namespace content {
BlinkServiceRegistryImpl::BlinkServiceRegistryImpl(
base::WeakPtr<content::ServiceRegistry> service_registry)
- : service_registry_(service_registry) {}
+ : service_registry_(service_registry),
+ main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
+ weak_ptr_factory_(this) {}
BlinkServiceRegistryImpl::~BlinkServiceRegistryImpl() = default;
void BlinkServiceRegistryImpl::connectToRemoteService(
const char* name,
mojo::ScopedMessagePipeHandle handle) {
+ if (!main_thread_task_runner_->BelongsToCurrentThread()) {
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&BlinkServiceRegistryImpl::connectToRemoteService,
+ weak_ptr_factory_.GetWeakPtr(), name,
+ base::Passed(&handle)));
+ return;
+ }
+
if (!service_registry_)
return;
« no previous file with comments | « content/renderer/mojo/blink_service_registry_impl.h ('k') | third_party/WebKit/Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698