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 22 matching lines...) Expand all Loading... |
33 #include "content/child/child_shared_bitmap_manager.h" | 33 #include "content/child/child_shared_bitmap_manager.h" |
34 #include "content/child/fileapi/file_system_dispatcher.h" | 34 #include "content/child/fileapi/file_system_dispatcher.h" |
35 #include "content/child/fileapi/webfilesystem_impl.h" | 35 #include "content/child/fileapi/webfilesystem_impl.h" |
36 #include "content/child/geofencing/geofencing_message_filter.h" | 36 #include "content/child/geofencing/geofencing_message_filter.h" |
37 #include "content/child/mojo/mojo_application.h" | 37 #include "content/child/mojo/mojo_application.h" |
38 #include "content/child/power_monitor_broadcast_source.h" | 38 #include "content/child/power_monitor_broadcast_source.h" |
39 #include "content/child/quota_dispatcher.h" | 39 #include "content/child/quota_dispatcher.h" |
40 #include "content/child/quota_message_filter.h" | 40 #include "content/child/quota_message_filter.h" |
41 #include "content/child/resource_dispatcher.h" | 41 #include "content/child/resource_dispatcher.h" |
42 #include "content/child/service_worker/service_worker_message_filter.h" | 42 #include "content/child/service_worker/service_worker_message_filter.h" |
43 #include "content/child/socket_stream_dispatcher.h" | |
44 #include "content/child/thread_safe_sender.h" | 43 #include "content/child/thread_safe_sender.h" |
45 #include "content/child/websocket_dispatcher.h" | 44 #include "content/child/websocket_dispatcher.h" |
46 #include "content/common/child_process_messages.h" | 45 #include "content/common/child_process_messages.h" |
47 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
48 #include "ipc/ipc_logging.h" | 47 #include "ipc/ipc_logging.h" |
49 #include "ipc/ipc_switches.h" | 48 #include "ipc/ipc_switches.h" |
50 #include "ipc/ipc_sync_channel.h" | 49 #include "ipc/ipc_sync_channel.h" |
51 #include "ipc/ipc_sync_message_filter.h" | 50 #include "ipc/ipc_sync_message_filter.h" |
52 #include "ipc/mojo/ipc_channel_mojo.h" | 51 #include "ipc/mojo/ipc_channel_mojo.h" |
53 | 52 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 #endif | 266 #endif |
268 | 267 |
269 mojo_application_.reset(new MojoApplication); | 268 mojo_application_.reset(new MojoApplication); |
270 | 269 |
271 sync_message_filter_ = | 270 sync_message_filter_ = |
272 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 271 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
273 thread_safe_sender_ = new ThreadSafeSender( | 272 thread_safe_sender_ = new ThreadSafeSender( |
274 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); | 273 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); |
275 | 274 |
276 resource_dispatcher_.reset(new ResourceDispatcher(this)); | 275 resource_dispatcher_.reset(new ResourceDispatcher(this)); |
277 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | |
278 websocket_dispatcher_.reset(new WebSocketDispatcher); | 276 websocket_dispatcher_.reset(new WebSocketDispatcher); |
279 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 277 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
280 | 278 |
281 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 279 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
282 resource_message_filter_ = | 280 resource_message_filter_ = |
283 new ChildResourceMessageFilter(resource_dispatcher()); | 281 new ChildResourceMessageFilter(resource_dispatcher()); |
284 | 282 |
285 service_worker_message_filter_ = | 283 service_worker_message_filter_ = |
286 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); | 284 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); |
287 | 285 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 return shared_buf.release(); | 455 return shared_buf.release(); |
458 } | 456 } |
459 | 457 |
460 bool ChildThread::OnMessageReceived(const IPC::Message& msg) { | 458 bool ChildThread::OnMessageReceived(const IPC::Message& msg) { |
461 if (mojo_application_->OnMessageReceived(msg)) | 459 if (mojo_application_->OnMessageReceived(msg)) |
462 return true; | 460 return true; |
463 | 461 |
464 // Resource responses are sent to the resource dispatcher. | 462 // Resource responses are sent to the resource dispatcher. |
465 if (resource_dispatcher_->OnMessageReceived(msg)) | 463 if (resource_dispatcher_->OnMessageReceived(msg)) |
466 return true; | 464 return true; |
467 if (socket_stream_dispatcher_->OnMessageReceived(msg)) | |
468 return true; | |
469 if (websocket_dispatcher_->OnMessageReceived(msg)) | 465 if (websocket_dispatcher_->OnMessageReceived(msg)) |
470 return true; | 466 return true; |
471 if (file_system_dispatcher_->OnMessageReceived(msg)) | 467 if (file_system_dispatcher_->OnMessageReceived(msg)) |
472 return true; | 468 return true; |
473 | 469 |
474 bool handled = true; | 470 bool handled = true; |
475 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) | 471 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) |
476 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) | 472 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) |
477 #if defined(IPC_MESSAGE_LOG_ENABLED) | 473 #if defined(IPC_MESSAGE_LOG_ENABLED) |
478 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, | 474 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 591 |
596 void ChildThread::OnProcessBackgrounded(bool background) { | 592 void ChildThread::OnProcessBackgrounded(bool background) { |
597 // Set timer slack to maximum on main thread when in background. | 593 // Set timer slack to maximum on main thread when in background. |
598 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 594 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
599 if (background) | 595 if (background) |
600 timer_slack = base::TIMER_SLACK_MAXIMUM; | 596 timer_slack = base::TIMER_SLACK_MAXIMUM; |
601 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 597 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
602 } | 598 } |
603 | 599 |
604 } // namespace content | 600 } // namespace content |
OLD | NEW |