diff options
author | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-08 01:44:01 +0000 |
---|---|---|
committer | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-08 01:44:01 +0000 |
commit | 54947031f1b6094498f16b49009a5abceba3d401 (patch) | |
tree | e316a073f8ad106214b37d9b4acf85230eae0829 /content/common | |
parent | ae665b9bbe3e4c3a442ade6e70f8ecc0aaba7cae (diff) | |
download | chromium_src-54947031f1b6094498f16b49009a5abceba3d401.zip chromium_src-54947031f1b6094498f16b49009a5abceba3d401.tar.gz chromium_src-54947031f1b6094498f16b49009a5abceba3d401.tar.bz2 |
Send notification from GPU process to browser process of offscreen context creation and destruction, and all context lost events. This improves the robustness of blocking of client 3D APIs such as WebGL when GPU resets occur.
Note that this fix depends on the fix for https://bugs.webkit.org/show_bug.cgi?id=103793 .
BUG=112339
TEST=test case from bug
Review URL: https://chromiumcodereview.appspot.com/11434072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 19 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 11 | ||||
-rw-r--r-- | content/common/webkitplatformsupport_impl.cc | 6 |
3 files changed, 33 insertions, 3 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 61b1822..e2f1e15 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -301,6 +301,12 @@ bool GpuCommandBufferStub::MakeCurrent() { } void GpuCommandBufferStub::Destroy() { + if (handle_.is_null() && !active_url_.is_empty()) { + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); + gpu_channel_manager->Send(new GpuHostMsg_DidDestroyOffscreenContext( + active_url_)); + } + GetMemoryManager()->RemoveClient(this); while (!sync_points_.empty()) @@ -507,6 +513,12 @@ void GpuCommandBufferStub::OnInitialize( GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); Send(reply_message); + + if (handle_.is_null() && !active_url_.is_empty()) { + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); + gpu_channel_manager->Send(new GpuHostMsg_DidCreateOffscreenContext( + active_url_)); + } } void GpuCommandBufferStub::OnSetGetBuffer( @@ -583,6 +595,13 @@ void GpuCommandBufferStub::OnParseError() { route_id_, state.context_lost_reason); msg->set_unblock(true); Send(msg); + + // Tell the browser about this context loss as well, so it can + // determine whether client APIs like WebGL need to be immediately + // blocked from automatically running. + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); + gpu_channel_manager->Send(new GpuHostMsg_DidLoseContext( + handle_.is_null(), state.context_lost_reason, active_url_)); } void GpuCommandBufferStub::OnGetStateFast(IPC::Message* reply_message) { diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 11278f3..3f3cf67 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -400,6 +400,17 @@ IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters, base::TimeTicks /* timebase */, base::TimeDelta /* interval */) +IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext, + GURL /* url */) + +IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext, + bool /* offscreen */, + gpu::error::ContextLostReason /* reason */, + GURL /* url */) + +IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext, + GURL /* url */) + //------------------------------------------------------------------------------ // GPU Channel Messages // These are messages from a renderer process to the GPU process. diff --git a/content/common/webkitplatformsupport_impl.cc b/content/common/webkitplatformsupport_impl.cc index 991dc1e..e25c267 100644 --- a/content/common/webkitplatformsupport_impl.cc +++ b/content/common/webkitplatformsupport_impl.cc @@ -9,6 +9,7 @@ #include "content/common/webkitplatformsupport_impl.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" +#include "googleurl/src/gurl.h" #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" namespace content { @@ -68,10 +69,9 @@ WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( attributes, false); } else { - // Intentionally blank URL provided for offscreen contexts -- blank URLs are - // ignored in the GPU process for crash reporting. return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( - GetGpuChannelHostFactory(), attributes, GURL()); + GetGpuChannelHostFactory(), attributes, + GURL(attributes.topDocumentURL)); } } |