| 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_process_host.h" | 5 #include "content/browser/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 10 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 11 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
| 12 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
| 15 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
| 16 #include "content/browser/gpu_data_manager.h" | 17 #include "content/browser/gpu_data_manager.h" |
| 17 #include "content/browser/gpu_process_host_ui_shim.h" | 18 #include "content/browser/gpu_process_host_ui_shim.h" |
| 18 #include "content/browser/renderer_host/render_widget_host.h" | 19 #include "content/browser/renderer_host/render_widget_host.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view.h" | 20 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 20 #include "content/common/gpu/gpu_messages.h" | 21 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "gpu/common/gpu_trace_event.h" | |
| 22 #include "ipc/ipc_channel_handle.h" | 22 #include "ipc/ipc_channel_handle.h" |
| 23 #include "ipc/ipc_switches.h" | 23 #include "ipc/ipc_switches.h" |
| 24 #include "media/base/media_switches.h" | 24 #include "media/base/media_switches.h" |
| 25 #include "ui/gfx/gl/gl_context.h" | 25 #include "ui/gfx/gl/gl_context.h" |
| 26 #include "ui/gfx/gl/gl_switches.h" | 26 #include "ui/gfx/gl/gl_switches.h" |
| 27 | 27 |
| 28 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
| 29 #include "ui/gfx/gtk_native_view_id_manager.h" | 29 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 30 #endif // defined(OS_LINUX) | 30 #endif // defined(OS_LINUX) |
| 31 | 31 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 while (!queued_messages_.empty()) { | 279 while (!queued_messages_.empty()) { |
| 280 Send(queued_messages_.front()); | 280 Send(queued_messages_.front()); |
| 281 queued_messages_.pop(); | 281 queued_messages_.pop(); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 void GpuProcessHost::EstablishGpuChannel( | 285 void GpuProcessHost::EstablishGpuChannel( |
| 286 int renderer_id, | 286 int renderer_id, |
| 287 EstablishChannelCallback *callback) { | 287 EstablishChannelCallback *callback) { |
| 288 DCHECK(CalledOnValidThread()); | 288 DCHECK(CalledOnValidThread()); |
| 289 GPU_TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); | 289 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); |
| 290 linked_ptr<EstablishChannelCallback> wrapped_callback(callback); | 290 linked_ptr<EstablishChannelCallback> wrapped_callback(callback); |
| 291 | 291 |
| 292 // If GPU features are already blacklisted, no need to establish the channel. | 292 // If GPU features are already blacklisted, no need to establish the channel. |
| 293 if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) { | 293 if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) { |
| 294 EstablishChannelError( | 294 EstablishChannelError( |
| 295 wrapped_callback.release(), IPC::ChannelHandle(), | 295 wrapped_callback.release(), IPC::ChannelHandle(), |
| 296 base::kNullProcessHandle, GPUInfo()); | 296 base::kNullProcessHandle, GPUInfo()); |
| 297 return; | 297 return; |
| 298 } | 298 } |
| 299 | 299 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 CreateCommandBufferCallback* callback, int32 route_id) { | 559 CreateCommandBufferCallback* callback, int32 route_id) { |
| 560 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 560 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
| 561 wrapped_callback(callback); | 561 wrapped_callback(callback); |
| 562 callback->Run(route_id); | 562 callback->Run(route_id); |
| 563 } | 563 } |
| 564 | 564 |
| 565 void GpuProcessHost::SynchronizeError(SynchronizeCallback* callback) { | 565 void GpuProcessHost::SynchronizeError(SynchronizeCallback* callback) { |
| 566 scoped_ptr<SynchronizeCallback> wrapped_callback(callback); | 566 scoped_ptr<SynchronizeCallback> wrapped_callback(callback); |
| 567 wrapped_callback->Run(); | 567 wrapped_callback->Run(); |
| 568 } | 568 } |
| OLD | NEW |