diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 21:41:15 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 21:41:15 +0000 |
commit | b2277bea8f33c4c346914cf81c628aac2a15f79b (patch) | |
tree | e29c7bc1441947a8347c25e5a9c4cec2edc9d888 | |
parent | ee5feb9fa3859299c6be22a34f42be3b6e235bfd (diff) | |
download | chromium_src-b2277bea8f33c4c346914cf81c628aac2a15f79b.zip chromium_src-b2277bea8f33c4c346914cf81c628aac2a15f79b.tar.gz chromium_src-b2277bea8f33c4c346914cf81c628aac2a15f79b.tar.bz2 |
Fixed a hang in the renderer process. If the renderer process requests for a channel synchronously and the channel could not be established, the renderer thread would keep waiting for the reply to synchronization request.
BUG=61771
TEST=Manually tested pages that require hardware acceleration to make sure they still render correctly
Review URL: http://codereview.chromium.org/4884002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66175 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gpu_process_host.cc | 30 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host.h | 14 |
2 files changed, 33 insertions, 11 deletions
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index 171c404..e7bcf01 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -152,17 +152,20 @@ void GpuProcessHost::EstablishGpuChannel(int renderer_id, if (Send(new GpuMsg_EstablishChannel(renderer_id))) { sent_requests_.push(ChannelRequest(filter)); } else { - ReplyToRenderer(IPC::ChannelHandle(), GPUInfo(), filter); + SendEstablishChannelReply(IPC::ChannelHandle(), GPUInfo(), filter); } } void GpuProcessHost::Synchronize(IPC::Message* reply, ResourceMessageFilter* filter) { - queued_synchronization_replies_.push(SynchronizationRequest(reply, filter)); - Send(new GpuMsg_Synchronize()); + if (Send(new GpuMsg_Synchronize())) { + queued_synchronization_replies_.push(SynchronizationRequest(reply, filter)); + } else { + SendSynchronizationReply(reply, filter); + } } -GPUInfo GpuProcessHost::gpu_info() const { +const GPUInfo& GpuProcessHost::gpu_info() const { return gpu_info_; } @@ -203,7 +206,7 @@ void GpuProcessHost::OnChannelEstablished( const IPC::ChannelHandle& channel_handle, const GPUInfo& gpu_info) { const ChannelRequest& request = sent_requests_.front(); - ReplyToRenderer(channel_handle, gpu_info, request.filter); + SendEstablishChannelReply(channel_handle, gpu_info, request.filter); sent_requests_.pop(); gpu_info_ = gpu_info; child_process_logging::SetGpuInfo(gpu_info); @@ -212,7 +215,7 @@ void GpuProcessHost::OnChannelEstablished( void GpuProcessHost::OnSynchronizeReply() { const SynchronizationRequest& request = queued_synchronization_replies_.front(); - request.filter->Send(request.reply); + SendSynchronizationReply(request.reply, request.filter); queued_synchronization_replies_.pop(); } @@ -344,7 +347,7 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( } #endif -void GpuProcessHost::ReplyToRenderer( +void GpuProcessHost::SendEstablishChannelReply( const IPC::ChannelHandle& channel, const GPUInfo& gpu_info, ResourceMessageFilter* filter) { @@ -357,6 +360,13 @@ void GpuProcessHost::ReplyToRenderer( filter->Send(message); } +// Sends the response for synchronization request to the renderer. +void GpuProcessHost::SendSynchronizationReply( + IPC::Message* reply, + ResourceMessageFilter* filter) { + filter->Send(reply); +} + URLRequestContext* GpuProcessHost::GetRequestContext( uint32 request_id, const ViewHostMsg_Resource_Request& request_data) { @@ -366,3 +376,9 @@ URLRequestContext* GpuProcessHost::GetRequestContext( bool GpuProcessHost::CanShutdown() { return true; } + +void GpuProcessHost::OnProcessCrashed() { + // TODO(alokp): Update gpu process crash rate. + BrowserChildProcessHost::OnProcessCrashed(); +} + diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h index f9aa06f..cc30f0b 100644 --- a/chrome/browser/gpu_process_host.h +++ b/chrome/browser/gpu_process_host.h @@ -50,7 +50,8 @@ class GpuProcessHost : public BrowserChildProcessHost { // Return the stored gpu_info as this class the // browser's point of contact with the gpu - GPUInfo gpu_info() const; + const GPUInfo& gpu_info() const; + private: // Used to queue pending channel requests. struct ChannelRequest { @@ -99,9 +100,13 @@ class GpuProcessHost : public BrowserChildProcessHost { uint64 surface_id); #endif - void ReplyToRenderer(const IPC::ChannelHandle& channel, - const GPUInfo& gpu_info, - ResourceMessageFilter* filter); + // Sends the response for establish channel request to the renderer. + void SendEstablishChannelReply(const IPC::ChannelHandle& channel, + const GPUInfo& gpu_info, + ResourceMessageFilter* filter); + // Sends the response for synchronization request to the renderer. + void SendSynchronizationReply(IPC::Message* reply, + ResourceMessageFilter* filter); // ResourceDispatcherHost::Receiver implementation: virtual URLRequestContext* GetRequestContext( @@ -109,6 +114,7 @@ class GpuProcessHost : public BrowserChildProcessHost { const ViewHostMsg_Resource_Request& request_data); virtual bool CanShutdown(); + virtual void OnProcessCrashed(); bool initialized_; bool initialized_successfully_; |