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

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

Issue 2000113002: Delegate WebSocket message handlers to the loading task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment Created 4 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
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/websocket_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "content/child/mojo/mojo_application.h" 44 #include "content/child/mojo/mojo_application.h"
45 #include "content/child/notifications/notification_dispatcher.h" 45 #include "content/child/notifications/notification_dispatcher.h"
46 #include "content/child/power_monitor_broadcast_source.h" 46 #include "content/child/power_monitor_broadcast_source.h"
47 #include "content/child/push_messaging/push_dispatcher.h" 47 #include "content/child/push_messaging/push_dispatcher.h"
48 #include "content/child/quota_dispatcher.h" 48 #include "content/child/quota_dispatcher.h"
49 #include "content/child/quota_message_filter.h" 49 #include "content/child/quota_message_filter.h"
50 #include "content/child/resource_dispatcher.h" 50 #include "content/child/resource_dispatcher.h"
51 #include "content/child/service_worker/service_worker_message_filter.h" 51 #include "content/child/service_worker/service_worker_message_filter.h"
52 #include "content/child/thread_safe_sender.h" 52 #include "content/child/thread_safe_sender.h"
53 #include "content/child/websocket_dispatcher.h" 53 #include "content/child/websocket_dispatcher.h"
54 #include "content/child/websocket_message_filter.h"
54 #include "content/common/child_process_messages.h" 55 #include "content/common/child_process_messages.h"
55 #include "content/common/in_process_child_thread_params.h" 56 #include "content/common/in_process_child_thread_params.h"
56 #include "content/common/mojo/mojo_shell_connection_impl.h" 57 #include "content/common/mojo/mojo_shell_connection_impl.h"
57 #include "content/public/common/content_switches.h" 58 #include "content/public/common/content_switches.h"
58 #include "content/public/common/mojo_channel_switches.h" 59 #include "content/public/common/mojo_channel_switches.h"
59 #include "ipc/attachment_broker.h" 60 #include "ipc/attachment_broker.h"
60 #include "ipc/attachment_broker_unprivileged.h" 61 #include "ipc/attachment_broker_unprivileged.h"
61 #include "ipc/ipc_logging.h" 62 #include "ipc/ipc_logging.h"
62 #include "ipc/ipc_platform_file.h" 63 #include "ipc/ipc_platform_file.h"
63 #include "ipc/ipc_switches.h" 64 #include "ipc/ipc_switches.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); 425 new ServiceWorkerMessageFilter(thread_safe_sender_.get());
425 426
426 quota_message_filter_ = 427 quota_message_filter_ =
427 new QuotaMessageFilter(thread_safe_sender_.get()); 428 new QuotaMessageFilter(thread_safe_sender_.get());
428 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), 429 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(),
429 quota_message_filter_.get())); 430 quota_message_filter_.get()));
430 notification_dispatcher_ = 431 notification_dispatcher_ =
431 new NotificationDispatcher(thread_safe_sender_.get()); 432 new NotificationDispatcher(thread_safe_sender_.get());
432 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); 433 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get());
433 434
435 websocket_message_filter_ =
436 new WebSocketMessageFilter(websocket_dispatcher_.get());
437
434 channel_->AddFilter(histogram_message_filter_.get()); 438 channel_->AddFilter(histogram_message_filter_.get());
435 channel_->AddFilter(resource_message_filter_.get()); 439 channel_->AddFilter(resource_message_filter_.get());
436 channel_->AddFilter(quota_message_filter_->GetFilter()); 440 channel_->AddFilter(quota_message_filter_->GetFilter());
437 channel_->AddFilter(notification_dispatcher_->GetFilter()); 441 channel_->AddFilter(notification_dispatcher_->GetFilter());
438 channel_->AddFilter(push_dispatcher_->GetFilter()); 442 channel_->AddFilter(push_dispatcher_->GetFilter());
439 channel_->AddFilter(service_worker_message_filter_->GetFilter()); 443 channel_->AddFilter(service_worker_message_filter_->GetFilter());
444 channel_->AddFilter(websocket_message_filter_.get());
440 445
441 if (!IsInBrowserProcess()) { 446 if (!IsInBrowserProcess()) {
442 // In single process mode, browser-side tracing and memory will cover the 447 // In single process mode, browser-side tracing and memory will cover the
443 // whole process including renderers. 448 // whole process including renderers.
444 channel_->AddFilter(new tracing::ChildTraceMessageFilter( 449 channel_->AddFilter(new tracing::ChildTraceMessageFilter(
445 ChildProcess::current()->io_task_runner())); 450 ChildProcess::current()->io_task_runner()));
446 channel_->AddFilter(new ChildMemoryMessageFilter()); 451 channel_->AddFilter(new ChildMemoryMessageFilter());
447 } 452 }
448 453
449 // In single process mode we may already have a power monitor 454 // In single process mode we may already have a power monitor
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 *out_of_memory = false; 616 *out_of_memory = false;
612 return nullptr; 617 return nullptr;
613 } 618 }
614 return shared_buf; 619 return shared_buf;
615 } 620 }
616 621
617 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) { 622 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
618 // Resource responses are sent to the resource dispatcher. 623 // Resource responses are sent to the resource dispatcher.
619 if (resource_dispatcher_->OnMessageReceived(msg)) 624 if (resource_dispatcher_->OnMessageReceived(msg))
620 return true; 625 return true;
621 if (websocket_dispatcher_->OnMessageReceived(msg))
622 return true;
623 if (file_system_dispatcher_->OnMessageReceived(msg)) 626 if (file_system_dispatcher_->OnMessageReceived(msg))
624 return true; 627 return true;
625 628
626 bool handled = true; 629 bool handled = true;
627 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) 630 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg)
628 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) 631 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
629 #if defined(IPC_MESSAGE_LOG_ENABLED) 632 #if defined(IPC_MESSAGE_LOG_ENABLED)
630 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, 633 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
631 OnSetIPCLoggingEnabled) 634 OnSetIPCLoggingEnabled)
632 #endif 635 #endif
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void ChildThreadImpl::EnsureConnected() { 730 void ChildThreadImpl::EnsureConnected() {
728 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 731 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
729 base::Process::Current().Terminate(0, false); 732 base::Process::Current().Terminate(0, false);
730 } 733 }
731 734
732 bool ChildThreadImpl::IsInBrowserProcess() const { 735 bool ChildThreadImpl::IsInBrowserProcess() const {
733 return static_cast<bool>(browser_process_io_runner_); 736 return static_cast<bool>(browser_process_io_runner_);
734 } 737 }
735 738
736 } // namespace content 739 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/websocket_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698