☠☠ backed out by 444648c7d761 ☠ ☠ | |
author | Bill McCloskey <billm@mozilla.com> |
Mon, 15 Feb 2016 10:12:39 -0800 | |
changeset 290912 | f0dd577131c74afcd7118f64a138be78c39ec786 |
parent 290911 | d345149b216921e65dfe6c1ed86cc7c61941bb78 |
child 290913 | 00f8c8fde8ca0e3d2816cf3ddc3f6e26b5070c52 |
push id | 74429 |
push user | wmccloskey@mozilla.com |
push date | Wed, 30 Mar 2016 16:58:49 +0000 |
treeherder | mozilla-inbound@00f8c8fde8ca [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jld |
bugs | 1253123 |
milestone | 48.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
ipc/chromium/moz.build | file | annotate | diff | comparison | revisions | |
ipc/chromium/src/chrome/common/child_thread.cc | file | annotate | diff | comparison | revisions | |
ipc/chromium/src/chrome/common/child_thread.h | file | annotate | diff | comparison | revisions | |
ipc/chromium/src/chrome/common/message_router.cc | file | annotate | diff | comparison | revisions | |
ipc/chromium/src/chrome/common/message_router.h | file | annotate | diff | comparison | revisions |
--- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -30,17 +30,16 @@ UNIFIED_SOURCES += [ 'src/base/tracked_objects.cc', 'src/chrome/common/child_process.cc', 'src/chrome/common/child_process_host.cc', 'src/chrome/common/child_process_info.cc', 'src/chrome/common/child_thread.cc', 'src/chrome/common/chrome_switches.cc', 'src/chrome/common/ipc_channel.cc', 'src/chrome/common/ipc_message.cc', - 'src/chrome/common/message_router.cc', 'src/chrome/common/notification_service.cc', ] if os_win: SOURCES += [ 'src/base/condition_variable_win.cc', 'src/base/cpu.cc', 'src/base/file_util_win.cc',
--- a/ipc/chromium/src/chrome/common/child_thread.cc +++ b/ipc/chromium/src/chrome/common/child_thread.cc @@ -57,33 +57,19 @@ bool ChildThread::Send(IPC::Message* msg if (!channel_.get()) { delete msg; return false; } return channel_->Send(msg); } -void ChildThread::AddRoute(int32_t routing_id, IPC::Channel::Listener* listener) { - DCHECK(MessageLoop::current() == message_loop()); - - router_.AddRoute(routing_id, listener); -} - -void ChildThread::RemoveRoute(int32_t routing_id) { - DCHECK(MessageLoop::current() == message_loop()); - - router_.RemoveRoute(routing_id); -} - void ChildThread::OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { OnControlMessageReceived(msg); - } else { - router_.OnMessageReceived(msg); } } ChildThread* ChildThread::current() { return ChildProcess::current()->child_thread(); } void ChildThread::Init() {
--- a/ipc/chromium/src/chrome/common/child_thread.h +++ b/ipc/chromium/src/chrome/common/child_thread.h @@ -1,17 +1,17 @@ // 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. #ifndef CHROME_COMMON_CHILD_THREAD_H_ #define CHROME_COMMON_CHILD_THREAD_H_ #include "base/thread.h" -#include "chrome/common/message_router.h" +#include "chrome/common/ipc_channel.h" #include "mozilla/UniquePtr.h" class ResourceDispatcher; // Child processes's background thread should derive from this class. class ChildThread : public IPC::Channel::Listener, public IPC::Message::Sender, public base::Thread { @@ -66,20 +66,16 @@ class ChildThread : public IPC::Channel: #endif // The message loop used to run tasks on the thread that started this thread. MessageLoop* owner_loop_; std::wstring channel_name_; mozilla::UniquePtr<IPC::Channel> channel_; - // Used only on the background render thread to implement message routing - // functionality to the consumers of the ChildThread. - MessageRouter router_; - Thread::Options options_; // If true, checks with the browser process before shutdown. This avoids race // conditions if the process refcount is 0 but there's an IPC message inflight // that would addref it. bool check_with_browser_before_shutdown_; DISALLOW_EVIL_CONSTRUCTORS(ChildThread);
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/message_router.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2006-2008 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 "chrome/common/message_router.h" - -void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { - NOTREACHED() << - "should override in subclass if you care about control messages"; -} - -bool MessageRouter::Send(IPC::Message* msg) { - NOTREACHED() << - "should override in subclass if you care about sending messages"; - return false; -} - -void MessageRouter::AddRoute(int32_t routing_id, - IPC::Channel::Listener* listener) { - routes_.AddWithID(listener, routing_id); -} - -void MessageRouter::RemoveRoute(int32_t routing_id) { - routes_.Remove(routing_id); -} - -void MessageRouter::OnMessageReceived(const IPC::Message& msg) { - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } else { - RouteMessage(msg); - } -} - -bool MessageRouter::RouteMessage(const IPC::Message& msg) { - IPC::Channel::Listener* listener = routes_.Lookup(msg.routing_id()); - if (!listener) - return false; - - listener->OnMessageReceived(msg); - return true; -}
deleted file mode 100644 --- a/ipc/chromium/src/chrome/common/message_router.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2006-2008 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 CHROME_COMMON_MESSAGE_ROUTER_H__ -#define CHROME_COMMON_MESSAGE_ROUTER_H__ - -#include "base/id_map.h" -#include "chrome/common/ipc_channel.h" - -// The MessageRouter handles all incoming messages sent to it by routing them -// to the correct listener. Routing is based on the Message's routing ID. -// Since routing IDs are typically assigned asynchronously by the browser -// process, the MessageRouter has the notion of pending IDs for listeners that -// have not yet been assigned a routing ID. -// -// When a message arrives, the routing ID is used to index the set of routes to -// find a listener. If a listener is found, then the message is passed to it. -// Otherwise, the message is ignored if its routing ID is not equal to -// MSG_ROUTING_CONTROL. -// -// The MessageRouter supports the IPC::Message::Sender interface for outgoing -// messages, but does not define a meaningful implementation of it. The -// subclass of MessageRouter is intended to provide that if appropriate. -// -// The MessageRouter can be used as a concrete class provided its Send method -// is not called and it does not receive any control messages. - -class MessageRouter : public IPC::Channel::Listener, - public IPC::Message::Sender { - public: - MessageRouter() {} - virtual ~MessageRouter() {} - - // Implemented by subclasses to handle control messages - virtual void OnControlMessageReceived(const IPC::Message& msg); - - // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); - - // Like OnMessageReceived, except it only handles routed messages. Returns - // true if the message was dispatched, or false if there was no listener for - // that route id. - virtual bool RouteMessage(const IPC::Message& msg); - - // IPC::Message::Sender implementation: - virtual bool Send(IPC::Message* msg); - - // Called to add/remove a listener for a particular message routing ID. - void AddRoute(int32_t routing_id, IPC::Channel::Listener* listener); - void RemoveRoute(int32_t routing_id); - - private: - // A list of all listeners with assigned routing IDs. - IDMap<IPC::Channel::Listener> routes_; - - DISALLOW_EVIL_CONSTRUCTORS(MessageRouter); -}; - -#endif // CHROME_COMMON_MESSAGE_ROUTER_H__