Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/gpu_process_host.cc

Issue 4884002: Fixed a hang in the renderer process. If the renderer process requests for a ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gpu_process_host.h" 5 #include "chrome/browser/gpu_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 FROM_HERE, 145 FROM_HERE,
146 new RouteOnUIThreadTask(message)); 146 new RouteOnUIThreadTask(message));
147 } 147 }
148 } 148 }
149 149
150 void GpuProcessHost::EstablishGpuChannel(int renderer_id, 150 void GpuProcessHost::EstablishGpuChannel(int renderer_id,
151 ResourceMessageFilter* filter) { 151 ResourceMessageFilter* filter) {
152 if (Send(new GpuMsg_EstablishChannel(renderer_id))) { 152 if (Send(new GpuMsg_EstablishChannel(renderer_id))) {
153 sent_requests_.push(ChannelRequest(filter)); 153 sent_requests_.push(ChannelRequest(filter));
154 } else { 154 } else {
155 ReplyToRenderer(IPC::ChannelHandle(), GPUInfo(), filter); 155 SendEstablishChannelReply(IPC::ChannelHandle(), GPUInfo(), filter);
156 } 156 }
157 } 157 }
158 158
159 void GpuProcessHost::Synchronize(IPC::Message* reply, 159 void GpuProcessHost::Synchronize(IPC::Message* reply,
160 ResourceMessageFilter* filter) { 160 ResourceMessageFilter* filter) {
161 queued_synchronization_replies_.push(SynchronizationRequest(reply, filter)); 161 if (Send(new GpuMsg_Synchronize())) {
162 Send(new GpuMsg_Synchronize()); 162 queued_synchronization_replies_.push(SynchronizationRequest(reply, filter));
163 } else {
164 SendSynchronizationReply(reply, filter);
165 }
163 } 166 }
164 167
165 GPUInfo GpuProcessHost::gpu_info() const { 168 const GPUInfo& GpuProcessHost::gpu_info() const {
166 return gpu_info_; 169 return gpu_info_;
167 } 170 }
168 171
169 GpuProcessHost::ChannelRequest::ChannelRequest(ResourceMessageFilter* filter) 172 GpuProcessHost::ChannelRequest::ChannelRequest(ResourceMessageFilter* filter)
170 : filter(filter) { 173 : filter(filter) {
171 } 174 }
172 175
173 GpuProcessHost::ChannelRequest::~ChannelRequest() {} 176 GpuProcessHost::ChannelRequest::~ChannelRequest() {}
174 177
175 GpuProcessHost::SynchronizationRequest::SynchronizationRequest( 178 GpuProcessHost::SynchronizationRequest::SynchronizationRequest(
(...skipping 20 matching lines...) Expand all
196 OnAcceleratedSurfaceBuffersSwapped) 199 OnAcceleratedSurfaceBuffersSwapped)
197 #endif 200 #endif
198 IPC_MESSAGE_UNHANDLED_ERROR() 201 IPC_MESSAGE_UNHANDLED_ERROR()
199 IPC_END_MESSAGE_MAP() 202 IPC_END_MESSAGE_MAP()
200 } 203 }
201 204
202 void GpuProcessHost::OnChannelEstablished( 205 void GpuProcessHost::OnChannelEstablished(
203 const IPC::ChannelHandle& channel_handle, 206 const IPC::ChannelHandle& channel_handle,
204 const GPUInfo& gpu_info) { 207 const GPUInfo& gpu_info) {
205 const ChannelRequest& request = sent_requests_.front(); 208 const ChannelRequest& request = sent_requests_.front();
206 ReplyToRenderer(channel_handle, gpu_info, request.filter); 209 SendEstablishChannelReply(channel_handle, gpu_info, request.filter);
207 sent_requests_.pop(); 210 sent_requests_.pop();
208 gpu_info_ = gpu_info; 211 gpu_info_ = gpu_info;
209 child_process_logging::SetGpuInfo(gpu_info); 212 child_process_logging::SetGpuInfo(gpu_info);
210 } 213 }
211 214
212 void GpuProcessHost::OnSynchronizeReply() { 215 void GpuProcessHost::OnSynchronizeReply() {
213 const SynchronizationRequest& request = 216 const SynchronizationRequest& request =
214 queued_synchronization_replies_.front(); 217 queued_synchronization_replies_.front();
215 request.filter->Send(request.reply); 218 SendSynchronizationReply(request.reply, request.filter);
216 queued_synchronization_replies_.pop(); 219 queued_synchronization_replies_.pop();
217 } 220 }
218 221
219 void GpuProcessHost::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { 222 void GpuProcessHost::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
220 gpu_info_ = gpu_info; 223 gpu_info_ = gpu_info;
221 } 224 }
222 225
223 #if defined(OS_LINUX) 226 #if defined(OS_LINUX)
224 227
225 namespace { 228 namespace {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 int32 render_view_id, 340 int32 render_view_id,
338 gfx::PluginWindowHandle window, 341 gfx::PluginWindowHandle window,
339 uint64 surface_id) { 342 uint64 surface_id) {
340 BrowserThread::PostTask( 343 BrowserThread::PostTask(
341 BrowserThread::UI, FROM_HERE, 344 BrowserThread::UI, FROM_HERE,
342 new BuffersSwappedDispatcher( 345 new BuffersSwappedDispatcher(
343 renderer_id, render_view_id, window, surface_id)); 346 renderer_id, render_view_id, window, surface_id));
344 } 347 }
345 #endif 348 #endif
346 349
347 void GpuProcessHost::ReplyToRenderer( 350 void GpuProcessHost::SendEstablishChannelReply(
348 const IPC::ChannelHandle& channel, 351 const IPC::ChannelHandle& channel,
349 const GPUInfo& gpu_info, 352 const GPUInfo& gpu_info,
350 ResourceMessageFilter* filter) { 353 ResourceMessageFilter* filter) {
351 ViewMsg_GpuChannelEstablished* message = 354 ViewMsg_GpuChannelEstablished* message =
352 new ViewMsg_GpuChannelEstablished(channel, gpu_info); 355 new ViewMsg_GpuChannelEstablished(channel, gpu_info);
353 // If the renderer process is performing synchronous initialization, 356 // If the renderer process is performing synchronous initialization,
354 // it needs to handle this message before receiving the reply for 357 // it needs to handle this message before receiving the reply for
355 // the synchronous ViewHostMsg_SynchronizeGpu message. 358 // the synchronous ViewHostMsg_SynchronizeGpu message.
356 message->set_unblock(true); 359 message->set_unblock(true);
357 filter->Send(message); 360 filter->Send(message);
358 } 361 }
359 362
363 // Sends the response for synchronization request to the renderer.
364 void GpuProcessHost::SendSynchronizationReply(
365 IPC::Message* reply,
366 ResourceMessageFilter* filter) {
367 filter->Send(reply);
368 }
369
360 URLRequestContext* GpuProcessHost::GetRequestContext( 370 URLRequestContext* GpuProcessHost::GetRequestContext(
361 uint32 request_id, 371 uint32 request_id,
362 const ViewHostMsg_Resource_Request& request_data) { 372 const ViewHostMsg_Resource_Request& request_data) {
363 return NULL; 373 return NULL;
364 } 374 }
365 375
366 bool GpuProcessHost::CanShutdown() { 376 bool GpuProcessHost::CanShutdown() {
367 return true; 377 return true;
368 } 378 }
379
380 void GpuProcessHost::OnProcessCrashed() {
381 // TODO(alokp): Update gpu process crash rate.
382 BrowserChildProcessHost::OnProcessCrashed();
383 }
384
OLDNEW
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698