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

Side by Side Diff: content/child/child_thread.cc

Issue 285333003: Support exposing Mojo services between render frames, render threads, and their respective hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle the case where handles arrive before the RenderFrame is ready Created 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 IPC::Channel::MODE_CLIENT, 231 IPC::Channel::MODE_CLIENT,
232 this, 232 this,
233 ChildProcess::current()->io_message_loop_proxy(), 233 ChildProcess::current()->io_message_loop_proxy(),
234 true, 234 true,
235 ChildProcess::current()->GetShutDownEvent()); 235 ChildProcess::current()->GetShutDownEvent());
236 #ifdef IPC_MESSAGE_LOG_ENABLED 236 #ifdef IPC_MESSAGE_LOG_ENABLED
237 if (!in_browser_process_) 237 if (!in_browser_process_)
238 IPC::Logging::GetInstance()->SetIPCSender(this); 238 IPC::Logging::GetInstance()->SetIPCSender(this);
239 #endif 239 #endif
240 240
241 mojo_application_.reset(new MojoApplication(this)); 241 mojo_application_.reset(new MojoApplication);
242 242
243 sync_message_filter_ = 243 sync_message_filter_ =
244 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 244 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
245 thread_safe_sender_ = new ThreadSafeSender( 245 thread_safe_sender_ = new ThreadSafeSender(
246 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); 246 base::MessageLoopProxy::current().get(), sync_message_filter_.get());
247 247
248 resource_dispatcher_.reset(new ResourceDispatcher(this)); 248 resource_dispatcher_.reset(new ResourceDispatcher(this));
249 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 249 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
250 websocket_dispatcher_.reset(new WebSocketDispatcher); 250 websocket_dispatcher_.reset(new WebSocketDispatcher);
251 file_system_dispatcher_.reset(new FileSystemDispatcher()); 251 file_system_dispatcher_.reset(new FileSystemDispatcher());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 void ChildThread::OnChannelConnected(int32 peer_pid) { 348 void ChildThread::OnChannelConnected(int32 peer_pid) {
349 channel_connected_factory_.InvalidateWeakPtrs(); 349 channel_connected_factory_.InvalidateWeakPtrs();
350 } 350 }
351 351
352 void ChildThread::OnChannelError() { 352 void ChildThread::OnChannelError() {
353 set_on_channel_error_called(true); 353 set_on_channel_error_called(true);
354 base::MessageLoop::current()->Quit(); 354 base::MessageLoop::current()->Quit();
355 } 355 }
356 356
357 void ChildThread::ConnectToService(
358 const mojo::String& service_url,
359 const mojo::String& service_name,
360 mojo::ScopedMessagePipeHandle message_pipe,
361 const mojo::String& requestor_url) {
362 // By default, we don't expect incoming connections.
363 NOTREACHED();
364 }
365
366 bool ChildThread::Send(IPC::Message* msg) { 357 bool ChildThread::Send(IPC::Message* msg) {
367 DCHECK(base::MessageLoop::current() == message_loop()); 358 DCHECK(base::MessageLoop::current() == message_loop());
368 if (!channel_) { 359 if (!channel_) {
369 delete msg; 360 delete msg;
370 return false; 361 return false;
371 } 362 }
372 363
373 return channel_->Send(msg); 364 return channel_->Send(msg);
374 } 365 }
375 366
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 base::MessageLoop::current()->SetTimerSlack(timer_slack); 552 base::MessageLoop::current()->SetTimerSlack(timer_slack);
562 553
563 #ifdef OS_WIN 554 #ifdef OS_WIN
564 // Windows Vista+ has a fancy process backgrounding mode that can only be set 555 // Windows Vista+ has a fancy process backgrounding mode that can only be set
565 // from within the process. 556 // from within the process.
566 base::Process::Current().SetProcessBackgrounded(background); 557 base::Process::Current().SetProcessBackgrounded(background);
567 #endif // OS_WIN 558 #endif // OS_WIN
568 } 559 }
569 560
570 } // namespace content 561 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698