From 1ef98de512072aef57b96ad1a61d37cdf703c370 Mon Sep 17 00:00:00 2001 From: "marja@chromium.org" Date: Mon, 14 Oct 2013 13:07:55 +0000 Subject: Refactoring: Move MessagePort-related IPCs and handling them away from Worker-related classes. MessagePorts can also be used by non-workers. This is part of a series of changes to fix cross-process MessagePorts. This CL contains no functional changes. BUG=278336 Review URL: https://codereview.chromium.org/25299002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228448 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/message_port_message_filter.cc | 62 ++++++ content/browser/message_port_message_filter.h | 44 ++++ content/browser/message_port_service.cc | 245 +++++++++++++++++++++ content/browser/message_port_service.h | 78 +++++++ .../renderer_host/render_process_host_impl.cc | 11 +- .../renderer_host/render_process_host_impl.h | 4 + .../browser/worker_host/message_port_service.cc | 245 --------------------- content/browser/worker_host/message_port_service.h | 76 ------- .../browser/worker_host/worker_message_filter.cc | 37 +--- .../browser/worker_host/worker_message_filter.h | 16 +- content/browser/worker_host/worker_process_host.cc | 20 +- content/child/webmessageportchannel_impl.cc | 18 +- content/common/content_message_generator.h | 1 + content/common/message_port_messages.h | 85 +++++++ content/common/worker_messages.h | 62 ------ content/content_browser.gypi | 6 +- content/content_common.gypi | 1 + ipc/ipc_message_start.h | 1 + 18 files changed, 570 insertions(+), 442 deletions(-) create mode 100644 content/browser/message_port_message_filter.cc create mode 100644 content/browser/message_port_message_filter.h create mode 100644 content/browser/message_port_service.cc create mode 100644 content/browser/message_port_service.h delete mode 100644 content/browser/worker_host/message_port_service.cc delete mode 100644 content/browser/worker_host/message_port_service.h create mode 100644 content/common/message_port_messages.h diff --git a/content/browser/message_port_message_filter.cc b/content/browser/message_port_message_filter.cc new file mode 100644 index 0000000..1c08497 --- /dev/null +++ b/content/browser/message_port_message_filter.cc @@ -0,0 +1,62 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/message_port_message_filter.h" + +#include "content/browser/message_port_service.h" +#include "content/common/message_port_messages.h" + +namespace content { + +MessagePortMessageFilter::MessagePortMessageFilter( + const NextRoutingIDCallback& callback) + : next_routing_id_(callback) { +} + +MessagePortMessageFilter::~MessagePortMessageFilter() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); +} + +void MessagePortMessageFilter::OnChannelClosing() { + MessagePortService::GetInstance()->OnMessagePortMessageFilterClosing(this); +} + +bool MessagePortMessageFilter::OnMessageReceived(const IPC::Message& message, + bool* message_was_ok) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP_EX(MessagePortMessageFilter, message, *message_was_ok) + IPC_MESSAGE_HANDLER(MessagePortHostMsg_CreateMessagePort, + OnCreateMessagePort) + IPC_MESSAGE_FORWARD(MessagePortHostMsg_DestroyMessagePort, + MessagePortService::GetInstance(), + MessagePortService::Destroy) + IPC_MESSAGE_FORWARD(MessagePortHostMsg_Entangle, + MessagePortService::GetInstance(), + MessagePortService::Entangle) + IPC_MESSAGE_FORWARD(MessagePortHostMsg_PostMessage, + MessagePortService::GetInstance(), + MessagePortService::PostMessage) + IPC_MESSAGE_FORWARD(MessagePortHostMsg_QueueMessages, + MessagePortService::GetInstance(), + MessagePortService::QueueMessages) + IPC_MESSAGE_FORWARD(MessagePortHostMsg_SendQueuedMessages, + MessagePortService::GetInstance(), + MessagePortService::SendQueuedMessages) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP_EX() + + return handled; +} + +int MessagePortMessageFilter::GetNextRoutingID() { + return next_routing_id_.Run(); +} + +void MessagePortMessageFilter::OnCreateMessagePort(int *route_id, + int* message_port_id) { + *route_id = next_routing_id_.Run(); + MessagePortService::GetInstance()->Create(*route_id, this, message_port_id); +} + +} // namespace content diff --git a/content/browser/message_port_message_filter.h b/content/browser/message_port_message_filter.h new file mode 100644 index 0000000..592eba6 --- /dev/null +++ b/content/browser/message_port_message_filter.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ +#define CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ + +#include "base/callback.h" +#include "content/public/browser/browser_message_filter.h" + +namespace content { + +// Filter for MessagePort related IPC messages (creating and destroying a +// MessagePort, sending a message via a MessagePort etc). +class MessagePortMessageFilter : public BrowserMessageFilter { + public: + typedef base::Callback NextRoutingIDCallback; + + // |next_routing_id| is owned by this object. It can be used up until + // OnChannelClosing. + explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); + + // BrowserMessageFilter implementation. + virtual void OnChannelClosing() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message, + bool* message_was_ok) OVERRIDE; + int GetNextRoutingID(); + + private: + virtual ~MessagePortMessageFilter(); + + // Message handlers. + void OnCreateMessagePort(int* route_id, int* message_port_id); + + // This is guaranteed to be valid until OnChannelClosing is invoked, and it's + // not used after. + NextRoutingIDCallback next_routing_id_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortMessageFilter); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_WORKER_MESSAGE_FILTER_H_ diff --git a/content/browser/message_port_service.cc b/content/browser/message_port_service.cc new file mode 100644 index 0000000..bc2a1ac --- /dev/null +++ b/content/browser/message_port_service.cc @@ -0,0 +1,245 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/message_port_service.h" + +#include "content/browser/message_port_message_filter.h" +#include "content/common/message_port_messages.h" + +namespace content { + +struct MessagePortService::MessagePort { + // |filter| and |route_id| are what we need to send messages to the port. + // |filter| is just a weak pointer since we get notified when its process has + // gone away and remove it. + MessagePortMessageFilter* filter; + int route_id; + // A globally unique id for this message port. + int message_port_id; + // The globally unique id of the entangled message port. + int entangled_message_port_id; + // If true, all messages to this message port are queued and not delivered. + // This is needed so that when a message port is sent between processes all + // pending message get transferred. There are two possibilities for pending + // messages: either they are already received by the child process, or they're + // in-flight. This flag ensures that the latter type get flushed through the + // system. + // This flag should only be set to true in response to + // MessagePortHostMsg_QueueMessages. + bool queue_messages; + QueuedMessages queued_messages; +}; + +MessagePortService* MessagePortService::GetInstance() { + return Singleton::get(); +} + +MessagePortService::MessagePortService() + : next_message_port_id_(0) { +} + +MessagePortService::~MessagePortService() { +} + +void MessagePortService::UpdateMessagePort( + int message_port_id, + MessagePortMessageFilter* filter, + int routing_id) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + + MessagePort& port = message_ports_[message_port_id]; + port.filter = filter; + port.route_id = routing_id; +} + +void MessagePortService::OnMessagePortMessageFilterClosing( + MessagePortMessageFilter* filter) { + // Check if the (possibly) crashed process had any message ports. + for (MessagePorts::iterator iter = message_ports_.begin(); + iter != message_ports_.end();) { + MessagePorts::iterator cur_item = iter++; + if (cur_item->second.filter == filter) { + Erase(cur_item->first); + } + } +} + +void MessagePortService::Create(int route_id, + MessagePortMessageFilter* filter, + int* message_port_id) { + *message_port_id = ++next_message_port_id_; + + MessagePort port; + port.filter = filter; + port.route_id = route_id; + port.message_port_id = *message_port_id; + port.entangled_message_port_id = MSG_ROUTING_NONE; + port.queue_messages = false; + message_ports_[*message_port_id] = port; +} + +void MessagePortService::Destroy(int message_port_id) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + + DCHECK(message_ports_[message_port_id].queued_messages.empty()); + Erase(message_port_id); +} + +void MessagePortService::Entangle(int local_message_port_id, + int remote_message_port_id) { + if (!message_ports_.count(local_message_port_id) || + !message_ports_.count(remote_message_port_id)) { + NOTREACHED(); + return; + } + + DCHECK(message_ports_[remote_message_port_id].entangled_message_port_id == + MSG_ROUTING_NONE); + message_ports_[remote_message_port_id].entangled_message_port_id = + local_message_port_id; +} + +void MessagePortService::PostMessage( + int sender_message_port_id, + const string16& message, + const std::vector& sent_message_port_ids) { + if (!message_ports_.count(sender_message_port_id)) { + NOTREACHED(); + return; + } + + int entangled_message_port_id = + message_ports_[sender_message_port_id].entangled_message_port_id; + if (entangled_message_port_id == MSG_ROUTING_NONE) + return; // Process could have crashed. + + if (!message_ports_.count(entangled_message_port_id)) { + NOTREACHED(); + return; + } + + PostMessageTo(entangled_message_port_id, message, sent_message_port_ids); +} + +void MessagePortService::PostMessageTo( + int message_port_id, + const string16& message, + const std::vector& sent_message_port_ids) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { + if (!message_ports_.count(sent_message_port_ids[i])) { + NOTREACHED(); + return; + } + } + + MessagePort& entangled_port = message_ports_[message_port_id]; + + std::vector sent_ports(sent_message_port_ids.size()); + for (size_t i = 0; i < sent_message_port_ids.size(); ++i) + sent_ports[i] = &message_ports_[sent_message_port_ids[i]]; + + if (entangled_port.queue_messages) { + entangled_port.queued_messages.push_back( + std::make_pair(message, sent_message_port_ids)); + return; + } + + if (!entangled_port.filter) { + NOTREACHED(); + return; + } + + // If a message port was sent around, the new location will need a routing + // id. Instead of having the created port send us a sync message to get it, + // send along with the message. + std::vector new_routing_ids(sent_message_port_ids.size()); + for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { + new_routing_ids[i] = entangled_port.filter->GetNextRoutingID(); + sent_ports[i]->filter = entangled_port.filter; + + // Update the entry for the sent port as it can be in a different process. + sent_ports[i]->route_id = new_routing_ids[i]; + } + + // Now send the message to the entangled port. + entangled_port.filter->Send(new MessagePortMsg_Message( + entangled_port.route_id, message, sent_message_port_ids, + new_routing_ids)); +} + +void MessagePortService::QueueMessages(int message_port_id) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + + MessagePort& port = message_ports_[message_port_id]; + if (port.filter) { + port.filter->Send(new MessagePortMsg_MessagesQueued(port.route_id)); + port.queue_messages = true; + port.filter = NULL; + } +} + +void MessagePortService::SendQueuedMessages( + int message_port_id, + const QueuedMessages& queued_messages) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + + // Send the queued messages to the port again. This time they'll reach the + // new location. + MessagePort& port = message_ports_[message_port_id]; + port.queue_messages = false; + port.queued_messages.insert(port.queued_messages.begin(), + queued_messages.begin(), + queued_messages.end()); + SendQueuedMessagesIfPossible(message_port_id); +} + +void MessagePortService::SendQueuedMessagesIfPossible(int message_port_id) { + if (!message_ports_.count(message_port_id)) { + NOTREACHED(); + return; + } + + MessagePort& port = message_ports_[message_port_id]; + if (port.queue_messages || !port.filter) + return; + + for (QueuedMessages::iterator iter = port.queued_messages.begin(); + iter != port.queued_messages.end(); ++iter) { + PostMessageTo(message_port_id, iter->first, iter->second); + } + port.queued_messages.clear(); +} + +void MessagePortService::Erase(int message_port_id) { + MessagePorts::iterator erase_item = message_ports_.find(message_port_id); + DCHECK(erase_item != message_ports_.end()); + + int entangled_id = erase_item->second.entangled_message_port_id; + if (entangled_id != MSG_ROUTING_NONE) { + // Do the disentanglement (and be paranoid about the other side existing + // just in case something unusual happened during entanglement). + if (message_ports_.count(entangled_id)) { + message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; + } + } + message_ports_.erase(erase_item); +} + +} // namespace content diff --git a/content/browser/message_port_service.h b/content/browser/message_port_service.h new file mode 100644 index 0000000..55e536c --- /dev/null +++ b/content/browser/message_port_service.h @@ -0,0 +1,78 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ +#define CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ + +#include +#include +#include + +#include "base/basictypes.h" +#include "base/memory/singleton.h" +#include "base/strings/string16.h" +#include "ipc/ipc_message.h" + +namespace content { +class MessagePortMessageFilter; + +class MessagePortService { + public: + typedef std::vector > > QueuedMessages; + + // Returns the MessagePortService singleton. + static MessagePortService* GetInstance(); + + // These methods correspond to the message port related IPCs. + void Create(int route_id, + MessagePortMessageFilter* filter, + int* message_port_id); + void Destroy(int message_port_id); + void Entangle(int local_message_port_id, int remote_message_port_id); + void PostMessage(int sender_message_port_id, + const string16& message, + const std::vector& sent_message_port_ids); + void QueueMessages(int message_port_id); + void SendQueuedMessages(int message_port_id, + const QueuedMessages& queued_messages); + + // Updates the information needed to reach a message port when it's sent to a + // (possibly different) process. + void UpdateMessagePort( + int message_port_id, + MessagePortMessageFilter* filter, + int routing_id); + + void OnMessagePortMessageFilterClosing(MessagePortMessageFilter* filter); + + // Attempts to send the queued messages for a message port. + void SendQueuedMessagesIfPossible(int message_port_id); + + private: + friend struct DefaultSingletonTraits; + + MessagePortService(); + ~MessagePortService(); + + void PostMessageTo(int message_port_id, + const string16& message, + const std::vector& sent_message_port_ids); + + // Handles the details of removing a message port id. Before calling this, + // verify that the message port id exists. + void Erase(int message_port_id); + + struct MessagePort; + typedef std::map MessagePorts; + MessagePorts message_ports_; + + // We need globally unique identifiers for each message port. + int next_message_port_id_; + + DISALLOW_COPY_AND_ASSIGN(MessagePortService); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_MESSAGE_PORT_SERVICE_H_ diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 49ed5df..f6e3ed0 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -63,6 +63,7 @@ #include "content/browser/loader/resource_scheduler_filter.h" #include "content/browser/media/android/browser_demuxer_android.h" #include "content/browser/media/media_internals.h" +#include "content/browser/message_port_message_filter.h" #include "content/browser/mime_registry_message_filter.h" #include "content/browser/plugin_service_impl.h" #include "content/browser/profiler_message_filter.h" @@ -673,6 +674,11 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), request_context_callback, resource_context); AddFilter(socket_stream_dispatcher_host); + message_port_message_filter_ = new MessagePortMessageFilter( + base::Bind(&RenderWidgetHelper::GetNextRoutingID, + base::Unretained(widget_helper_.get()))); + AddFilter(message_port_message_filter_); + AddFilter(new WorkerMessageFilter( GetID(), resource_context, @@ -684,8 +690,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { storage_partition_impl_->GetFileSystemContext(), storage_partition_impl_->GetDatabaseTracker(), storage_partition_impl_->GetIndexedDBContext()), - base::Bind(&RenderWidgetHelper::GetNextRoutingID, - base::Unretained(widget_helper_.get())))); + message_port_message_filter_)); #if defined(ENABLE_WEBRTC) AddFilter(new P2PSocketDispatcherHost( @@ -1340,6 +1345,7 @@ void RenderProcessHostImpl::Cleanup() { // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. channel_.reset(); gpu_message_filter_ = NULL; + message_port_message_filter_ = NULL; // Remove ourself from the list of renderer processes so that we can't be // reused in between now and when the Delete task runs. @@ -1638,6 +1644,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) { child_process_launcher_.reset(); channel_.reset(); gpu_message_filter_ = NULL; + message_port_message_filter_ = NULL; IDMap::iterator iter(&listeners_); while (!iter.IsAtEnd()) { diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h index 567b629b..1287b2e 100644 --- a/content/browser/renderer_host/render_process_host_impl.h +++ b/content/browser/renderer_host/render_process_host_impl.h @@ -35,6 +35,7 @@ class Size; namespace content { class BrowserDemuxerAndroid; class GpuMessageFilter; +class MessagePortMessageFilter; class PeerConnectionTrackerHost; class RendererMainThread; class RenderWidgetHelper; @@ -260,6 +261,9 @@ class CONTENT_EXPORT RenderProcessHostImpl // it's valid if non-NULL. GpuMessageFilter* gpu_message_filter_; + // The filter for MessagePort messages coming from the renderer. + scoped_refptr message_port_message_filter_; + // A map of transport DIB ids to cached TransportDIBs std::map cached_dibs_; diff --git a/content/browser/worker_host/message_port_service.cc b/content/browser/worker_host/message_port_service.cc deleted file mode 100644 index 3bc8f5a..0000000 --- a/content/browser/worker_host/message_port_service.cc +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/worker_host/message_port_service.h" - -#include "content/browser/worker_host/worker_message_filter.h" -#include "content/common/worker_messages.h" - -namespace content { - -struct MessagePortService::MessagePort { - // |filter| and |route_id| are what we need to send messages to the port. - // |filter| is just a weak pointer since we get notified when its process has - // gone away and remove it. - WorkerMessageFilter* filter; - int route_id; - // A globally unique id for this message port. - int message_port_id; - // The globally unique id of the entangled message port. - int entangled_message_port_id; - // If true, all messages to this message port are queued and not delivered. - // This is needed so that when a message port is sent between processes all - // pending message get transferred. There are two possibilities for pending - // messages: either they are already received by the child process, or they're - // in-flight. This flag ensures that the latter type get flushed through the - // system. - // This flag should only be set to true in response to - // WorkerProcessHostMsg_QueueMessages. - bool queue_messages; - QueuedMessages queued_messages; -}; - -MessagePortService* MessagePortService::GetInstance() { - return Singleton::get(); -} - -MessagePortService::MessagePortService() - : next_message_port_id_(0) { -} - -MessagePortService::~MessagePortService() { -} - -void MessagePortService::UpdateMessagePort( - int message_port_id, - WorkerMessageFilter* filter, - int routing_id) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - - MessagePort& port = message_ports_[message_port_id]; - port.filter = filter; - port.route_id = routing_id; -} - -void MessagePortService::OnWorkerMessageFilterClosing( - WorkerMessageFilter* filter) { - // Check if the (possibly) crashed process had any message ports. - for (MessagePorts::iterator iter = message_ports_.begin(); - iter != message_ports_.end();) { - MessagePorts::iterator cur_item = iter++; - if (cur_item->second.filter == filter) { - Erase(cur_item->first); - } - } -} - -void MessagePortService::Create(int route_id, - WorkerMessageFilter* filter, - int* message_port_id) { - *message_port_id = ++next_message_port_id_; - - MessagePort port; - port.filter = filter; - port.route_id = route_id; - port.message_port_id = *message_port_id; - port.entangled_message_port_id = MSG_ROUTING_NONE; - port.queue_messages = false; - message_ports_[*message_port_id] = port; -} - -void MessagePortService::Destroy(int message_port_id) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - - DCHECK(message_ports_[message_port_id].queued_messages.empty()); - Erase(message_port_id); -} - -void MessagePortService::Entangle(int local_message_port_id, - int remote_message_port_id) { - if (!message_ports_.count(local_message_port_id) || - !message_ports_.count(remote_message_port_id)) { - NOTREACHED(); - return; - } - - DCHECK(message_ports_[remote_message_port_id].entangled_message_port_id == - MSG_ROUTING_NONE); - message_ports_[remote_message_port_id].entangled_message_port_id = - local_message_port_id; -} - -void MessagePortService::PostMessage( - int sender_message_port_id, - const string16& message, - const std::vector& sent_message_port_ids) { - if (!message_ports_.count(sender_message_port_id)) { - NOTREACHED(); - return; - } - - int entangled_message_port_id = - message_ports_[sender_message_port_id].entangled_message_port_id; - if (entangled_message_port_id == MSG_ROUTING_NONE) - return; // Process could have crashed. - - if (!message_ports_.count(entangled_message_port_id)) { - NOTREACHED(); - return; - } - - PostMessageTo(entangled_message_port_id, message, sent_message_port_ids); -} - -void MessagePortService::PostMessageTo( - int message_port_id, - const string16& message, - const std::vector& sent_message_port_ids) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { - if (!message_ports_.count(sent_message_port_ids[i])) { - NOTREACHED(); - return; - } - } - - MessagePort& entangled_port = message_ports_[message_port_id]; - - std::vector sent_ports(sent_message_port_ids.size()); - for (size_t i = 0; i < sent_message_port_ids.size(); ++i) - sent_ports[i] = &message_ports_[sent_message_port_ids[i]]; - - if (entangled_port.queue_messages) { - entangled_port.queued_messages.push_back( - std::make_pair(message, sent_message_port_ids)); - return; - } - - if (!entangled_port.filter) { - NOTREACHED(); - return; - } - - // If a message port was sent around, the new location will need a routing - // id. Instead of having the created port send us a sync message to get it, - // send along with the message. - std::vector new_routing_ids(sent_message_port_ids.size()); - for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { - new_routing_ids[i] = entangled_port.filter->GetNextRoutingID(); - sent_ports[i]->filter = entangled_port.filter; - - // Update the entry for the sent port as it can be in a different process. - sent_ports[i]->route_id = new_routing_ids[i]; - } - - // Now send the message to the entangled port. - entangled_port.filter->Send(new WorkerProcessMsg_Message( - entangled_port.route_id, message, sent_message_port_ids, - new_routing_ids)); -} - -void MessagePortService::QueueMessages(int message_port_id) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - - MessagePort& port = message_ports_[message_port_id]; - if (port.filter) { - port.filter->Send(new WorkerProcessMsg_MessagesQueued(port.route_id)); - port.queue_messages = true; - port.filter = NULL; - } -} - -void MessagePortService::SendQueuedMessages( - int message_port_id, - const QueuedMessages& queued_messages) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - - // Send the queued messages to the port again. This time they'll reach the - // new location. - MessagePort& port = message_ports_[message_port_id]; - port.queue_messages = false; - port.queued_messages.insert(port.queued_messages.begin(), - queued_messages.begin(), - queued_messages.end()); - SendQueuedMessagesIfPossible(message_port_id); -} - -void MessagePortService::SendQueuedMessagesIfPossible(int message_port_id) { - if (!message_ports_.count(message_port_id)) { - NOTREACHED(); - return; - } - - MessagePort& port = message_ports_[message_port_id]; - if (port.queue_messages || !port.filter) - return; - - for (QueuedMessages::iterator iter = port.queued_messages.begin(); - iter != port.queued_messages.end(); ++iter) { - PostMessageTo(message_port_id, iter->first, iter->second); - } - port.queued_messages.clear(); -} - -void MessagePortService::Erase(int message_port_id) { - MessagePorts::iterator erase_item = message_ports_.find(message_port_id); - DCHECK(erase_item != message_ports_.end()); - - int entangled_id = erase_item->second.entangled_message_port_id; - if (entangled_id != MSG_ROUTING_NONE) { - // Do the disentanglement (and be paranoid about the other side existing - // just in case something unusual happened during entanglement). - if (message_ports_.count(entangled_id)) { - message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; - } - } - message_ports_.erase(erase_item); -} - -} // namespace content diff --git a/content/browser/worker_host/message_port_service.h b/content/browser/worker_host/message_port_service.h deleted file mode 100644 index b85e76b..0000000 --- a/content/browser/worker_host/message_port_service.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_WORKER_HOST_MESSAGE_PORT_SERVICE_H_ -#define CONTENT_BROWSER_WORKER_HOST_MESSAGE_PORT_SERVICE_H_ - -#include -#include -#include - -#include "base/basictypes.h" -#include "base/memory/singleton.h" -#include "base/strings/string16.h" -#include "ipc/ipc_message.h" - -namespace content { -class WorkerMessageFilter; - -class MessagePortService { - public: - typedef std::vector > > QueuedMessages; - - // Returns the MessagePortService singleton. - static MessagePortService* GetInstance(); - - // These methods correspond to the message port related IPCs. - void Create(int route_id, WorkerMessageFilter* filter, int* message_port_id); - void Destroy(int message_port_id); - void Entangle(int local_message_port_id, int remote_message_port_id); - void PostMessage(int sender_message_port_id, - const string16& message, - const std::vector& sent_message_port_ids); - void QueueMessages(int message_port_id); - void SendQueuedMessages(int message_port_id, - const QueuedMessages& queued_messages); - - // Updates the information needed to reach a message port when it's sent to a - // (possibly different) process. - void UpdateMessagePort( - int message_port_id, - WorkerMessageFilter* filter, - int routing_id); - - void OnWorkerMessageFilterClosing(WorkerMessageFilter* filter); - - // Attempts to send the queued messages for a message port. - void SendQueuedMessagesIfPossible(int message_port_id); - - private: - friend struct DefaultSingletonTraits; - - MessagePortService(); - ~MessagePortService(); - - void PostMessageTo(int message_port_id, - const string16& message, - const std::vector& sent_message_port_ids); - - // Handles the details of removing a message port id. Before calling this, - // verify that the message port id exists. - void Erase(int message_port_id); - - struct MessagePort; - typedef std::map MessagePorts; - MessagePorts message_ports_; - - // We need globally unique identifiers for each message port. - int next_message_port_id_; - - DISALLOW_COPY_AND_ASSIGN(MessagePortService); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_WORKER_HOST_MESSAGE_PORT_SERVICE_H_ diff --git a/content/browser/worker_host/worker_message_filter.cc b/content/browser/worker_host/worker_message_filter.cc index 6631de3..49fe7f6 100644 --- a/content/browser/worker_host/worker_message_filter.cc +++ b/content/browser/worker_host/worker_message_filter.cc @@ -4,7 +4,7 @@ #include "content/browser/worker_host/worker_message_filter.h" -#include "content/browser/worker_host/message_port_service.h" +#include "content/browser/message_port_message_filter.h" #include "content/browser/worker_host/worker_service_impl.h" #include "content/common/view_messages.h" #include "content/common/worker_messages.h" @@ -16,11 +16,11 @@ WorkerMessageFilter::WorkerMessageFilter( int render_process_id, ResourceContext* resource_context, const WorkerStoragePartition& partition, - const NextRoutingIDCallback& callback) + MessagePortMessageFilter* message_port_message_filter) : render_process_id_(render_process_id), resource_context_(resource_context), partition_(partition), - next_routing_id_(callback) { + message_port_message_filter_(message_port_message_filter) { // Note: This constructor is called on both IO or UI thread. DCHECK(resource_context); } @@ -30,7 +30,6 @@ WorkerMessageFilter::~WorkerMessageFilter() { } void WorkerMessageFilter::OnChannelClosing() { - MessagePortService::GetInstance()->OnWorkerMessageFilterClosing(this); WorkerServiceImpl::GetInstance()->OnWorkerMessageFilterClosing(this); } @@ -46,24 +45,6 @@ bool WorkerMessageFilter::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToWorker, OnForwardToWorker) // Only sent from renderer. IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentDetached, OnDocumentDetached) - // Message Port related messages. - IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_CreateMessagePort, - OnCreateMessagePort) - IPC_MESSAGE_FORWARD(WorkerProcessHostMsg_DestroyMessagePort, - MessagePortService::GetInstance(), - MessagePortService::Destroy) - IPC_MESSAGE_FORWARD(WorkerProcessHostMsg_Entangle, - MessagePortService::GetInstance(), - MessagePortService::Entangle) - IPC_MESSAGE_FORWARD(WorkerProcessHostMsg_PostMessage, - MessagePortService::GetInstance(), - MessagePortService::PostMessage) - IPC_MESSAGE_FORWARD(WorkerProcessHostMsg_QueueMessages, - MessagePortService::GetInstance(), - MessagePortService::QueueMessages) - IPC_MESSAGE_FORWARD(WorkerProcessHostMsg_SendQueuedMessages, - MessagePortService::GetInstance(), - MessagePortService::SendQueuedMessages) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() @@ -71,14 +52,14 @@ bool WorkerMessageFilter::OnMessageReceived(const IPC::Message& message, } int WorkerMessageFilter::GetNextRoutingID() { - return next_routing_id_.Run(); + return message_port_message_filter_->GetNextRoutingID(); } void WorkerMessageFilter::OnCreateWorker( const ViewHostMsg_CreateWorker_Params& params, int* route_id) { *route_id = params.route_id != MSG_ROUTING_NONE ? - params.route_id : next_routing_id_.Run(); + params.route_id : GetNextRoutingID(); WorkerServiceImpl::GetInstance()->CreateWorker( params, *route_id, this, resource_context_, partition_); } @@ -88,7 +69,7 @@ void WorkerMessageFilter::OnLookupSharedWorker( bool* exists, int* route_id, bool* url_error) { - *route_id = next_routing_id_.Run(); + *route_id = GetNextRoutingID(); WorkerServiceImpl::GetInstance()->LookupSharedWorker( params, *route_id, this, resource_context_, partition_, exists, @@ -103,10 +84,4 @@ void WorkerMessageFilter::OnDocumentDetached(unsigned long long document_id) { WorkerServiceImpl::GetInstance()->DocumentDetached(document_id, this); } -void WorkerMessageFilter::OnCreateMessagePort(int *route_id, - int* message_port_id) { - *route_id = next_routing_id_.Run(); - MessagePortService::GetInstance()->Create(*route_id, this, message_port_id); -} - } // namespace content diff --git a/content/browser/worker_host/worker_message_filter.h b/content/browser/worker_host/worker_message_filter.h index 47f96ef..0d495fa 100644 --- a/content/browser/worker_host/worker_message_filter.h +++ b/content/browser/worker_host/worker_message_filter.h @@ -13,18 +13,15 @@ class ResourceDispatcherHost; struct ViewHostMsg_CreateWorker_Params; namespace content { +class MessagePortMessageFilter; class ResourceContext; class WorkerMessageFilter : public BrowserMessageFilter { public: - typedef base::Callback NextRoutingIDCallback; - - // |next_routing_id| is owned by this object. It can be used up until - // OnChannelClosing. WorkerMessageFilter(int render_process_id, ResourceContext* resource_context, const WorkerStoragePartition& partition, - const NextRoutingIDCallback& callback); + MessagePortMessageFilter* message_port_filter); // BrowserMessageFilter implementation. virtual void OnChannelClosing() OVERRIDE; @@ -34,6 +31,10 @@ class WorkerMessageFilter : public BrowserMessageFilter { int GetNextRoutingID(); int render_process_id() const { return render_process_id_; } + MessagePortMessageFilter* message_port_message_filter() const { + return message_port_message_filter_; + } + private: virtual ~WorkerMessageFilter(); @@ -52,10 +53,7 @@ class WorkerMessageFilter : public BrowserMessageFilter { ResourceContext* const resource_context_; WorkerStoragePartition partition_; - // This is guaranteed to be valid until OnChannelClosing is closed, and it's - // not used after. - NextRoutingIDCallback next_routing_id_; - + MessagePortMessageFilter* message_port_message_filter_; DISALLOW_IMPLICIT_CONSTRUCTORS(WorkerMessageFilter); }; diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index f0324d7..b132767 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -25,6 +25,8 @@ #include "content/browser/fileapi/fileapi_message_filter.h" #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" #include "content/browser/loader/resource_message_filter.h" +#include "content/browser/message_port_message_filter.h" +#include "content/browser/message_port_service.h" #include "content/browser/mime_registry_message_filter.h" #include "content/browser/quota_dispatcher_host.h" #include "content/browser/renderer_host/database_message_filter.h" @@ -33,7 +35,6 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" #include "content/browser/resource_context_impl.h" -#include "content/browser/worker_host/message_port_service.h" #include "content/browser/worker_host/worker_message_filter.h" #include "content/browser/worker_host/worker_service_impl.h" #include "content/common/child_process_host_impl.h" @@ -223,10 +224,15 @@ void WorkerProcessHost::CreateMessageFilters(int render_process_id) { get_contexts_callback); process_->AddFilter(resource_message_filter); - worker_message_filter_ = new WorkerMessageFilter( - render_process_id, resource_context_, partition_, - base::Bind(&WorkerServiceImpl::next_worker_route_id, - base::Unretained(WorkerServiceImpl::GetInstance()))); + MessagePortMessageFilter* message_port_message_filter = + new MessagePortMessageFilter( + base::Bind(&WorkerServiceImpl::next_worker_route_id, + base::Unretained(WorkerServiceImpl::GetInstance()))); + process_->AddFilter(message_port_message_filter); + worker_message_filter_ = new WorkerMessageFilter(render_process_id, + resource_context_, + partition_, + message_port_message_filter); process_->AddFilter(worker_message_filter_.get()); process_->AddFilter(new AppCacheDispatcherHost( partition_.appcache_service(), process_->GetData().id)); @@ -400,7 +406,9 @@ void WorkerProcessHost::RelayMessage( } new_routing_id = filter->GetNextRoutingID(); MessagePortService::GetInstance()->UpdateMessagePort( - sent_message_port_id, filter, new_routing_id); + sent_message_port_id, + filter->message_port_message_filter(), + new_routing_id); // Resend the message with the new routing id. filter->Send(new WorkerMsg_Connect( diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc index ed621ad..de8866f 100644 --- a/content/child/webmessageportchannel_impl.cc +++ b/content/child/webmessageportchannel_impl.cc @@ -8,7 +8,7 @@ #include "base/message_loop/message_loop_proxy.h" #include "content/child/child_process.h" #include "content/child/child_thread.h" -#include "content/common/worker_messages.h" +#include "content/common/message_port_messages.h" #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -53,7 +53,7 @@ WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { } if (message_port_id_ != MSG_ROUTING_NONE) - Send(new WorkerProcessHostMsg_DestroyMessagePort(message_port_id_)); + Send(new MessagePortHostMsg_DestroyMessagePort(message_port_id_)); if (route_id_ != MSG_ROUTING_NONE) ChildThread::current()->RemoveRoute(route_id_); @@ -106,7 +106,7 @@ void WebMessagePortChannelImpl::postMessage( delete channels; } - IPC::Message* msg = new WorkerProcessHostMsg_PostMessage( + IPC::Message* msg = new MessagePortHostMsg_PostMessage( message_port_id_, message, message_port_ids); Send(msg); } @@ -140,7 +140,7 @@ void WebMessagePortChannelImpl::Init() { if (route_id_ == MSG_ROUTING_NONE) { DCHECK(message_port_id_ == MSG_ROUTING_NONE); - Send(new WorkerProcessHostMsg_CreateMessagePort( + Send(new MessagePortHostMsg_CreateMessagePort( &route_id_, &message_port_id_)); } @@ -156,7 +156,7 @@ void WebMessagePortChannelImpl::Entangle( return; } - Send(new WorkerProcessHostMsg_Entangle( + Send(new MessagePortHostMsg_Entangle( message_port_id_, channel->message_port_id())); } @@ -172,7 +172,7 @@ void WebMessagePortChannelImpl::QueueMessages() { // sends us an ack, whose receipt we know means that no more messages are // in-flight. We then send the queued messages to the browser, which prepends // them to the ones it queued and it sends them to the new endpoint. - Send(new WorkerProcessHostMsg_QueueMessages(message_port_id_)); + Send(new MessagePortHostMsg_QueueMessages(message_port_id_)); // The process could potentially go away while we're still waiting for // in-flight messages. Ensure it stays alive. @@ -194,8 +194,8 @@ void WebMessagePortChannelImpl::Send(IPC::Message* message) { bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) - IPC_MESSAGE_HANDLER(WorkerProcessMsg_Message, OnMessage) - IPC_MESSAGE_HANDLER(WorkerProcessMsg_MessagesQueued, OnMessagesQueued) + IPC_MESSAGE_HANDLER(MessagePortMsg_Message, OnMessage) + IPC_MESSAGE_HANDLER(MessagePortMsg_MessagesQueued, OnMessagesQueued) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -243,7 +243,7 @@ void WebMessagePortChannelImpl::OnMessagesQueued() { } } - Send(new WorkerProcessHostMsg_SendQueuedMessages( + Send(new MessagePortHostMsg_SendQueuedMessages( message_port_id_, queued_messages)); message_port_id_ = MSG_ROUTING_NONE; diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index d85d4eb..78e7c53 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -40,6 +40,7 @@ #include "content/common/media/video_capture_messages.h" #include "content/common/media/webrtc_identity_messages.h" #include "content/common/memory_benchmark_messages.h" +#include "content/common/message_port_messages.h" #include "content/common/mime_registry_messages.h" #include "content/common/p2p_messages.h" #include "content/common/pepper_messages.h" diff --git a/content/common/message_port_messages.h b/content/common/message_port_messages.h new file mode 100644 index 0000000..67b729d --- /dev/null +++ b/content/common/message_port_messages.h @@ -0,0 +1,85 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Defines messages between the browser and worker process, as well as between +// the renderer and worker process. + +// Multiply-included message file, hence no include guard. + +#include +#include +#include + +#include "base/basictypes.h" +#include "base/strings/string16.h" +#include "content/common/content_export.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_message_utils.h" + +#undef IPC_MESSAGE_EXPORT +#define IPC_MESSAGE_EXPORT CONTENT_EXPORT +#define IPC_MESSAGE_START MessagePortMsgStart + +// Singly-included section, not converted. +#ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ +#define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ + +typedef std::pair > QueuedMessage; + +#endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_ + +//----------------------------------------------------------------------------- +// MessagePort messages +// These are messages sent from the browser to child processes. + +// Sends a message to a message port. +IPC_MESSAGE_ROUTED3(MessagePortMsg_Message, + string16 /* message */, + std::vector /* sent_message_port_ids */, + std::vector /* new_routing_ids */) + +// Tells the Message Port Channel object that there are no more in-flight +// messages arriving. +IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued) + +//----------------------------------------------------------------------------- +// MessagePortHost messages +// These are messages sent from child processes to the browser. + +// Creates a new Message Port Channel object. The first paramaeter is the +// message port channel's routing id in this process. The second parameter +// is the process-wide-unique identifier for that port. +IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort, + int /* route_id */, + int /* message_port_id */) + +// Sent when a Message Port Channel object is destroyed. +IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort, + int /* message_port_id */) + +// Sends a message to a message port. Optionally sends a message port as +// as well if sent_message_port_id != MSG_ROUTING_NONE. +IPC_MESSAGE_CONTROL3(MessagePortHostMsg_PostMessage, + int /* sender_message_port_id */, + string16 /* message */, + std::vector /* sent_message_port_ids */) + +// Causes messages sent to the remote port to be delivered to this local port. +IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle, + int /* local_message_port_id */, + int /* remote_message_port_id */) + +// Causes the browser to queue messages sent to this port until the the port +// has made sure that all in-flight messages were routed to the new +// destination. +IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages, + int /* message_port_id */) + +// Sends the browser all the queued messages that arrived at this message port +// after it was sent in a postMessage call. +// NOTE: MSVS can't compile the macro if std::vector > +// is used, so we typedef it in worker_messages.h. +IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages, + int /* message_port_id */, + std::vector /* queued_messages */) diff --git a/content/common/worker_messages.h b/content/common/worker_messages.h index 3f32862..d66e456 100644 --- a/content/common/worker_messages.h +++ b/content/common/worker_messages.h @@ -19,14 +19,6 @@ #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h" #include "url/gurl.h" -// Singly-included section, not converted. -#ifndef CONTENT_COMMON_WORKER_MESSAGES_H_ -#define CONTENT_COMMON_WORKER_MESSAGES_H_ - -typedef std::pair > QueuedMessage; - -#endif // CONTENT_COMMON_WORKER_MESSAGES_H_ - #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT #define IPC_MESSAGE_START WorkerMsgStart @@ -61,64 +53,10 @@ IPC_ENUM_TRAITS(WebKit::WebContentSecurityPolicyType) IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, WorkerProcessMsg_CreateWorker_Params) -// Note: these Message Port related messages can also be sent to the -// renderer process. Putting them here since we don't have a shared place -// like common_messages_internal.h -IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message, - string16 /* message */, - std::vector /* sent_message_port_ids */, - std::vector /* new_routing_ids */) - -// Tells the Message Port Channel object that there are no more in-flight -// messages arriving. -IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued) - - //----------------------------------------------------------------------------- // WorkerProcessHost messages // These are messages sent from the worker process to the browser process. -// Note: these Message Port related messages can also be sent out from the -// renderer process. Putting them here since we don't have a shared place -// like common_messages_internal.h - -// Creates a new Message Port Channel object. The first paramaeter is the -// message port channel's routing id in this process. The second parameter -// is the process-wide-unique identifier for that port. -IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort, - int /* route_id */, - int /* message_port_id */) - -// Sent when a Message Port Channel object is destroyed. -IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort, - int /* message_port_id */) - -// Sends a message to a message port. Optionally sends a message port as -// as well if sent_message_port_id != MSG_ROUTING_NONE. -IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage, - int /* sender_message_port_id */, - string16 /* message */, - std::vector /* sent_message_port_ids */) - -// Causes messages sent to the remote port to be delivered to this local port. -IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle, - int /* local_message_port_id */, - int /* remote_message_port_id */) - -// Causes the browser to queue messages sent to this port until the the port -// has made sure that all in-flight messages were routed to the new -// destination. -IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages, - int /* message_port_id */) - -// Sends the browser all the queued messages that arrived at this message port -// after it was sent in a postMessage call. -// NOTE: MSVS can't compile the macro if std::vector > -// is used, so we typedef it in worker_messages.h. -IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages, - int /* message_port_id */, - std::vector /* queued_messages */) - // Sent by the worker process to check whether access to web databases is // allowed. IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase, diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 38e92d6..dffcb74 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -721,6 +721,10 @@ 'browser/media/webrtc_internals_ui.h', 'browser/media/webrtc_internals_ui_observer.h', 'browser/media_devices_monitor.cc', + 'browser/message_port_message_filter.cc', + 'browser/message_port_message_filter.h', + 'browser/message_port_service.cc', + 'browser/message_port_service.h', 'browser/mime_registry_message_filter.cc', 'browser/mime_registry_message_filter.h', 'browser/service_worker/service_worker_dispatcher_host.h', @@ -1209,8 +1213,6 @@ 'browser/webui/web_ui_impl.cc', 'browser/webui/web_ui_impl.h', 'browser/webui/web_ui_message_handler.cc', - 'browser/worker_host/message_port_service.cc', - 'browser/worker_host/message_port_service.h', 'browser/worker_host/worker_document_set.cc', 'browser/worker_host/worker_document_set.h', 'browser/worker_host/worker_message_filter.cc', diff --git a/content/content_common.gypi b/content/content_common.gypi index 9c70800..cb3b2c5 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -295,6 +295,7 @@ 'common/media/video_capture_messages.h', 'common/media/webrtc_identity_messages.h', 'common/memory_benchmark_messages.h', + 'common/message_port_messages.h', 'common/message_router.cc', 'common/message_router.h', 'common/mime_registry_messages.h', diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h index e71755f..7ce2bdd 100644 --- a/ipc/ipc_message_start.h +++ b/ipc/ipc_message_start.h @@ -91,6 +91,7 @@ enum IPCMessageStart { PowerMonitorMsgStart, EncryptedMediaMsgStart, ServiceWorkerMsgStart, + MessagePortMsgStart, LastIPCMsgStart // Must come last. }; -- cgit v1.1