| 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_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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 DCHECK(CalledOnValidThread()); | 190 DCHECK(CalledOnValidThread()); |
| 191 | 191 |
| 192 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) | 192 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) |
| 193 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, | 193 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, |
| 194 OnLogMessage) | 194 OnLogMessage) |
| 195 | 195 |
| 196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, | 196 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 197 OnAcceleratedSurfaceBuffersSwapped) | 197 OnAcceleratedSurfaceBuffersSwapped) |
| 198 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, | 198 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, |
| 199 OnAcceleratedSurfacePostSubBuffer) | 199 OnAcceleratedSurfacePostSubBuffer) |
| 200 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, |
| 201 OnGraphicsInfoCollected) |
| 200 | 202 |
| 201 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) | 203 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) |
| 202 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) | 204 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) |
| 203 #endif | 205 #endif |
| 204 | 206 |
| 205 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 207 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 206 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, | 208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, |
| 207 OnAcceleratedSurfaceNew) | 209 OnAcceleratedSurfaceNew) |
| 208 #endif | 210 #endif |
| 209 | 211 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 222 int level, | 224 int level, |
| 223 const std::string& header, | 225 const std::string& header, |
| 224 const std::string& message) { | 226 const std::string& message) { |
| 225 DictionaryValue* dict = new DictionaryValue(); | 227 DictionaryValue* dict = new DictionaryValue(); |
| 226 dict->SetInteger("level", level); | 228 dict->SetInteger("level", level); |
| 227 dict->SetString("header", header); | 229 dict->SetString("header", header); |
| 228 dict->SetString("message", message); | 230 dict->SetString("message", message); |
| 229 GpuDataManager::GetInstance()->AddLogMessage(dict); | 231 GpuDataManager::GetInstance()->AddLogMessage(dict); |
| 230 } | 232 } |
| 231 | 233 |
| 234 void GpuProcessHostUIShim::OnGraphicsInfoCollected( |
| 235 const content::GPUInfo& gpu_info) { |
| 236 // OnGraphicsInfoCollected is sent back after the GPU process successfully |
| 237 // initializes GL. |
| 238 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); |
| 239 |
| 240 GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); |
| 241 } |
| 242 |
| 232 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) | 243 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) |
| 233 | 244 |
| 234 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, | 245 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, |
| 235 int32 render_view_id, | 246 int32 render_view_id, |
| 236 int32 route_id, | 247 int32 route_id, |
| 237 gfx::Size size) { | 248 gfx::Size size) { |
| 238 // Always respond even if the window no longer exists. The GPU process cannot | 249 // Always respond even if the window no longer exists. The GPU process cannot |
| 239 // make progress on the resizing command buffer until it receives the | 250 // make progress on the resizing command buffer until it receives the |
| 240 // response. | 251 // response. |
| 241 ScopedSendOnIOThread delayed_send( | 252 ScopedSendOnIOThread delayed_send( |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( | 388 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( |
| 378 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { | 389 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { |
| 379 RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( | 390 RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( |
| 380 params.renderer_id, params.render_view_id); | 391 params.renderer_id, params.render_view_id); |
| 381 if (!view) | 392 if (!view) |
| 382 return; | 393 return; |
| 383 view->AcceleratedSurfaceRelease(params.identifier); | 394 view->AcceleratedSurfaceRelease(params.identifier); |
| 384 } | 395 } |
| 385 | 396 |
| 386 #endif | 397 #endif |
| OLD | NEW |