| OLD | NEW |
| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 IPC::Channel::MODE_CLIENT, | 232 IPC::Channel::MODE_CLIENT, |
| 233 this, | 233 this, |
| 234 ChildProcess::current()->io_message_loop_proxy(), | 234 ChildProcess::current()->io_message_loop_proxy(), |
| 235 true, | 235 true, |
| 236 ChildProcess::current()->GetShutDownEvent()); | 236 ChildProcess::current()->GetShutDownEvent()); |
| 237 #ifdef IPC_MESSAGE_LOG_ENABLED | 237 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 238 if (!in_browser_process_) | 238 if (!in_browser_process_) |
| 239 IPC::Logging::GetInstance()->SetIPCSender(this); | 239 IPC::Logging::GetInstance()->SetIPCSender(this); |
| 240 #endif | 240 #endif |
| 241 | 241 |
| 242 mojo_application_.reset(new MojoApplication); | 242 mojo_application_.reset(new MojoApplication(this)); |
| 243 | 243 |
| 244 sync_message_filter_ = | 244 sync_message_filter_ = |
| 245 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 245 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
| 246 thread_safe_sender_ = new ThreadSafeSender( | 246 thread_safe_sender_ = new ThreadSafeSender( |
| 247 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); | 247 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); |
| 248 | 248 |
| 249 resource_dispatcher_.reset(new ResourceDispatcher(this)); | 249 resource_dispatcher_.reset(new ResourceDispatcher(this)); |
| 250 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 250 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
| 251 websocket_dispatcher_.reset(new WebSocketDispatcher); | 251 websocket_dispatcher_.reset(new WebSocketDispatcher); |
| 252 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 252 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 void ChildThread::OnChannelConnected(int32 peer_pid) { | 364 void ChildThread::OnChannelConnected(int32 peer_pid) { |
| 365 channel_connected_factory_.InvalidateWeakPtrs(); | 365 channel_connected_factory_.InvalidateWeakPtrs(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void ChildThread::OnChannelError() { | 368 void ChildThread::OnChannelError() { |
| 369 set_on_channel_error_called(true); | 369 set_on_channel_error_called(true); |
| 370 base::MessageLoop::current()->Quit(); | 370 base::MessageLoop::current()->Quit(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void ChildThread::ConnectToService( |
| 374 const mojo::String& service_url, |
| 375 const mojo::String& service_name, |
| 376 mojo::ScopedMessagePipeHandle message_pipe, |
| 377 const mojo::String& requestor_url) { |
| 378 // By default, we don't expect incoming connections. |
| 379 NOTREACHED(); |
| 380 } |
| 381 |
| 373 bool ChildThread::Send(IPC::Message* msg) { | 382 bool ChildThread::Send(IPC::Message* msg) { |
| 374 DCHECK(base::MessageLoop::current() == message_loop()); | 383 DCHECK(base::MessageLoop::current() == message_loop()); |
| 375 if (!channel_) { | 384 if (!channel_) { |
| 376 delete msg; | 385 delete msg; |
| 377 return false; | 386 return false; |
| 378 } | 387 } |
| 379 | 388 |
| 380 return channel_->Send(msg); | 389 return channel_->Send(msg); |
| 381 } | 390 } |
| 382 | 391 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 577 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
| 569 | 578 |
| 570 #ifdef OS_WIN | 579 #ifdef OS_WIN |
| 571 // Windows Vista+ has a fancy process backgrounding mode that can only be set | 580 // Windows Vista+ has a fancy process backgrounding mode that can only be set |
| 572 // from within the process. | 581 // from within the process. |
| 573 base::Process::Current().SetProcessBackgrounded(background); | 582 base::Process::Current().SetProcessBackgrounded(background); |
| 574 #endif // OS_WIN | 583 #endif // OS_WIN |
| 575 } | 584 } |
| 576 | 585 |
| 577 } // namespace content | 586 } // namespace content |
| OLD | NEW |