summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_thread.cc
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 22:08:35 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 22:08:35 +0000
commit6217d397bf501ec1ec5b7270d493006badd4d87a (patch)
treefce6c8e9c15b79bab29a9535ce9929dd9d53735b /chrome/renderer/render_thread.cc
parent21dedcc12d21ccb288244249522d77bc074c501e (diff)
downloadchromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.zip
chromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.tar.gz
chromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.tar.bz2
Calling OpenGL from the renderer process
- Added ability for renderer processes to render to a real window (Windows only so far). - Added ability to create offscreen frame buffer objects that can be resized later. - OpenGL context can have a "parent" context that can access its last swapped back buffer through a texture ID. - Moved code to establish GPU channel from RenderWidget to RenderThread. - Changed way service size command buffer object lifetimes are managed. TEST=trybot and visual verification that OpenGL can clear the browser window to magenta. BUG=none Review URL: http://codereview.chromium.org/1136006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.cc')
-rw-r--r--chrome/renderer/render_thread.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index ab97f2a..4fb0971 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -90,6 +90,10 @@
#include "chrome/app/breakpad_mac.h"
#endif
+#if defined(OS_POSIX)
+#include "ipc/ipc_channel_posix.h"
+#endif
+
using WebKit::WebCache;
using WebKit::WebCrossOriginPreflightResultCache;
using WebKit::WebFontCache;
@@ -565,6 +569,7 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
OnSpellCheckWordAdded)
IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect,
OnSpellCheckEnableAutoSpellCorrect)
+ IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished)
IPC_END_MESSAGE_MAP()
}
@@ -680,6 +685,34 @@ void RenderThread::UpdateActiveExtensions() {
child_process_logging::SetActiveExtensions(active_extensions);
}
+void RenderThread::EstablishGpuChannel() {
+ if (gpu_channel_.get()) {
+ // Do nothing if we are already establishing GPU channel.
+ if (gpu_channel_->state() == GpuChannelHost::UNCONNECTED)
+ return;
+
+ // Recreate the channel if it has been lost.
+ if (gpu_channel_->state() == GpuChannelHost::LOST)
+ gpu_channel_ = NULL;
+ }
+
+ if (!gpu_channel_.get())
+ gpu_channel_ = new GpuChannelHost;
+
+ // Ask the browser for the channel name.
+ Send(new ViewHostMsg_EstablishGpuChannel());
+}
+
+GpuChannelHost* RenderThread::GetGpuChannel() {
+ if (!gpu_channel_.get())
+ return NULL;
+
+ if (gpu_channel_->state() != GpuChannelHost::CONNECTED)
+ return NULL;
+
+ return gpu_channel_.get();
+}
+
static void* CreateHistogram(
const char *name, int min, int max, size_t buckets) {
if (min <= 0)
@@ -940,3 +973,20 @@ void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) {
void RenderThread::OnSetIsIncognitoProcess(bool is_incognito_process) {
is_incognito_process_ = is_incognito_process;
}
+
+void RenderThread::OnGpuChannelEstablished(
+ const IPC::ChannelHandle& channel_handle) {
+#if defined(OS_POSIX)
+ // If we received a ChannelHandle, register it now.
+ if (channel_handle.socket.fd >= 0)
+ IPC::AddChannelSocket(channel_handle.name, channel_handle.socket.fd);
+#endif
+
+ if (channel_handle.name.size() != 0) {
+ // Connect to the GPU process if a channel name was received.
+ gpu_channel_->Connect(channel_handle.name);
+ } else {
+ // Otherwise cancel the connection.
+ gpu_channel_ = NULL;
+ }
+}