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

Side by Side 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, 6 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/renderer/mojo/blink_service_registry_impl.h" 5 #include "content/renderer/mojo/blink_service_registry_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h"
9 #include "content/common/mojo/service_registry_impl.h" 11 #include "content/common/mojo/service_registry_impl.h"
10 12
11 namespace content { 13 namespace content {
12 14
13 BlinkServiceRegistryImpl::BlinkServiceRegistryImpl( 15 BlinkServiceRegistryImpl::BlinkServiceRegistryImpl(
14 base::WeakPtr<content::ServiceRegistry> service_registry) 16 base::WeakPtr<content::ServiceRegistry> service_registry)
15 : service_registry_(service_registry) {} 17 : service_registry_(service_registry),
18 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
19 weak_ptr_factory_(this) {}
16 20
17 BlinkServiceRegistryImpl::~BlinkServiceRegistryImpl() = default; 21 BlinkServiceRegistryImpl::~BlinkServiceRegistryImpl() = default;
18 22
19 void BlinkServiceRegistryImpl::connectToRemoteService( 23 void BlinkServiceRegistryImpl::connectToRemoteService(
20 const char* name, 24 const char* name,
21 mojo::ScopedMessagePipeHandle handle) { 25 mojo::ScopedMessagePipeHandle handle) {
26 if (!main_thread_task_runner_->BelongsToCurrentThread()) {
27 main_thread_task_runner_->PostTask(
28 FROM_HERE, base::Bind(&BlinkServiceRegistryImpl::connectToRemoteService,
29 weak_ptr_factory_.GetWeakPtr(), name,
30 base::Passed(&handle)));
31 return;
32 }
33
22 if (!service_registry_) 34 if (!service_registry_)
23 return; 35 return;
24 36
25 service_registry_->ConnectToRemoteService(name, std::move(handle)); 37 service_registry_->ConnectToRemoteService(name, std::move(handle));
26 } 38 }
27 39
28 } // namespace content 40 } // namespace content
OLDNEW
« 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