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

Unified Diff: chrome/common/child_thread.h

Issue 1625015: Refactor ChildProcess and related classes to create a framework outside of br... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/child_process.cc ('k') | chrome/common/child_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/child_thread.h
===================================================================
--- chrome/common/child_thread.h (revision 44239)
+++ chrome/common/child_thread.h (working copy)
@@ -7,21 +7,14 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
-#include "chrome/common/message_router.h"
+#include "base/mp/mp_child_thread.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_dispatcher.h"
-#include "ipc/ipc_sync_channel.h"
-#include "ipc/ipc_message.h"
+#include "chrome/common/socket_stream_dispatcher.h"
-class NotificationService;
-class SocketStreamDispatcher;
-namespace IPC {
-class SyncMessageFilter;
-}
-
// The main thread of a child process derives from this class.
-class ChildThread : public IPC::Channel::Listener,
- public IPC::Message::Sender {
+class ChildThread : public base::MpChildThread {
public:
// Creates the thread.
ChildThread();
@@ -29,15 +22,6 @@
explicit ChildThread(const std::string& channel_name);
virtual ~ChildThread();
- // IPC::Message::Sender implementation:
- virtual bool Send(IPC::Message* msg);
-
- // See documentation on MessageRouter for AddRoute and RemoveRoute
- void AddRoute(int32 routing_id, IPC::Channel::Listener* listener);
- void RemoveRoute(int32 routing_id);
-
- IPC::Channel::Listener* ResolveRoute(int32 routing_id);
-
// Creates a ResourceLoaderBridge.
// Tests can override this method if they want a custom loading behavior.
virtual webkit_glue::ResourceLoaderBridge* CreateBridge(
@@ -53,68 +37,18 @@
return socket_stream_dispatcher_.get();
}
- // Safe to call on any thread, as long as it's guaranteed that the thread's
- // lifetime is less than the main thread.
- IPC::SyncMessageFilter* sync_message_filter() { return sync_message_filter_; }
-
- MessageLoop* message_loop() { return message_loop_; }
-
- // Returns the one child thread.
- static ChildThread* current();
-
- protected:
- friend class ChildProcess;
-
- // Called when the process refcount is 0.
- void OnProcessFinalRelease();
-
- virtual void OnControlMessageReceived(const IPC::Message& msg) { }
- virtual void OnAskBeforeShutdown();
- virtual void OnShutdown();
-
-#ifdef IPC_MESSAGE_LOG_ENABLED
- virtual void OnSetIPCLoggingEnabled(bool enable);
-#endif
-
- IPC::SyncChannel* channel() { return channel_.get(); }
-
- void set_on_channel_error_called(bool on_channel_error_called) {
- on_channel_error_called_ = on_channel_error_called;
- }
-
private:
void Init();
// IPC::Channel::Listener implementation:
virtual void OnMessageReceived(const IPC::Message& msg);
- virtual void OnChannelError();
- std::string channel_name_;
- scoped_ptr<IPC::SyncChannel> channel_;
-
- // Allows threads other than the main thread to send sync messages.
- scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
-
- // Implements message routing functionality to the consumers of ChildThread.
- MessageRouter router_;
-
// Handles resource loads for this process.
scoped_ptr<ResourceDispatcher> resource_dispatcher_;
// Handles SocketStream for this process.
scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_;
- // 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_;
-
- // The OnChannelError() callback was invoked - the channel is dead, don't
- // attempt to communicate.
- bool on_channel_error_called_;
-
- MessageLoop* message_loop_;
-
scoped_ptr<NotificationService> notification_service_;
DISALLOW_COPY_AND_ASSIGN(ChildThread);
« no previous file with comments | « chrome/common/child_process.cc ('k') | chrome/common/child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698