summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gpu_process_host_ui_shim.h
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:31:22 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:31:22 +0000
commit1082b1dd85c92e5260911989d8022988bacb676e (patch)
treedb12d29cafe47d38e3e9657dea037daf694348d7 /chrome/browser/gpu_process_host_ui_shim.h
parent66ee443252fd759c5e20cb93be1e90a732da0ebe (diff)
downloadchromium_src-1082b1dd85c92e5260911989d8022988bacb676e.zip
chromium_src-1082b1dd85c92e5260911989d8022988bacb676e.tar.gz
chromium_src-1082b1dd85c92e5260911989d8022988bacb676e.tar.bz2
Split GpuProcessHost into GpuProcessHostUIShim, which runs on the UI
thread, and GpuProcessHost, which now runs on the IO thread and derives from ChildProcessHost. This split was necessary in order to service synchronous messages from the renderer process. Moved message handlers for GPU messages from renderer to browser from BrowserRenderProcessHost to ResourceMessageFilter. Stopped sending multiple ViewHostMsg_EstablishGpuChannel messages from the same renderer if the connection was already established. Resetting the channel was causing failures in Send, and every other page reload containing WebGL content to fail. This cleanup will allow further simplification in the GPU process, but this is being left for a subsequent CL. Fixed bug in sandboxing of GPU process. Fixed latent bugs in cleanup code in GpuChannel and GpuChannelHost. Fixed crashes in ChildProcessHost if resource_dispatcher_host_ was NULL. Fixed apparent latent race conditions in creation of BackingStoreProxy and VideoLayerProxy. With these changes, WebGL content is running in the sandbox on both Mac and Windows. Linux support will be added in a following CL. BUG=29120 TEST=ran WebGL demos on Mac and Windows Review URL: http://codereview.chromium.org/1546001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_process_host_ui_shim.h')
-rw-r--r--chrome/browser/gpu_process_host_ui_shim.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h
new file mode 100644
index 0000000..70696ca
--- /dev/null
+++ b/chrome/browser/gpu_process_host_ui_shim.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 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_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
+#define CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
+
+// This class lives on the UI thread and supports classes like the
+// BackingStoreProxy, which must live on the UI thread. The IO thread
+// portion of this class, the GpuProcessHost, is responsible for
+// shuttling messages between the browser and GPU processes.
+
+#include "base/singleton.h"
+#include "chrome/common/gpu_native_window_handle.h"
+#include "chrome/common/message_router.h"
+#include "ipc/ipc_channel.h"
+#include "gfx/native_widget_types.h"
+
+class GpuProcessHostUIShim : public IPC::Channel::Sender,
+ public IPC::Channel::Listener {
+ public:
+ // Getter for the singleton. This will return NULL on failure.
+ static GpuProcessHostUIShim* Get();
+
+ int32 GetNextRoutingId();
+
+ // Creates the new remote view and returns the routing ID for the view, or 0
+ // on failure.
+ int32 NewRenderWidgetHostView(GpuNativeWindowHandle parent);
+
+ // IPC::Channel::Sender implementation.
+ virtual bool Send(IPC::Message* msg);
+
+ // IPC::Channel::Listener implementation.
+ // The GpuProcessHost causes this to be called on the UI thread to
+ // dispatch the incoming messages from the GPU process, which are
+ // actually received on the IO thread.
+ virtual void OnMessageReceived(const IPC::Message& message);
+
+ // See documentation on MessageRouter for AddRoute and RemoveRoute
+ void AddRoute(int32 routing_id, IPC::Channel::Listener* listener);
+ void RemoveRoute(int32 routing_id);
+
+ private:
+ friend struct DefaultSingletonTraits<GpuProcessHostUIShim>;
+
+ GpuProcessHostUIShim();
+ virtual ~GpuProcessHostUIShim();
+
+ int last_routing_id_;
+
+ MessageRouter router_;
+};
+
+#endif // CHROME_BROWSER_GPU_PROCESS_HOST_UI_SHIM_H_
+