diff options
author | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 00:45:14 +0000 |
---|---|---|
committer | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 00:45:14 +0000 |
commit | d1a9e0668ab374faab3505d1ccec3de85396fe46 (patch) | |
tree | 0f52d68d7881971c303f44384919fff0254bbf40 /content | |
parent | 34f7823a53573e28fe1108c6db14e7c7d3a4fd84 (diff) | |
download | chromium_src-d1a9e0668ab374faab3505d1ccec3de85396fe46.zip chromium_src-d1a9e0668ab374faab3505d1ccec3de85396fe46.tar.gz chromium_src-d1a9e0668ab374faab3505d1ccec3de85396fe46.tar.bz2 |
Improve GPU process URL crash reporting.
With this CL: if the GPU process crashes we will probably get the correct URL whether the crash occurred during off or onscreen context command processing.
If we still see blank URLs, more work can be done on the webkit side to report offscreen context URLs via webkitplatformsupport.
BUG=131466
Review URL: https://chromiumcodereview.appspot.com/10695133
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
10 files changed, 75 insertions, 19 deletions
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index d51113d..56a6aa5 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -346,10 +346,11 @@ class GpuProcessTransportFactory : public ui::ContextFactory, WebKit::WebGraphicsContext3D::Attributes attrs; attrs.shareResources = true; GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); + GURL url("chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"); scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( new WebGraphicsContext3DCommandBufferImpl( offscreen ? 0 : data->surface_id, - GURL(), + url, factory, data->swap_client->AsWeakPtr())); if (!context->Initialize( @@ -369,9 +370,10 @@ class GpuProcessTransportFactory : public ui::ContextFactory, GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); WebKit::WebGraphicsContext3D::Attributes attrs; attrs.shareResources = true; + GURL url("chrome://gpu/GpuProcessTransportFactory::CreateSharedContext"); data->shared_context.reset(new WebGraphicsContext3DCommandBufferImpl( 0, - GURL(), + url, factory, data->swap_client->AsWeakPtr())); if (!data->shared_context->Initialize( diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 6352a7a..2c26f2a 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -1475,13 +1475,14 @@ WebGraphicsContext3DCommandBufferImpl::CreateViewContext( WebGraphicsContext3DCommandBufferImpl* WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( GpuChannelHostFactory* factory, - const WebGraphicsContext3D::Attributes& attributes) { + const WebGraphicsContext3D::Attributes& attributes, + const GURL& active_url) { if (!factory) return NULL; base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> null_client; scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( new WebGraphicsContext3DCommandBufferImpl( - 0, GURL(), factory, null_client)); + 0, active_url, factory, null_client)); content::CauseForGpuLaunch cause = content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; if (context->Initialize(attributes, false, cause)) diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index 0a20729..9b1ddb9 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -132,7 +132,8 @@ class WebGraphicsContext3DCommandBufferImpl // on any failure. static WebGraphicsContext3DCommandBufferImpl* CreateOffscreenContext( GpuChannelHostFactory* factory, - const WebGraphicsContext3D::Attributes& attributes); + const WebGraphicsContext3D::Attributes& attributes, + const GURL& active_url); //---------------------------------------------------------------------- // WebGraphicsContext3D methods diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index eeefa4c..6a83008 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -18,7 +18,6 @@ #include "content/common/gpu/gpu_channel_manager.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/sync_point_manager.h" -#include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/gpu_scheduler.h" @@ -306,7 +305,6 @@ void GpuChannel::CreateViewCommandBuffer( surface_id); *route_id = MSG_ROUTING_NONE; - content::GetContentClient()->SetActiveURL(init_params.active_url); #if defined(ENABLE_GPU) @@ -326,7 +324,8 @@ void GpuChannel::CreateViewCommandBuffer( *route_id, surface_id, watchdog_, - software_)); + software_, + init_params.active_url)); if (preempt_by_counter_.get()) stub->SetPreemptByCounter(preempt_by_counter_); router_.AddRoute(*route_id, stub.get()); @@ -453,7 +452,6 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( int32 route_id = MSG_ROUTING_NONE; - content::GetContentClient()->SetActiveURL(init_params.active_url); #if defined(ENABLE_GPU) GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); @@ -471,7 +469,8 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( init_params.gpu_preference, route_id, 0, watchdog_, - software_)); + software_, + init_params.active_url)); if (preempt_by_counter_.get()) stub->SetPreemptByCounter(preempt_by_counter_); router_.AddRoute(route_id, stub.get()); diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index db088c4..c955abf 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -20,8 +20,10 @@ #include "content/common/gpu/image_transport_surface.h" #include "content/common/gpu/media/gpu_video_decode_accelerator.h" #include "content/common/gpu/sync_point_manager.h" +#include "content/public/common/content_client.h" #include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" +#include "net/disk_cache/hash.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_switches.h" @@ -30,12 +32,30 @@ #endif namespace { + +// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the +// url_hash matches. +void FastSetActiveURL(const GURL& url, size_t url_hash) { + // Leave the previously set URL in the empty case -- empty URLs are given by + // WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D. Hopefully the + // onscreen context URL was set previously and will show up even when a crash + // occurs during offscreen command processing. + if (url.is_empty()) + return; + static size_t g_last_url_hash = 0; + if (url_hash != g_last_url_hash) { + g_last_url_hash = url_hash; + content::GetContentClient()->SetActiveURL(url); + } +} + // The first time polling a fence, delay some extra time to allow other // stubs to process some work, or else the timing of the fences could // allow a pattern of alternating fast and slow frames to occur. const int64 kHandleMoreWorkPeriodMs = 2; const int64 kHandleMoreWorkPeriodBusyMs = 1; -} + +} // namespace GpuCommandBufferStub::SurfaceState::SurfaceState(int32 surface_id, bool visible, @@ -58,7 +78,8 @@ GpuCommandBufferStub::GpuCommandBufferStub( int32 route_id, int32 surface_id, GpuWatchdog* watchdog, - bool software) + bool software, + const GURL& active_url) : channel_(channel), handle_(handle), initial_size_(size), @@ -74,7 +95,11 @@ GpuCommandBufferStub::GpuCommandBufferStub( parent_texture_for_initialization_(0), watchdog_(watchdog), sync_point_wait_count_(0), - delayed_work_scheduled_(false) { + delayed_work_scheduled_(false), + active_url_(active_url) { + active_url_hash_ = + disk_cache::Hash(active_url.possibly_invalid_spec()); + FastSetActiveURL(active_url_, active_url_hash_); if (share_group) { context_group_ = share_group->context_group_; } else { @@ -95,6 +120,8 @@ GpuCommandBufferStub::~GpuCommandBufferStub() { } bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { + FastSetActiveURL(active_url_, active_url_hash_); + // Ensure the appropriate GL context is current before handling any IPC // messages directed at the command buffer. This ensures that the message // handler can assume that the context is current (not necessary for @@ -371,8 +398,7 @@ void GpuCommandBufferStub::OnInitialize( base::Unretained(this))); command_buffer_->SetPutOffsetChangeCallback( - base::Bind(&gpu::GpuScheduler::PutChanged, - base::Unretained(scheduler_.get()))); + base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this))); command_buffer_->SetGetBufferChangeCallback( base::Bind(&gpu::GpuScheduler::SetGetBuffer, base::Unretained(scheduler_.get()))); @@ -608,6 +634,11 @@ void GpuCommandBufferStub::ReportState() { } } +void GpuCommandBufferStub::PutChanged() { + FastSetActiveURL(active_url_, active_url_hash_); + scheduler_->PutChanged(); +} + void GpuCommandBufferStub::OnCreateVideoDecoder( media::VideoCodecProfile profile, IPC::Message* reply_message) { diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index caafa70..55c2be9 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -15,6 +15,7 @@ #include "content/common/content_export.h" #include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_allocation.h" +#include "googleurl/src/gurl.h" #include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/service/command_buffer_service.h" #include "gpu/command_buffer/service/context_group.h" @@ -103,7 +104,8 @@ class GpuCommandBufferStub int32 route_id, int32 surface_id, GpuWatchdog* watchdog, - bool software); + bool software, + const GURL& active_url); virtual ~GpuCommandBufferStub(); @@ -222,6 +224,9 @@ class GpuCommandBufferStub void ReportState(); + // Wrapper for GpuScheduler::PutChanged that sets the crash report URL. + void PutChanged(); + // Poll the command buffer to execute work. void PollWork(); @@ -279,6 +284,9 @@ class GpuCommandBufferStub scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; + GURL active_url_; + size_t active_url_hash_; + DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); }; diff --git a/content/common/webkitplatformsupport_impl.cc b/content/common/webkitplatformsupport_impl.cc index f8700d7..dd7a9fc 100644 --- a/content/common/webkitplatformsupport_impl.cc +++ b/content/common/webkitplatformsupport_impl.cc @@ -62,8 +62,10 @@ 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); + GetGpuChannelHostFactory(), attributes, GURL()); } } diff --git a/content/renderer/browser_plugin/old/guest_to_embedder_channel.cc b/content/renderer/browser_plugin/old/guest_to_embedder_channel.cc index deffad5..8a4e315 100644 --- a/content/renderer/browser_plugin/old/guest_to_embedder_channel.cc +++ b/content/renderer/browser_plugin/old/guest_to_embedder_channel.cc @@ -18,6 +18,8 @@ #include "ppapi/shared_impl/api_id.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/var.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "webkit/plugins/ppapi/event_conversion.h" namespace content { @@ -93,9 +95,16 @@ WebGraphicsContext3DCommandBufferImpl* RenderViewImpl* render_view, const WebKit::WebGraphicsContext3D::Attributes& attributes, bool offscreen) { + GURL url; + if (render_view->webview()->mainFrame()) { + url = GURL(render_view->webview()->mainFrame()->document().url()); + } else { + url = + GURL("chrome://gpu/GuestToEmbedderChannel::CreateWebGraphicsContext3D"); + } scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( new WebGraphicsContext3DCommandBufferImpl( - 0, GURL(), NULL, + 0, url, NULL, render_view->AsWeakPtr())); // Special case: RenderView initialization has not yet completed. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index dea6cf5..99988be 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -744,7 +744,8 @@ RenderThreadImpl::GetGpuVDAContext3D() { if (!gpu_vda_context3d_.get()) { gpu_vda_context3d_.reset( WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( - this, WebKit::WebGraphicsContext3D::Attributes())); + this, WebKit::WebGraphicsContext3D::Attributes(), + GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))); } return gpu_vda_context3d_->AsWeakPtr(); } diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 29e7b65..0f6a1d8 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -1743,6 +1743,8 @@ WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( GURL url; if (webview()->mainFrame()) url = GURL(webview()->mainFrame()->document().url()); + else + url = GURL("chrome://gpu/RenderViewImpl::createGraphicsContext3D"); scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( new WebGraphicsContext3DCommandBufferImpl( |