OLD | NEW |
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_ui_shim.h" | 5 #include "chrome/browser/gpu_process_host_ui_shim.h" |
6 | 6 |
7 #include "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
8 #include "chrome/browser/gpu_process_host.h" | 8 #include "chrome/browser/gpu_process_host.h" |
9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
10 #include "chrome/common/child_process_logging.h" | 10 #include "chrome/common/child_process_logging.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 const GPUInfo& GpuProcessHostUIShim::gpu_info() const { | 99 const GPUInfo& GpuProcessHostUIShim::gpu_info() const { |
100 DCHECK(CalledOnValidThread()); | 100 DCHECK(CalledOnValidThread()); |
101 return gpu_info_; | 101 return gpu_info_; |
102 } | 102 } |
103 | 103 |
104 void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { | 104 void GpuProcessHostUIShim::OnGraphicsInfoCollected(const GPUInfo& gpu_info) { |
105 gpu_info_ = gpu_info; | 105 gpu_info_ = gpu_info; |
106 child_process_logging::SetGpuInfo(gpu_info); | 106 child_process_logging::SetGpuInfo(gpu_info); |
| 107 |
| 108 // Used only in testing. |
| 109 if (gpu_info_collected_callback_.get()) |
| 110 gpu_info_collected_callback_->Run(); |
107 } | 111 } |
108 | 112 |
109 void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id, | 113 void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id, |
110 int render_view_id) { | 114 int render_view_id) { |
111 RenderViewHost* host = RenderViewHost::FromID(renderer_id, | 115 RenderViewHost* host = RenderViewHost::FromID(renderer_id, |
112 render_view_id); | 116 render_view_id); |
113 if (!host) { | 117 if (!host) { |
114 return; | 118 return; |
115 } | 119 } |
116 host->ScheduleComposite(); | 120 host->ScheduleComposite(); |
117 } | 121 } |
118 void GpuProcessHostUIShim::OnControlMessageReceived( | 122 void GpuProcessHostUIShim::OnControlMessageReceived( |
119 const IPC::Message& message) { | 123 const IPC::Message& message) { |
120 DCHECK(CalledOnValidThread()); | 124 DCHECK(CalledOnValidThread()); |
121 | 125 |
122 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) | 126 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) |
123 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | 127 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, |
124 OnGraphicsInfoCollected) | 128 OnGraphicsInfoCollected) |
125 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
126 IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, | 130 IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, |
127 OnScheduleComposite); | 131 OnScheduleComposite); |
128 #endif | 132 #endif |
129 IPC_MESSAGE_UNHANDLED_ERROR() | 133 IPC_MESSAGE_UNHANDLED_ERROR() |
130 IPC_END_MESSAGE_MAP() | 134 IPC_END_MESSAGE_MAP() |
131 } | 135 } |
OLD | NEW |