summaryrefslogtreecommitdiffstats
path: root/content/browser/gpu/gpu_process_host.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 06:29:23 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 06:29:23 +0000
commit3b0032a7abc9cc9350253d4f66dcd9a367e206ab (patch)
tree3c7ae09453fe79f47ed7e0b5095aef5518bb4e95 /content/browser/gpu/gpu_process_host.h
parent1027ebc3ec3fbb9fd44112e42bb06906895712bb (diff)
downloadchromium_src-3b0032a7abc9cc9350253d4f66dcd9a367e206ab.zip
chromium_src-3b0032a7abc9cc9350253d4f66dcd9a367e206ab.tar.gz
chromium_src-3b0032a7abc9cc9350253d4f66dcd9a367e206ab.tar.bz2
Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost. Now classes like PluginProcessHost don't derive from it, but instead use composition.
I've also moved the iterator class into its own file in the public directory. Since classes don't derive from BrowserChildProcessHost and so can't static_cast from it, I added a template helper that does this. BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9150017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu/gpu_process_host.h')
-rw-r--r--content/browser/gpu/gpu_process_host.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h
index 29ec0df..51245d7 100644
--- a/content/browser/gpu/gpu_process_host.h
+++ b/content/browser/gpu/gpu_process_host.h
@@ -11,22 +11,22 @@
#include "base/callback.h"
#include "base/memory/linked_ptr.h"
+#include "base/process.h"
#include "base/threading/non_thread_safe.h"
-#include "content/browser/browser_child_process_host.h"
#include "content/common/content_export.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/public/browser/browser_child_process_host_delegate.h"
#include "content/public/common/gpu_info.h"
+#include "ipc/ipc_message.h"
#include "ui/gfx/native_widget_types.h"
+class GpuMainThread;
struct GPUCreateCommandBufferConfig;
-namespace IPC {
-class Message;
-}
-
-class GpuMainThread;
+class BrowserChildProcessHost;
-class GpuProcessHost : public BrowserChildProcessHost,
+class GpuProcessHost : public content::BrowserChildProcessHostDelegate,
+ public IPC::Message::Sender,
public base::NonThreadSafe {
public:
static bool gpu_enabled() { return gpu_enabled_; }
@@ -52,12 +52,9 @@ class GpuProcessHost : public BrowserChildProcessHost,
static GpuProcessHost* FromID(int host_id);
int host_id() const { return host_id_; }
+ // IPC::Message::Sender implementation:
virtual bool Send(IPC::Message* msg) OVERRIDE;
- // ChildProcessHost implementation.
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
-
typedef base::Callback<void(const IPC::ChannelHandle&,
base::ProcessHandle,
const content::GPUInfo&)>
@@ -86,6 +83,8 @@ class GpuProcessHost : public BrowserChildProcessHost,
void ForceShutdown();
private:
+ static bool HostIsValid(GpuProcessHost* host);
+
GpuProcessHost(int host_id);
virtual ~GpuProcessHost();
@@ -94,6 +93,9 @@ class GpuProcessHost : public BrowserChildProcessHost,
// Post an IPC message to the UI shim's message handler on the UI thread.
void RouteOnUIThread(const IPC::Message& message);
+ // BrowserChildProcessHostDelegate implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
virtual void OnProcessLaunched() OVERRIDE;
virtual void OnProcessCrashed(int exit_code) OVERRIDE;
@@ -155,6 +157,8 @@ class GpuProcessHost : public BrowserChildProcessHost,
// existing tabs, just the future ones.
CONTENT_EXPORT static bool gpu_enabled_;
+ scoped_ptr<BrowserChildProcessHost> process_;
+
DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
};