| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 7 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 10 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 13 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 14 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
| 15 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 16 #include "content/browser/gpu/gpu_data_manager.h" | 18 #include "content/browser/gpu/gpu_data_manager.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static int g_gpu_crash_count = 0; | 60 static int g_gpu_crash_count = 0; |
| 59 | 61 |
| 60 // Maximum number of times the gpu process is allowed to crash in a session. | 62 // Maximum number of times the gpu process is allowed to crash in a session. |
| 61 // Once this limit is reached, any request to launch the gpu process will fail. | 63 // Once this limit is reached, any request to launch the gpu process will fail. |
| 62 static const int kGpuMaxCrashCount = 3; | 64 static const int kGpuMaxCrashCount = 3; |
| 63 | 65 |
| 64 int g_last_host_id = 0; | 66 int g_last_host_id = 0; |
| 65 | 67 |
| 66 #if defined(TOOLKIT_USES_GTK) | 68 #if defined(TOOLKIT_USES_GTK) |
| 67 | 69 |
| 68 class ReleasePermanentXIDDispatcher: public Task { | 70 void ReleasePermanentXIDDispatcher(gfx::PluginWindowHandle surface) { |
| 69 public: | |
| 70 explicit ReleasePermanentXIDDispatcher(gfx::PluginWindowHandle surface); | |
| 71 void Run(); | |
| 72 private: | |
| 73 gfx::PluginWindowHandle surface_; | |
| 74 }; | |
| 75 | |
| 76 ReleasePermanentXIDDispatcher::ReleasePermanentXIDDispatcher( | |
| 77 gfx::PluginWindowHandle surface) | |
| 78 : surface_(surface) { | |
| 79 } | |
| 80 | |
| 81 void ReleasePermanentXIDDispatcher::Run() { | |
| 82 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); | 71 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); |
| 83 manager->ReleasePermanentXID(surface_); | 72 manager->ReleasePermanentXID(surface); |
| 84 } | 73 } |
| 85 | 74 |
| 86 #endif | 75 #endif |
| 87 | 76 |
| 88 void SendGpuProcessMessage(int renderer_id, | 77 void SendGpuProcessMessage(int renderer_id, |
| 89 content::CauseForGpuLaunch cause, | 78 content::CauseForGpuLaunch cause, |
| 90 IPC::Message* message) { | 79 IPC::Message* message) { |
| 91 GpuProcessHost* host = GpuProcessHost::GetForRenderer( | 80 GpuProcessHost* host = GpuProcessHost::GetForRenderer( |
| 92 renderer_id, cause); | 81 renderer_id, cause); |
| 93 if (host) { | 82 if (host) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 115 : surface_(surface) { | 104 : surface_(surface) { |
| 116 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); | 105 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); |
| 117 if (!manager->AddRefPermanentXID(surface_)) { | 106 if (!manager->AddRefPermanentXID(surface_)) { |
| 118 LOG(ERROR) << "Surface " << surface << " cannot be referenced."; | 107 LOG(ERROR) << "Surface " << surface << " cannot be referenced."; |
| 119 } | 108 } |
| 120 } | 109 } |
| 121 | 110 |
| 122 GpuProcessHost::SurfaceRef::~SurfaceRef() { | 111 GpuProcessHost::SurfaceRef::~SurfaceRef() { |
| 123 BrowserThread::PostTask(BrowserThread::UI, | 112 BrowserThread::PostTask(BrowserThread::UI, |
| 124 FROM_HERE, | 113 FROM_HERE, |
| 125 new ReleasePermanentXIDDispatcher(surface_)); | 114 base::Bind(&ReleasePermanentXIDDispatcher, surface_)); |
| 126 } | 115 } |
| 127 #endif // defined(TOOLKIT_USES_GTK) | 116 #endif // defined(TOOLKIT_USES_GTK) |
| 128 | 117 |
| 129 // This class creates a GPU thread (instead of a GPU process), when running | 118 // This class creates a GPU thread (instead of a GPU process), when running |
| 130 // with --in-process-gpu or --single-process. | 119 // with --in-process-gpu or --single-process. |
| 131 class GpuMainThread : public base::Thread { | 120 class GpuMainThread : public base::Thread { |
| 132 public: | 121 public: |
| 133 explicit GpuMainThread(const std::string& channel_id) | 122 explicit GpuMainThread(const std::string& channel_id) |
| 134 : base::Thread("Chrome_InProcGpuThread"), | 123 : base::Thread("Chrome_InProcGpuThread"), |
| 135 channel_id_(channel_id), | 124 channel_id_(channel_id), |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 delete host; | 215 delete host; |
| 227 return NULL; | 216 return NULL; |
| 228 } | 217 } |
| 229 | 218 |
| 230 // static | 219 // static |
| 231 void GpuProcessHost::SendOnIO(int renderer_id, | 220 void GpuProcessHost::SendOnIO(int renderer_id, |
| 232 content::CauseForGpuLaunch cause, | 221 content::CauseForGpuLaunch cause, |
| 233 IPC::Message* message) { | 222 IPC::Message* message) { |
| 234 BrowserThread::PostTask( | 223 BrowserThread::PostTask( |
| 235 BrowserThread::IO, FROM_HERE, | 224 BrowserThread::IO, FROM_HERE, |
| 236 NewRunnableFunction( | 225 base::Bind( |
| 237 &SendGpuProcessMessage, renderer_id, cause, message)); | 226 &SendGpuProcessMessage, renderer_id, cause, message)); |
| 238 } | 227 } |
| 239 | 228 |
| 240 // static | 229 // static |
| 241 GpuProcessHost* GpuProcessHost::FromID(int host_id) { | 230 GpuProcessHost* GpuProcessHost::FromID(int host_id) { |
| 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 243 | 232 |
| 244 if (host_id == 0) | 233 if (host_id == 0) |
| 245 return NULL; | 234 return NULL; |
| 246 | 235 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 268 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); | 257 g_hosts_by_id.Pointer()->AddWithID(this, host_id_); |
| 269 | 258 |
| 270 // Post a task to create the corresponding GpuProcessHostUIShim. The | 259 // Post a task to create the corresponding GpuProcessHostUIShim. The |
| 271 // GpuProcessHostUIShim will be destroyed if either the browser exits, | 260 // GpuProcessHostUIShim will be destroyed if either the browser exits, |
| 272 // in which case it calls GpuProcessHostUIShim::DestroyAll, or the | 261 // in which case it calls GpuProcessHostUIShim::DestroyAll, or the |
| 273 // GpuProcessHost is destroyed, which happens when the corresponding GPU | 262 // GpuProcessHost is destroyed, which happens when the corresponding GPU |
| 274 // process terminates or fails to launch. | 263 // process terminates or fails to launch. |
| 275 BrowserThread::PostTask( | 264 BrowserThread::PostTask( |
| 276 BrowserThread::UI, | 265 BrowserThread::UI, |
| 277 FROM_HERE, | 266 FROM_HERE, |
| 278 NewRunnableFunction(&GpuProcessHostUIShim::Create, host_id)); | 267 base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id)); |
| 279 } | 268 } |
| 280 | 269 |
| 281 GpuProcessHost::~GpuProcessHost() { | 270 GpuProcessHost::~GpuProcessHost() { |
| 282 DCHECK(CalledOnValidThread()); | 271 DCHECK(CalledOnValidThread()); |
| 283 | 272 |
| 284 SendOutstandingReplies(); | 273 SendOutstandingReplies(); |
| 285 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 274 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 286 DIED_FIRST_TIME + g_gpu_crash_count, | 275 DIED_FIRST_TIME + g_gpu_crash_count, |
| 287 GPU_PROCESS_LIFETIME_EVENT_MAX); | 276 GPU_PROCESS_LIFETIME_EVENT_MAX); |
| 288 | 277 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 307 // In case we never started, clean up. | 296 // In case we never started, clean up. |
| 308 while (!queued_messages_.empty()) { | 297 while (!queued_messages_.empty()) { |
| 309 delete queued_messages_.front(); | 298 delete queued_messages_.front(); |
| 310 queued_messages_.pop(); | 299 queued_messages_.pop(); |
| 311 } | 300 } |
| 312 | 301 |
| 313 g_hosts_by_id.Pointer()->Remove(host_id_); | 302 g_hosts_by_id.Pointer()->Remove(host_id_); |
| 314 | 303 |
| 315 BrowserThread::PostTask(BrowserThread::UI, | 304 BrowserThread::PostTask(BrowserThread::UI, |
| 316 FROM_HERE, | 305 FROM_HERE, |
| 317 NewRunnableFunction(GpuProcessHostUIShim::Destroy, | 306 base::Bind(&GpuProcessHostUIShim::Destroy, host_id_)); |
| 318 host_id_)); | |
| 319 } | 307 } |
| 320 | 308 |
| 321 bool GpuProcessHost::Init() { | 309 bool GpuProcessHost::Init() { |
| 322 std::string channel_id = child_process_host()->CreateChannel(); | 310 std::string channel_id = child_process_host()->CreateChannel(); |
| 323 if (channel_id.empty()) | 311 if (channel_id.empty()) |
| 324 return false; | 312 return false; |
| 325 | 313 |
| 326 if (in_process_) { | 314 if (in_process_) { |
| 327 CommandLine::ForCurrentProcess()->AppendSwitch( | 315 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 328 switches::kDisableGpuWatchdog); | 316 switches::kDisableGpuWatchdog); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 346 } else if (!LaunchGpuProcess(channel_id)) | 334 } else if (!LaunchGpuProcess(channel_id)) |
| 347 return false; | 335 return false; |
| 348 | 336 |
| 349 return Send(new GpuMsg_Initialize()); | 337 return Send(new GpuMsg_Initialize()); |
| 350 } | 338 } |
| 351 | 339 |
| 352 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { | 340 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { |
| 353 BrowserThread::PostTask( | 341 BrowserThread::PostTask( |
| 354 BrowserThread::UI, | 342 BrowserThread::UI, |
| 355 FROM_HERE, | 343 FROM_HERE, |
| 356 new RouteToGpuProcessHostUIShimTask(host_id_, message)); | 344 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); |
| 357 } | 345 } |
| 358 | 346 |
| 359 bool GpuProcessHost::Send(IPC::Message* msg) { | 347 bool GpuProcessHost::Send(IPC::Message* msg) { |
| 360 DCHECK(CalledOnValidThread()); | 348 DCHECK(CalledOnValidThread()); |
| 361 if (child_process_host()->IsChannelOpening()) { | 349 if (child_process_host()->IsChannelOpening()) { |
| 362 queued_messages_.push(msg); | 350 queued_messages_.push(msg); |
| 363 return true; | 351 return true; |
| 364 } | 352 } |
| 365 | 353 |
| 366 return BrowserChildProcessHost::Send(msg); | 354 return BrowserChildProcessHost::Send(msg); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 383 void GpuProcessHost::OnChannelConnected(int32 peer_pid) { | 371 void GpuProcessHost::OnChannelConnected(int32 peer_pid) { |
| 384 BrowserChildProcessHost::OnChannelConnected(peer_pid); | 372 BrowserChildProcessHost::OnChannelConnected(peer_pid); |
| 385 while (!queued_messages_.empty()) { | 373 while (!queued_messages_.empty()) { |
| 386 Send(queued_messages_.front()); | 374 Send(queued_messages_.front()); |
| 387 queued_messages_.pop(); | 375 queued_messages_.pop(); |
| 388 } | 376 } |
| 389 } | 377 } |
| 390 | 378 |
| 391 void GpuProcessHost::EstablishGpuChannel( | 379 void GpuProcessHost::EstablishGpuChannel( |
| 392 int renderer_id, | 380 int renderer_id, |
| 393 EstablishChannelCallback *callback) { | 381 const EstablishChannelCallback& callback) { |
| 394 DCHECK(CalledOnValidThread()); | 382 DCHECK(CalledOnValidThread()); |
| 395 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); | 383 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); |
| 396 linked_ptr<EstablishChannelCallback> wrapped_callback(callback); | |
| 397 | 384 |
| 398 // If GPU features are already blacklisted, no need to establish the channel. | 385 // If GPU features are already blacklisted, no need to establish the channel. |
| 399 if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) { | 386 if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) { |
| 400 EstablishChannelError( | 387 EstablishChannelError( |
| 401 wrapped_callback.release(), IPC::ChannelHandle(), | 388 callback, IPC::ChannelHandle(), |
| 402 base::kNullProcessHandle, content::GPUInfo()); | 389 base::kNullProcessHandle, content::GPUInfo()); |
| 403 return; | 390 return; |
| 404 } | 391 } |
| 405 | 392 |
| 406 if (Send(new GpuMsg_EstablishChannel(renderer_id))) { | 393 if (Send(new GpuMsg_EstablishChannel(renderer_id))) { |
| 407 channel_requests_.push(wrapped_callback); | 394 channel_requests_.push(callback); |
| 408 } else { | 395 } else { |
| 409 EstablishChannelError( | 396 EstablishChannelError( |
| 410 wrapped_callback.release(), IPC::ChannelHandle(), | 397 callback, IPC::ChannelHandle(), |
| 411 base::kNullProcessHandle, content::GPUInfo()); | 398 base::kNullProcessHandle, content::GPUInfo()); |
| 412 } | 399 } |
| 413 } | 400 } |
| 414 | 401 |
| 415 void GpuProcessHost::CreateViewCommandBuffer( | 402 void GpuProcessHost::CreateViewCommandBuffer( |
| 416 gfx::PluginWindowHandle compositing_surface, | 403 gfx::PluginWindowHandle compositing_surface, |
| 417 int32 render_view_id, | 404 int32 render_view_id, |
| 418 int32 renderer_id, | 405 int32 renderer_id, |
| 419 const GPUCreateCommandBufferConfig& init_params, | 406 const GPUCreateCommandBufferConfig& init_params, |
| 420 CreateCommandBufferCallback* callback) { | 407 const CreateCommandBufferCallback& callback) { |
| 421 DCHECK(CalledOnValidThread()); | 408 DCHECK(CalledOnValidThread()); |
| 422 linked_ptr<CreateCommandBufferCallback> wrapped_callback(callback); | |
| 423 | 409 |
| 424 #if defined(TOOLKIT_USES_GTK) | 410 #if defined(TOOLKIT_USES_GTK) |
| 425 ViewID view_id(renderer_id, render_view_id); | 411 ViewID view_id(renderer_id, render_view_id); |
| 426 | 412 |
| 427 // There should only be one such command buffer (for the compositor). In | 413 // There should only be one such command buffer (for the compositor). In |
| 428 // practice, if the GPU process lost a context, GraphicsContext3D with | 414 // practice, if the GPU process lost a context, GraphicsContext3D with |
| 429 // associated command buffer and view surface will not be gone until new | 415 // associated command buffer and view surface will not be gone until new |
| 430 // one is in place and all layers are reattached. | 416 // one is in place and all layers are reattached. |
| 431 linked_ptr<SurfaceRef> surface_ref; | 417 linked_ptr<SurfaceRef> surface_ref; |
| 432 SurfaceRefMap::iterator it = surface_refs_.find(view_id); | 418 SurfaceRefMap::iterator it = surface_refs_.find(view_id); |
| 433 if (it != surface_refs_.end()) | 419 if (it != surface_refs_.end()) |
| 434 surface_ref = (*it).second; | 420 surface_ref = (*it).second; |
| 435 else | 421 else |
| 436 surface_ref.reset(new SurfaceRef(compositing_surface)); | 422 surface_ref.reset(new SurfaceRef(compositing_surface)); |
| 437 #endif // defined(TOOLKIT_USES_GTK) | 423 #endif // defined(TOOLKIT_USES_GTK) |
| 438 | 424 |
| 439 if (compositing_surface != gfx::kNullPluginWindow && | 425 if (compositing_surface != gfx::kNullPluginWindow && |
| 440 Send(new GpuMsg_CreateViewCommandBuffer( | 426 Send(new GpuMsg_CreateViewCommandBuffer( |
| 441 compositing_surface, render_view_id, renderer_id, init_params))) { | 427 compositing_surface, render_view_id, renderer_id, init_params))) { |
| 442 create_command_buffer_requests_.push(wrapped_callback); | 428 create_command_buffer_requests_.push(callback); |
| 443 #if defined(TOOLKIT_USES_GTK) | 429 #if defined(TOOLKIT_USES_GTK) |
| 444 surface_refs_.insert(std::pair<ViewID, linked_ptr<SurfaceRef> >( | 430 surface_refs_.insert(std::pair<ViewID, linked_ptr<SurfaceRef> >( |
| 445 view_id, surface_ref)); | 431 view_id, surface_ref)); |
| 446 #endif | 432 #endif |
| 447 } else { | 433 } else { |
| 448 CreateCommandBufferError(wrapped_callback.release(), MSG_ROUTING_NONE); | 434 CreateCommandBufferError(callback, MSG_ROUTING_NONE); |
| 449 } | 435 } |
| 450 } | 436 } |
| 451 | 437 |
| 452 void GpuProcessHost::OnChannelEstablished( | 438 void GpuProcessHost::OnChannelEstablished( |
| 453 const IPC::ChannelHandle& channel_handle) { | 439 const IPC::ChannelHandle& channel_handle) { |
| 454 // The GPU process should have launched at this point and this object should | 440 // The GPU process should have launched at this point and this object should |
| 455 // have been notified of its process handle. | 441 // have been notified of its process handle. |
| 456 DCHECK(gpu_process_); | 442 DCHECK(gpu_process_); |
| 457 | 443 |
| 458 linked_ptr<EstablishChannelCallback> callback = channel_requests_.front(); | 444 EstablishChannelCallback callback = channel_requests_.front(); |
| 459 channel_requests_.pop(); | 445 channel_requests_.pop(); |
| 460 | 446 |
| 461 // Currently if any of the GPU features are blacklisted, we don't establish a | 447 // Currently if any of the GPU features are blacklisted, we don't establish a |
| 462 // GPU channel. | 448 // GPU channel. |
| 463 if (!channel_handle.name.empty() && | 449 if (!channel_handle.name.empty() && |
| 464 !GpuDataManager::GetInstance()->GpuAccessAllowed()) { | 450 !GpuDataManager::GetInstance()->GpuAccessAllowed()) { |
| 465 Send(new GpuMsg_CloseChannel(channel_handle)); | 451 Send(new GpuMsg_CloseChannel(channel_handle)); |
| 466 EstablishChannelError(callback.release(), | 452 EstablishChannelError(callback, |
| 467 IPC::ChannelHandle(), | 453 IPC::ChannelHandle(), |
| 468 base::kNullProcessHandle, | 454 base::kNullProcessHandle, |
| 469 content::GPUInfo()); | 455 content::GPUInfo()); |
| 470 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 456 RouteOnUIThread(GpuHostMsg_OnLogMessage( |
| 471 logging::LOG_WARNING, | 457 logging::LOG_WARNING, |
| 472 "WARNING", | 458 "WARNING", |
| 473 "Hardware acceleration is unavailable.")); | 459 "Hardware acceleration is unavailable.")); |
| 474 return; | 460 return; |
| 475 } | 461 } |
| 476 | 462 |
| 477 callback->Run( | 463 callback.Run( |
| 478 channel_handle, gpu_process_, GpuDataManager::GetInstance()->gpu_info()); | 464 channel_handle, gpu_process_, GpuDataManager::GetInstance()->gpu_info()); |
| 479 } | 465 } |
| 480 | 466 |
| 481 void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) { | 467 void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) { |
| 482 if (!create_command_buffer_requests_.empty()) { | 468 if (!create_command_buffer_requests_.empty()) { |
| 483 linked_ptr<CreateCommandBufferCallback> callback = | 469 CreateCommandBufferCallback callback = |
| 484 create_command_buffer_requests_.front(); | 470 create_command_buffer_requests_.front(); |
| 485 create_command_buffer_requests_.pop(); | 471 create_command_buffer_requests_.pop(); |
| 486 if (route_id == MSG_ROUTING_NONE) | 472 if (route_id == MSG_ROUTING_NONE) |
| 487 CreateCommandBufferError(callback.release(), route_id); | 473 CreateCommandBufferError(callback, route_id); |
| 488 else | 474 else |
| 489 callback->Run(route_id); | 475 callback.Run(route_id); |
| 490 } | 476 } |
| 491 } | 477 } |
| 492 | 478 |
| 493 void GpuProcessHost::OnDestroyCommandBuffer( | 479 void GpuProcessHost::OnDestroyCommandBuffer( |
| 494 gfx::PluginWindowHandle window, int32 renderer_id, | 480 gfx::PluginWindowHandle window, int32 renderer_id, |
| 495 int32 render_view_id) { | 481 int32 render_view_id) { |
| 496 #if defined(TOOLKIT_USES_GTK) | 482 #if defined(TOOLKIT_USES_GTK) |
| 497 ViewID view_id(renderer_id, render_view_id); | 483 ViewID view_id(renderer_id, render_view_id); |
| 498 SurfaceRefMap::iterator it = surface_refs_.find(view_id); | 484 SurfaceRefMap::iterator it = surface_refs_.find(view_id); |
| 499 if (it != surface_refs_.end()) | 485 if (it != surface_refs_.end()) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 cmd_line); | 609 cmd_line); |
| 624 | 610 |
| 625 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 611 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 626 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); | 612 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); |
| 627 return true; | 613 return true; |
| 628 } | 614 } |
| 629 | 615 |
| 630 void GpuProcessHost::SendOutstandingReplies() { | 616 void GpuProcessHost::SendOutstandingReplies() { |
| 631 // First send empty channel handles for all EstablishChannel requests. | 617 // First send empty channel handles for all EstablishChannel requests. |
| 632 while (!channel_requests_.empty()) { | 618 while (!channel_requests_.empty()) { |
| 633 linked_ptr<EstablishChannelCallback> callback = channel_requests_.front(); | 619 EstablishChannelCallback callback = channel_requests_.front(); |
| 634 channel_requests_.pop(); | 620 channel_requests_.pop(); |
| 635 EstablishChannelError(callback.release(), | 621 EstablishChannelError(callback, |
| 636 IPC::ChannelHandle(), | 622 IPC::ChannelHandle(), |
| 637 base::kNullProcessHandle, | 623 base::kNullProcessHandle, |
| 638 content::GPUInfo()); | 624 content::GPUInfo()); |
| 639 } | 625 } |
| 640 } | 626 } |
| 641 | 627 |
| 642 void GpuProcessHost::EstablishChannelError( | 628 void GpuProcessHost::EstablishChannelError( |
| 643 EstablishChannelCallback* callback, | 629 const EstablishChannelCallback& callback, |
| 644 const IPC::ChannelHandle& channel_handle, | 630 const IPC::ChannelHandle& channel_handle, |
| 645 base::ProcessHandle renderer_process_for_gpu, | 631 base::ProcessHandle renderer_process_for_gpu, |
| 646 const content::GPUInfo& gpu_info) { | 632 const content::GPUInfo& gpu_info) { |
| 647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 633 callback.Run(channel_handle, renderer_process_for_gpu, gpu_info); |
| 648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | |
| 649 } | 634 } |
| 650 | 635 |
| 651 void GpuProcessHost::CreateCommandBufferError( | 636 void GpuProcessHost::CreateCommandBufferError( |
| 652 CreateCommandBufferCallback* callback, int32 route_id) { | 637 const CreateCommandBufferCallback& callback, int32 route_id) { |
| 653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 638 callback.Run(route_id); |
| 654 wrapped_callback(callback); | |
| 655 callback->Run(route_id); | |
| 656 } | 639 } |
| OLD | NEW |