| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 g_hosts_by_id.Pointer()->Remove(host_id_); | 164 g_hosts_by_id.Pointer()->Remove(host_id_); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool GpuProcessHostUIShim::OnControlMessageReceived( | 167 bool GpuProcessHostUIShim::OnControlMessageReceived( |
| 168 const IPC::Message& message) { | 168 const IPC::Message& message) { |
| 169 DCHECK(CalledOnValidThread()); | 169 DCHECK(CalledOnValidThread()); |
| 170 | 170 |
| 171 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) | 171 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) |
| 172 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, | 172 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, |
| 173 OnLogMessage) | 173 OnLogMessage) |
| 174 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) | 174 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) |
| 175 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) | 175 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) |
| 176 #endif | 176 #endif |
| 177 | 177 |
| 178 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 178 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 179 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, | 179 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 180 OnAcceleratedSurfaceBuffersSwapped) | 180 OnAcceleratedSurfaceBuffersSwapped) |
| 181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, | 181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, |
| 182 OnAcceleratedSurfaceNew) | 182 OnAcceleratedSurfaceNew) |
| 183 #endif | 183 #endif |
| 184 | 184 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 196 int level, | 196 int level, |
| 197 const std::string& header, | 197 const std::string& header, |
| 198 const std::string& message) { | 198 const std::string& message) { |
| 199 DictionaryValue* dict = new DictionaryValue(); | 199 DictionaryValue* dict = new DictionaryValue(); |
| 200 dict->SetInteger("level", level); | 200 dict->SetInteger("level", level); |
| 201 dict->SetString("header", header); | 201 dict->SetString("header", header); |
| 202 dict->SetString("message", message); | 202 dict->SetString("message", message); |
| 203 GpuDataManager::GetInstance()->AddLogMessage(dict); | 203 GpuDataManager::GetInstance()->AddLogMessage(dict); |
| 204 } | 204 } |
| 205 | 205 |
| 206 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) | 206 #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) |
| 207 | 207 |
| 208 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, | 208 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, |
| 209 int32 render_view_id, | 209 int32 render_view_id, |
| 210 int32 command_buffer_route_id, | 210 int32 command_buffer_route_id, |
| 211 gfx::Size size) { | 211 gfx::Size size) { |
| 212 // Always respond even if the window no longer exists. The GPU process cannot | 212 // Always respond even if the window no longer exists. The GPU process cannot |
| 213 // make progress on the resizing command buffer until it receives the | 213 // make progress on the resizing command buffer until it receives the |
| 214 // response. | 214 // response. |
| 215 ScopedSendOnIOThread delayed_send( | 215 ScopedSendOnIOThread delayed_send( |
| 216 host_id_, | 216 host_id_, |
| 217 new GpuMsg_ResizeViewACK(renderer_id, | 217 new GpuMsg_ResizeViewACK(renderer_id, |
| 218 command_buffer_route_id)); | 218 command_buffer_route_id)); |
| 219 | 219 |
| 220 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id); | 220 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id); |
| 221 if (!host) | 221 if (!host) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 RenderWidgetHostView* view = host->view(); | 224 RenderWidgetHostView* view = host->view(); |
| 225 if (!view) | 225 if (!view) |
| 226 return; | 226 return; |
| 227 | 227 |
| 228 gfx::PluginWindowHandle handle = view->GetCompositingSurface(); | 228 gfx::PluginWindowHandle handle = view->GetCompositingSurface(); |
| 229 | 229 |
| 230 // Resize the window synchronously. The GPU process must not issue GL | 230 // Resize the window synchronously. The GPU process must not issue GL |
| 231 // calls on the command buffer until the window is the size it expects it | 231 // calls on the command buffer until the window is the size it expects it |
| 232 // to be. | 232 // to be. |
| 233 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) | 233 #if defined(TOOLKIT_USES_GTK) |
| 234 GdkWindow* window = reinterpret_cast<GdkWindow*>( | 234 GdkWindow* window = reinterpret_cast<GdkWindow*>( |
| 235 gdk_xid_table_lookup(handle)); | 235 gdk_xid_table_lookup(handle)); |
| 236 if (window) { | 236 if (window) { |
| 237 Display* display = GDK_WINDOW_XDISPLAY(window); | 237 Display* display = GDK_WINDOW_XDISPLAY(window); |
| 238 gdk_window_resize(window, size.width(), size.height()); | 238 gdk_window_resize(window, size.width(), size.height()); |
| 239 XSync(display, False); | 239 XSync(display, False); |
| 240 } | 240 } |
| 241 #elif defined(OS_WIN) | 241 #elif defined(OS_WIN) |
| 242 // Ensure window does not have zero area because D3D cannot create a zero | 242 // Ensure window does not have zero area because D3D cannot create a zero |
| 243 // area swap chain. | 243 // area swap chain. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 params.render_view_id); | 358 params.render_view_id); |
| 359 if (!host) | 359 if (!host) |
| 360 return; | 360 return; |
| 361 RenderWidgetHostView* view = host->view(); | 361 RenderWidgetHostView* view = host->view(); |
| 362 if (!view) | 362 if (!view) |
| 363 return; | 363 return; |
| 364 view->AcceleratedSurfaceRelease(params.identifier); | 364 view->AcceleratedSurfaceRelease(params.identifier); |
| 365 } | 365 } |
| 366 | 366 |
| 367 #endif | 367 #endif |
| OLD | NEW |