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

Unified Diff: content/browser/browser_child_process_host.h

Issue 8774040: Don't make classes derive from ChildProcessHost, and instead have them use it through composition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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
Index: content/browser/browser_child_process_host.h
===================================================================
--- content/browser/browser_child_process_host.h (revision 112597)
+++ content/browser/browser_child_process_host.h (working copy)
@@ -8,14 +8,18 @@
#include <list>
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/process.h"
#include "base/synchronization/waitable_event_watcher.h"
#include "content/browser/child_process_launcher.h"
-#include "content/common/child_process_host.h"
#include "content/common/content_export.h"
#include "content/public/browser/child_process_data.h"
+#include "content/public/common/child_process_host_delegate.h"
+#include "ipc/ipc_message.h"
+class ChildProcessHost;
+
namespace base {
class WaitableEvent;
}
@@ -26,9 +30,10 @@
// [Browser]RenderProcessHost is the main exception that doesn't derive from
// this class. That project lives on the UI thread.
class CONTENT_EXPORT BrowserChildProcessHost :
- public ChildProcessHost,
+ public content::ChildProcessHostDelegate,
public ChildProcessLauncher::Client,
- public base::WaitableEventWatcher::Delegate {
+ public base::WaitableEventWatcher::Delegate,
+ public IPC::Message::Sender {
public:
virtual ~BrowserChildProcessHost();
@@ -58,6 +63,9 @@
std::list<BrowserChildProcessHost*>::iterator iterator_;
};
+ // IPC::Message::Sender override
+ virtual bool Send(IPC::Message* message) OVERRIDE;
+
const content::ChildProcessData& data() const { return data_; }
content::ProcessType type() const { return data_.type; }
const string16& name() const { return data_.name; }
@@ -102,14 +110,16 @@
// GetExitCodeProcess()). |exit_code| may be NULL.
virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code);
- // Overrides from ChildProcessHost
- virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
+ // ChildProcessHostDelegate implementationO:
Jói 2011/12/02 17:15:54 implementationO -> implementation
+ virtual bool CanShutdown() OVERRIDE;
virtual void OnChildDisconnected() OVERRIDE;
virtual void ShutdownStarted() OVERRIDE;
- // Extends the base class implementation and removes this host from
- // the host list. Calls ChildProcessHost::ForceShutdown
- virtual void ForceShutdown() OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
+ // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown
+ void ForceShutdown();
+
// Controls whether the child process should be terminated on browser
// shutdown. Default is to always terminate.
void SetTerminateChildOnShutdown(bool terminate_on_shutdown);
@@ -117,6 +127,9 @@
// Sends the given notification on the UI thread.
void Notify(int type);
+ ChildProcessHost* child_process_host() const {
+ return child_process_host_.get();
+ }
void set_name(const string16& name) { data_.name = name; }
void set_handle(base::ProcessHandle handle) { data_.handle = handle; }
@@ -133,6 +146,7 @@
};
content::ChildProcessData data_;
+ scoped_ptr<ChildProcessHost> child_process_host_;
ClientHook client_;
scoped_ptr<ChildProcessLauncher> child_process_;

Powered by Google App Engine
This is Rietveld 408576698