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

Side by Side Diff: content/browser/mojo/mojo_application_host.cc

Issue 954643002: Update mojo sdk to rev 3d23dae011859a2aae49f1d1adde705c8e85d819 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve more msvc linkage woes Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 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 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/browser/mojo/mojo_application_host.h" 5 #include "content/browser/mojo/mojo_application_host.h"
6 6
7 #include "content/common/mojo/mojo_messages.h" 7 #include "content/common/mojo/mojo_messages.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
10 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" 10 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 MojoApplicationHost::~MojoApplicationHost() { 58 MojoApplicationHost::~MojoApplicationHost() {
59 } 59 }
60 60
61 bool MojoApplicationHost::Init() { 61 bool MojoApplicationHost::Init() {
62 DCHECK(!client_handle_.is_valid()) << "Already initialized!"; 62 DCHECK(!client_handle_.is_valid()) << "Already initialized!";
63 63
64 mojo::embedder::PlatformChannelPair channel_pair; 64 mojo::embedder::PlatformChannelPair channel_pair;
65 65
66 scoped_refptr<base::TaskRunner> io_task_runner;
Hajime Morrita 2015/03/02 23:27:26 We could possibly pass the task runner to the ctor
67 if (io_task_runner_override_) {
68 io_task_runner = io_task_runner_override_;
69 } else {
70 io_task_runner =
71 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
72 ->task_runner();
73 }
74
66 mojo::ScopedMessagePipeHandle message_pipe = channel_init_.Init( 75 mojo::ScopedMessagePipeHandle message_pipe = channel_init_.Init(
67 PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()), 76 PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()),
68 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 77 io_task_runner);
69 if (!message_pipe.is_valid()) 78 if (!message_pipe.is_valid())
70 return false; 79 return false;
71 80
72 // Forward this to the client once we know its process handle. 81 // Forward this to the client once we know its process handle.
73 client_handle_ = channel_pair.PassClientHandle(); 82 client_handle_ = channel_pair.PassClientHandle();
74 83
75 application_setup_.reset(new ApplicationSetupImpl( 84 application_setup_.reset(new ApplicationSetupImpl(
76 &service_registry_, 85 &service_registry_,
77 mojo::MakeRequest<ApplicationSetup>(message_pipe.Pass()))); 86 mojo::MakeRequest<ApplicationSetup>(message_pipe.Pass())));
78 return true; 87 return true;
79 } 88 }
80 89
81 void MojoApplicationHost::Activate(IPC::Sender* sender, 90 void MojoApplicationHost::Activate(IPC::Sender* sender,
82 base::ProcessHandle process_handle) { 91 base::ProcessHandle process_handle) {
83 DCHECK(!did_activate_); 92 DCHECK(!did_activate_);
84 DCHECK(client_handle_.is_valid()); 93 DCHECK(client_handle_.is_valid());
85 94
86 base::PlatformFile client_file = 95 base::PlatformFile client_file =
87 PlatformFileFromScopedPlatformHandle(client_handle_.Pass()); 96 PlatformFileFromScopedPlatformHandle(client_handle_.Pass());
88 did_activate_ = sender->Send(new MojoMsg_Activate( 97 did_activate_ = sender->Send(new MojoMsg_Activate(
89 IPC::GetFileHandleForProcess(client_file, process_handle, true))); 98 IPC::GetFileHandleForProcess(client_file, process_handle, true)));
90 } 99 }
91 100
92 void MojoApplicationHost::WillDestroySoon() { 101 void MojoApplicationHost::WillDestroySoon() {
93 channel_init_.WillDestroySoon(); 102 channel_init_.WillDestroySoon();
94 } 103 }
95 104
105 void MojoApplicationHost::OverrideIOTaskRunnerForTest(
106 scoped_refptr<base::TaskRunner> io_task_runner) {
107 io_task_runner_override_ = io_task_runner;
108 }
109
96 } // namespace content 110 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_application_host.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698