Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 g_hosts_by_id.Pointer()->Remove(host_id_); 166 g_hosts_by_id.Pointer()->Remove(host_id_);
167 } 167 }
168 168
169 bool GpuProcessHostUIShim::OnControlMessageReceived( 169 bool GpuProcessHostUIShim::OnControlMessageReceived(
170 const IPC::Message& message) { 170 const IPC::Message& message) {
171 DCHECK(CalledOnValidThread()); 171 DCHECK(CalledOnValidThread());
172 172
173 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 173 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
174 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 174 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
175 OnLogMessage) 175 OnLogMessage)
176 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
177 OnAcceleratedSurfaceBuffersSwapped)
178
176 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) 179 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
177 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 180 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
178 #endif 181 #endif
179 182
180 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 183 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
182 OnAcceleratedSurfaceBuffersSwapped)
183 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, 184 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
184 OnAcceleratedSurfaceNew) 185 OnAcceleratedSurfaceNew)
185 #endif 186 #endif
186 187
187 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 188 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
188 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, 189 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
189 OnAcceleratedSurfaceRelease) 190 OnAcceleratedSurfaceRelease)
190 #endif 191 #endif
192
191 IPC_MESSAGE_UNHANDLED_ERROR() 193 IPC_MESSAGE_UNHANDLED_ERROR()
192 IPC_END_MESSAGE_MAP() 194 IPC_END_MESSAGE_MAP()
193 195
194 return true; 196 return true;
195 } 197 }
196 198
197 void GpuProcessHostUIShim::OnLogMessage( 199 void GpuProcessHostUIShim::OnLogMessage(
198 int level, 200 int level,
199 const std::string& header, 201 const std::string& header,
200 const std::string& message) { 202 const std::string& message) {
201 DictionaryValue* dict = new DictionaryValue(); 203 DictionaryValue* dict = new DictionaryValue();
202 dict->SetInteger("level", level); 204 dict->SetInteger("level", level);
203 dict->SetString("header", header); 205 dict->SetString("header", header);
204 dict->SetString("message", message); 206 dict->SetString("message", message);
205 GpuDataManager::GetInstance()->AddLogMessage(dict); 207 GpuDataManager::GetInstance()->AddLogMessage(dict);
206 } 208 }
207 209
208 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) 210 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
209 211
210 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, 212 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id,
211 int32 render_view_id, 213 int32 render_view_id,
212 int32 command_buffer_route_id, 214 int32 route_id,
213 gfx::Size size) { 215 gfx::Size size) {
214 // Always respond even if the window no longer exists. The GPU process cannot 216 // Always respond even if the window no longer exists. The GPU process cannot
215 // make progress on the resizing command buffer until it receives the 217 // make progress on the resizing command buffer until it receives the
216 // response. 218 // response.
217 ScopedSendOnIOThread delayed_send( 219 ScopedSendOnIOThread delayed_send(
218 host_id_, 220 host_id_,
219 new GpuMsg_ResizeViewACK(renderer_id, 221 new AcceleratedSurfaceMsg_ResizeViewACK(route_id));
220 command_buffer_route_id));
221 222
222 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id); 223 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id);
223 if (!host) 224 if (!host)
224 return; 225 return;
225 226
226 RenderWidgetHostView* view = host->view(); 227 RenderWidgetHostView* view = host->view();
227 if (!view) 228 if (!view)
228 return; 229 return;
229 230
230 gfx::PluginWindowHandle handle = view->GetCompositingSurface(); 231 gfx::PluginWindowHandle handle = view->GetCompositingSurface();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 308 }
308 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 309 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
309 view->AcceleratedSurfaceNew( 310 view->AcceleratedSurfaceNew(
310 params.width, params.height, &surface_id, &surface_handle); 311 params.width, params.height, &surface_id, &surface_handle);
311 #endif 312 #endif
312 delayed_send.Cancel(); 313 delayed_send.Cancel();
313 Send(new AcceleratedSurfaceMsg_NewACK( 314 Send(new AcceleratedSurfaceMsg_NewACK(
314 params.route_id, surface_id, surface_handle)); 315 params.route_id, surface_id, surface_handle));
315 } 316 }
316 317
318 #endif
319
317 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( 320 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
318 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 321 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
319 TRACE_EVENT0("renderer", 322 TRACE_EVENT0("renderer",
320 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); 323 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped");
321 324
322 ScopedSendOnIOThread delayed_send( 325 ScopedSendOnIOThread delayed_send(
323 host_id_, 326 host_id_,
324 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); 327 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id));
325 328
326 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 329 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
327 params.render_view_id); 330 params.render_view_id);
328 if (!host) 331 if (!host)
329 return; 332 return;
330 333
331 RenderWidgetHostView* view = host->view(); 334 RenderWidgetHostView* view = host->view();
332 if (!view) 335 if (!view)
333 return; 336 return;
334 337
335 delayed_send.Cancel(); 338 delayed_send.Cancel();
336 339
337 #if defined (OS_MACOSX) 340 // View must send ACK message after next composite.
338 view->AcceleratedSurfaceBuffersSwapped( 341 view->AcceleratedSurfaceBuffersSwapped(params, host_id_);
339 // Parameters needed to swap the IOSurface.
340 params.window,
341 params.surface_id,
342 // Parameters needed to formulate an acknowledgment.
343 params.renderer_id,
344 params.route_id,
345 host_id_);
346 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
347 // view must send ACK message after next composite
348 view->AcceleratedSurfaceBuffersSwapped(
349 params.surface_id, params.route_id, host_id_);
350 #endif
351 } 342 }
352 343
353 #endif
354
355 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 344 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
356 345
357 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( 346 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
358 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { 347 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
359 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 348 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
360 params.render_view_id); 349 params.render_view_id);
361 if (!host) 350 if (!host)
362 return; 351 return;
363 RenderWidgetHostView* view = host->view(); 352 RenderWidgetHostView* view = host->view();
364 if (!view) 353 if (!view)
365 return; 354 return;
366 view->AcceleratedSurfaceRelease(params.identifier); 355 view->AcceleratedSurfaceRelease(params.identifier);
367 } 356 }
368 357
369 #endif 358 #endif
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/browser/renderer_host/render_widget_host_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698