| 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_impl.h" | 5 #include "content/child/child_thread_impl.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "content/child/push_messaging/push_dispatcher.h" | 46 #include "content/child/push_messaging/push_dispatcher.h" |
| 47 #include "content/child/quota_dispatcher.h" | 47 #include "content/child/quota_dispatcher.h" |
| 48 #include "content/child/quota_message_filter.h" | 48 #include "content/child/quota_message_filter.h" |
| 49 #include "content/child/resource_dispatcher.h" | 49 #include "content/child/resource_dispatcher.h" |
| 50 #include "content/child/service_worker/service_worker_message_filter.h" | 50 #include "content/child/service_worker/service_worker_message_filter.h" |
| 51 #include "content/child/thread_safe_sender.h" | 51 #include "content/child/thread_safe_sender.h" |
| 52 #include "content/child/websocket_dispatcher.h" | 52 #include "content/child/websocket_dispatcher.h" |
| 53 #include "content/common/child_process_messages.h" | 53 #include "content/common/child_process_messages.h" |
| 54 #include "content/common/in_process_child_thread_params.h" | 54 #include "content/common/in_process_child_thread_params.h" |
| 55 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
| 56 #include "ipc/attachment_broker.h" | 56 #include "ipc/attachment_broker_unprivileged.h" |
| 57 #include "ipc/ipc_logging.h" | 57 #include "ipc/ipc_logging.h" |
| 58 #include "ipc/ipc_switches.h" | 58 #include "ipc/ipc_switches.h" |
| 59 #include "ipc/ipc_sync_channel.h" | 59 #include "ipc/ipc_sync_channel.h" |
| 60 #include "ipc/ipc_sync_message_filter.h" | 60 #include "ipc/ipc_sync_message_filter.h" |
| 61 #include "ipc/mojo/ipc_channel_mojo.h" | 61 #include "ipc/mojo/ipc_channel_mojo.h" |
| 62 | 62 |
| 63 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 63 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 64 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 64 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 65 #endif | 65 #endif |
| 66 | 66 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 #if defined(OS_MACOSX) | 429 #if defined(OS_MACOSX) |
| 430 channel_->AddFilter(new IOSurfaceManagerFilter()); | 430 channel_->AddFilter(new IOSurfaceManagerFilter()); |
| 431 #endif | 431 #endif |
| 432 | 432 |
| 433 // Add filters passed here via options. | 433 // Add filters passed here via options. |
| 434 for (auto startup_filter : options.startup_filters) { | 434 for (auto startup_filter : options.startup_filters) { |
| 435 channel_->AddFilter(startup_filter); | 435 channel_->AddFilter(startup_filter); |
| 436 } | 436 } |
| 437 | 437 |
| 438 ConnectChannel(options.use_mojo_channel); | 438 ConnectChannel(options.use_mojo_channel); |
| 439 if (attachment_broker_) |
| 440 attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get()); |
| 439 | 441 |
| 440 int connection_timeout = kConnectionTimeoutS; | 442 int connection_timeout = kConnectionTimeoutS; |
| 441 std::string connection_override = | 443 std::string connection_override = |
| 442 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 444 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 443 switches::kIPCConnectionTimeout); | 445 switches::kIPCConnectionTimeout); |
| 444 if (!connection_override.empty()) { | 446 if (!connection_override.empty()) { |
| 445 int temp; | 447 int temp; |
| 446 if (base::StringToInt(connection_override, &temp)) | 448 if (base::StringToInt(connection_override, &temp)) |
| 447 connection_timeout = temp; | 449 connection_timeout = temp; |
| 448 } | 450 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 if (mojo_application_->OnMessageReceived(msg)) | 587 if (mojo_application_->OnMessageReceived(msg)) |
| 586 return true; | 588 return true; |
| 587 | 589 |
| 588 // Resource responses are sent to the resource dispatcher. | 590 // Resource responses are sent to the resource dispatcher. |
| 589 if (resource_dispatcher_->OnMessageReceived(msg)) | 591 if (resource_dispatcher_->OnMessageReceived(msg)) |
| 590 return true; | 592 return true; |
| 591 if (websocket_dispatcher_->OnMessageReceived(msg)) | 593 if (websocket_dispatcher_->OnMessageReceived(msg)) |
| 592 return true; | 594 return true; |
| 593 if (file_system_dispatcher_->OnMessageReceived(msg)) | 595 if (file_system_dispatcher_->OnMessageReceived(msg)) |
| 594 return true; | 596 return true; |
| 595 if (attachment_broker_ && attachment_broker_->OnMessageReceived(msg)) | |
| 596 return true; | |
| 597 | 597 |
| 598 bool handled = true; | 598 bool handled = true; |
| 599 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) | 599 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) |
| 600 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) | 600 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) |
| 601 #if defined(IPC_MESSAGE_LOG_ENABLED) | 601 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 602 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, | 602 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
| 603 OnSetIPCLoggingEnabled) | 603 OnSetIPCLoggingEnabled) |
| 604 #endif | 604 #endif |
| 605 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, | 605 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, |
| 606 OnSetProfilerStatus) | 606 OnSetProfilerStatus) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 | 709 |
| 710 void ChildThreadImpl::OnProcessBackgrounded(bool background) { | 710 void ChildThreadImpl::OnProcessBackgrounded(bool background) { |
| 711 // Set timer slack to maximum on main thread when in background. | 711 // Set timer slack to maximum on main thread when in background. |
| 712 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 712 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
| 713 if (background) | 713 if (background) |
| 714 timer_slack = base::TIMER_SLACK_MAXIMUM; | 714 timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 715 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 715 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
| 716 } | 716 } |
| 717 | 717 |
| 718 } // namespace content | 718 } // namespace content |
| OLD | NEW |