summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-27 00:23:34 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-27 00:23:34 +0000
commit3bf4d53ecb0a07e8639b4403997cddb6869ebc61 (patch)
tree5283f1b9733ecab92f0b2875110a4194c1ee41e0 /chrome/browser
parent6f4926b7834dfaf506957b02dd80e6004489824e (diff)
downloadchromium_src-3bf4d53ecb0a07e8639b4403997cddb6869ebc61.zip
chromium_src-3bf4d53ecb0a07e8639b4403997cddb6869ebc61.tar.gz
chromium_src-3bf4d53ecb0a07e8639b4403997cddb6869ebc61.tar.bz2
Added command buffer implementation of WebGL which runs in the sandbox.
Added synchronous initialization of the channel to the GPU process, needed to obey WebGL startup semantics. There are problems with this on the Windows platform which will be addressed via refactoring in the GpuProcessHost in a subsequent CL. Implemented offscreen rendering code path in GGL / GLES2CmdDecoder for Mac OS X. This new code path is not yet complete for all platforms and is still being stress tested. The previous in-process WebGL implementation is currently used when the sandbox is disabled; it will be removed in a subsequent CL. A one-line code change in WebKit is needed after this CL lands to enable the new code path. BUG=29120 TEST=ran WebGL demos on command buffer implementation on Mac Review URL: http://codereview.chromium.org/1328001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gpu_process_host.cc39
-rw-r--r--chrome/browser/gpu_process_host.h8
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc8
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h5
4 files changed, 58 insertions, 2 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index 9fa0092..9981133 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -62,6 +62,10 @@ GpuProcessHost::GpuProcessHost() : last_routing_id_(1) {
}
GpuProcessHost::~GpuProcessHost() {
+ while (!queued_synchronization_replies_.empty()) {
+ delete queued_synchronization_replies_.front();
+ queued_synchronization_replies_.pop();
+ }
}
// static
@@ -133,9 +137,25 @@ void GpuProcessHost::EstablishGpuChannel(int renderer_id) {
ReplyToRenderer(renderer_id, IPC::ChannelHandle());
}
+void GpuProcessHost::Synchronize(int renderer_id, IPC::Message* reply) {
+ // ************
+ // TODO(kbr): the handling of this synchronous message (which is
+ // needed for proper initialization semantics of APIs like WebGL) is
+ // currently broken on Windows because the renderer is sending a
+ // synchronous message to the browser's UI thread. To fix this, the
+ // GpuProcessHost needs to move to the IO thread, and any backing
+ // store handling needs to remain on the UI thread in a new
+ // GpuProcessHostProxy, where work is sent from the IO thread to the
+ // UI thread via PostTask.
+ // ************
+ queued_synchronization_replies_.push(reply);
+ CHECK(Send(new GpuMsg_Synchronize(renderer_id)));
+}
+
void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
@@ -148,6 +168,17 @@ void GpuProcessHost::OnChannelEstablished(
sent_requests_.pop();
}
+void GpuProcessHost::OnSynchronizeReply(int renderer_id) {
+ IPC::Message* reply = queued_synchronization_replies_.front();
+ queued_synchronization_replies_.pop();
+ RenderProcessHost* process_host = RenderProcessHost::FromID(renderer_id);
+ if (!process_host) {
+ delete reply;
+ return;
+ }
+ CHECK(process_host->Send(reply));
+}
+
void GpuProcessHost::ReplyToRenderer(
int renderer_id,
const IPC::ChannelHandle& channel) {
@@ -156,7 +187,13 @@ void GpuProcessHost::ReplyToRenderer(
if (!process_host)
return;
- CHECK(process_host->Send(new ViewMsg_GpuChannelEstablished(channel)));
+ ViewMsg_GpuChannelEstablished* msg =
+ new ViewMsg_GpuChannelEstablished(channel);
+ // If the renderer process is performing synchronous initialization,
+ // it needs to handle this message before receiving the reply for
+ // the synchronous ViewHostMsg_SynchronizeGpu message.
+ msg->set_unblock(true);
+ CHECK(process_host->Send(msg));
}
void GpuProcessHost::PropagateBrowserCommandLineToGpu(
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 4d74e00..27d3fe3 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -53,6 +53,10 @@ class GpuProcessHost : public IPC::Channel::Sender,
// on completion.
void EstablishGpuChannel(int renderer_id);
+ // Sends a reply message later when the next GpuHostMsg_SynchronizeReply comes
+ // in.
+ void Synchronize(int renderer_id, IPC::Message* reply);
+
private:
friend struct DefaultSingletonTraits<GpuProcessHost>;
@@ -74,6 +78,7 @@ class GpuProcessHost : public IPC::Channel::Sender,
// Message handlers.
void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
+ void OnSynchronizeReply(int renderer_id);
void ReplyToRenderer(int renderer_id,
const IPC::ChannelHandle& channel);
@@ -104,6 +109,9 @@ class GpuProcessHost : public IPC::Channel::Sender,
// because the queued messages may have dependencies on the init messages.
std::queue<IPC::Message*> queued_messages_;
+ // The pending synchronization requests we need to reply to.
+ std::queue<IPC::Message*> queued_synchronization_replies_;
+
DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
};
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index dccc34d..1fc8ffa 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -773,7 +773,9 @@ void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionCloseChannel,
OnExtensionCloseChannel)
IPC_MESSAGE_HANDLER(ViewHostMsg_EstablishGpuChannel,
- OnMsgEstablishGpuChannel)
+ OnMsgEstablishGpuChannel)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SynchronizeGpu,
+ OnMsgSynchronizeGpu)
IPC_MESSAGE_HANDLER(ViewHostMsg_SpellChecker_RequestDictionary,
OnSpellCheckerRequestDictionary)
IPC_MESSAGE_UNHANDLED_ERROR()
@@ -982,6 +984,10 @@ void BrowserRenderProcessHost::OnMsgEstablishGpuChannel() {
GpuProcessHost::Get()->EstablishGpuChannel(id());
}
+void BrowserRenderProcessHost::OnMsgSynchronizeGpu(IPC::Message* reply) {
+ GpuProcessHost::Get()->Synchronize(id(), reply);
+}
+
void BrowserRenderProcessHost::OnSpellCheckerRequestDictionary() {
if (profile()->GetSpellCheckHost()) {
// The spellchecker initialization already started and finished; just send
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 372045a..9a9c833 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -110,7 +110,12 @@ class BrowserRenderProcessHost : public RenderProcessHost,
void OnExtensionAddListener(const std::string& event_name);
void OnExtensionRemoveListener(const std::string& event_name);
void OnExtensionCloseChannel(int port_id);
+ // Renderer process is requesting that the browser process establish a GPU
+ // channel.
void OnMsgEstablishGpuChannel();
+ // Renderer process is requesting that outstanding asynchronous GPU-related
+ // messages are processed.
+ void OnMsgSynchronizeGpu(IPC::Message* reply);
// Initialize support for visited links. Send the renderer process its initial
// set of visited links.