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

Side by Side Diff: content/child/navigator_connect/navigator_connect_dispatcher.cc

Issue 781723002: Pass navigator.connect calls through to the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/child/navigator_connect/navigator_connect_dispatcher.h"
6
7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/child/navigator_connect/navigator_connect_provider.h"
9 #include "content/child/thread_safe_sender.h"
10 #include "content/child/worker_thread_task_runner.h"
11 #include "content/common/navigator_connect_messages.h"
12
13 namespace content {
14
15 NavigatorConnectDispatcher::NavigatorConnectDispatcher(ThreadSafeSender* sender)
16 : main_thread_loop_proxy_(base::MessageLoopProxy::current()),
17 thread_safe_sender_(sender) {
18 }
19
20 NavigatorConnectDispatcher::~NavigatorConnectDispatcher() {
21 }
22
23 base::TaskRunner* NavigatorConnectDispatcher::OverrideTaskRunnerForMessage(
24 const IPC::Message& msg) {
25 if (IPC_MESSAGE_CLASS(msg) != NavigatorConnectMsgStart)
26 return NULL;
27 int ipc_thread_id = 0;
28 const bool success = PickleIterator(msg).ReadInt(&ipc_thread_id);
29 DCHECK(success);
30 if (!ipc_thread_id)
31 return main_thread_loop_proxy_.get();
32 return new WorkerThreadTaskRunner(ipc_thread_id);
33 }
34
35 bool NavigatorConnectDispatcher::OnMessageReceived(const IPC::Message& msg) {
36 if (IPC_MESSAGE_CLASS(msg) != NavigatorConnectMsgStart)
37 return false;
38 NavigatorConnectProvider::ThreadSpecificInstance(thread_safe_sender_.get(),
39 main_thread_loop_proxy_)
40 ->OnMessageReceived(msg);
41 return true;
42 }
43
44 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698