| 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/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 int32 render_view_id) { | 474 int32 render_view_id) { |
| 475 #if defined(TOOLKIT_USES_GTK) | 475 #if defined(TOOLKIT_USES_GTK) |
| 476 ViewID view_id(renderer_id, render_view_id); | 476 ViewID view_id(renderer_id, render_view_id); |
| 477 SurfaceRefMap::iterator it = surface_refs_.find(view_id); | 477 SurfaceRefMap::iterator it = surface_refs_.find(view_id); |
| 478 if (it != surface_refs_.end()) | 478 if (it != surface_refs_.end()) |
| 479 surface_refs_.erase(it); | 479 surface_refs_.erase(it); |
| 480 #endif // defined(TOOLKIT_USES_GTK) | 480 #endif // defined(TOOLKIT_USES_GTK) |
| 481 } | 481 } |
| 482 | 482 |
| 483 void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) { | 483 void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) { |
| 484 // OnGraphicsInfoCollected is sent back after the GPU process successfully |
| 485 // initializes GL. |
| 486 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); |
| 487 |
| 484 GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); | 488 GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); |
| 485 } | 489 } |
| 486 | 490 |
| 487 bool GpuProcessHost::CanShutdown() { | 491 bool GpuProcessHost::CanShutdown() { |
| 488 return true; | 492 return true; |
| 489 } | 493 } |
| 490 | 494 |
| 491 void GpuProcessHost::OnProcessLaunched() { | 495 void GpuProcessHost::OnProcessLaunched() { |
| 492 // Send the GPU process handle to the UI thread before it has to | 496 // Send the GPU process handle to the UI thread before it has to |
| 493 // respond to any requests to establish a GPU channel. The response | 497 // respond to any requests to establish a GPU channel. The response |
| 494 // to such requests require that the GPU process handle be known. | 498 // to such requests require that the GPU process handle be known. |
| 495 | 499 |
| 496 TRACE_EVENT0("test_gpu", "GpuProcessLaunched"); | |
| 497 | |
| 498 base::ProcessHandle child_handle = in_process_ ? | 500 base::ProcessHandle child_handle = in_process_ ? |
| 499 base::GetCurrentProcessHandle() : handle(); | 501 base::GetCurrentProcessHandle() : handle(); |
| 500 | 502 |
| 501 #if defined(OS_WIN) | 503 #if defined(OS_WIN) |
| 502 DuplicateHandle(base::GetCurrentProcessHandle(), | 504 DuplicateHandle(base::GetCurrentProcessHandle(), |
| 503 child_handle, | 505 child_handle, |
| 504 base::GetCurrentProcessHandle(), | 506 base::GetCurrentProcessHandle(), |
| 505 &gpu_process_, | 507 &gpu_process_, |
| 506 PROCESS_DUP_HANDLE, | 508 PROCESS_DUP_HANDLE, |
| 507 FALSE, | 509 FALSE, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 649 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
| 648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 650 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
| 649 } | 651 } |
| 650 | 652 |
| 651 void GpuProcessHost::CreateCommandBufferError( | 653 void GpuProcessHost::CreateCommandBufferError( |
| 652 CreateCommandBufferCallback* callback, int32 route_id) { | 654 CreateCommandBufferCallback* callback, int32 route_id) { |
| 653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 655 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
| 654 wrapped_callback(callback); | 656 wrapped_callback(callback); |
| 655 callback->Run(route_id); | 657 callback->Run(route_id); |
| 656 } | 658 } |
| OLD | NEW |