OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ui_shim.h" | 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | 189 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, |
190 OnGraphicsInfoCollected) | 190 OnGraphicsInfoCollected) |
191 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, | 191 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, |
192 OnAcceleratedSurfaceRelease) | 192 OnAcceleratedSurfaceRelease) |
193 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, | 193 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, |
194 OnVideoMemoryUsageStatsReceived); | 194 OnVideoMemoryUsageStatsReceived); |
195 IPC_MESSAGE_HANDLER(GpuHostMsg_UpdateVSyncParameters, | 195 IPC_MESSAGE_HANDLER(GpuHostMsg_UpdateVSyncParameters, |
196 OnUpdateVSyncParameters) | 196 OnUpdateVSyncParameters) |
197 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) | 197 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) |
198 | 198 |
199 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) | |
200 | |
201 IPC_MESSAGE_UNHANDLED_ERROR() | 199 IPC_MESSAGE_UNHANDLED_ERROR() |
202 IPC_END_MESSAGE_MAP() | 200 IPC_END_MESSAGE_MAP() |
203 | 201 |
204 return true; | 202 return true; |
205 } | 203 } |
206 | 204 |
207 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id, | 205 void GpuProcessHostUIShim::OnUpdateVSyncParameters(int surface_id, |
208 base::TimeTicks timebase, | 206 base::TimeTicks timebase, |
209 base::TimeDelta interval) { | 207 base::TimeDelta interval) { |
210 | 208 |
(...skipping 20 matching lines...) Expand all Loading... |
231 | 229 |
232 void GpuProcessHostUIShim::OnGraphicsInfoCollected( | 230 void GpuProcessHostUIShim::OnGraphicsInfoCollected( |
233 const gpu::GPUInfo& gpu_info) { | 231 const gpu::GPUInfo& gpu_info) { |
234 // OnGraphicsInfoCollected is sent back after the GPU process successfully | 232 // OnGraphicsInfoCollected is sent back after the GPU process successfully |
235 // initializes GL. | 233 // initializes GL. |
236 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | 234 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); |
237 | 235 |
238 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 236 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
239 } | 237 } |
240 | 238 |
241 void GpuProcessHostUIShim::OnResizeView(int32 surface_id, | |
242 int32 route_id, | |
243 gfx::Size size) { | |
244 // Always respond even if the window no longer exists. The GPU process cannot | |
245 // make progress on the resizing command buffer until it receives the | |
246 // response. | |
247 ScopedSendOnIOThread delayed_send( | |
248 host_id_, | |
249 new AcceleratedSurfaceMsg_ResizeViewACK(route_id)); | |
250 | |
251 RenderWidgetHostViewPort* view = | |
252 GetRenderWidgetHostViewFromSurfaceID(surface_id); | |
253 if (!view) | |
254 return; | |
255 | |
256 view->ResizeCompositingSurface(size); | |
257 } | |
258 | |
259 void GpuProcessHostUIShim::OnAcceleratedSurfaceInitialized(int32 surface_id, | 239 void GpuProcessHostUIShim::OnAcceleratedSurfaceInitialized(int32 surface_id, |
260 int32 route_id) { | 240 int32 route_id) { |
261 RenderWidgetHostViewPort* view = | 241 RenderWidgetHostViewPort* view = |
262 GetRenderWidgetHostViewFromSurfaceID(surface_id); | 242 GetRenderWidgetHostViewFromSurfaceID(surface_id); |
263 if (!view) | 243 if (!view) |
264 return; | 244 return; |
265 view->AcceleratedSurfaceInitialized(host_id_, route_id); | 245 view->AcceleratedSurfaceInitialized(host_id_, route_id); |
266 } | 246 } |
267 | 247 |
268 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( | 248 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 view->AcceleratedSurfaceRelease(); | 342 view->AcceleratedSurfaceRelease(); |
363 } | 343 } |
364 | 344 |
365 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 345 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
366 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 346 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
367 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 347 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
368 video_memory_usage_stats); | 348 video_memory_usage_stats); |
369 } | 349 } |
370 | 350 |
371 } // namespace content | 351 } // namespace content |
OLD | NEW |