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

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

Issue 8625003: Revert 111040 - Reland 110355 - Use shared D3D9 texture to transport the compositor's backing buf... (Closed) Base URL: svn://svn.chromium.org/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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
175 OnAcceleratedSurfaceBuffersSwapped)
176
177 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) 174 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
178 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView) 175 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
179 #endif 176 #endif
180 177
181 #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,
180 OnAcceleratedSurfaceBuffersSwapped)
182 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew, 181 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
183 OnAcceleratedSurfaceNew) 182 OnAcceleratedSurfaceNew)
184 #endif 183 #endif
185 184
186 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 185 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
187 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease, 186 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
188 OnAcceleratedSurfaceRelease) 187 OnAcceleratedSurfaceRelease)
189 #endif 188 #endif
190
191 IPC_MESSAGE_UNHANDLED_ERROR() 189 IPC_MESSAGE_UNHANDLED_ERROR()
192 IPC_END_MESSAGE_MAP() 190 IPC_END_MESSAGE_MAP()
193 191
194 return true; 192 return true;
195 } 193 }
196 194
197 void GpuProcessHostUIShim::OnLogMessage( 195 void GpuProcessHostUIShim::OnLogMessage(
198 int level, 196 int level,
199 const std::string& header, 197 const std::string& header,
200 const std::string& message) { 198 const std::string& message) {
201 DictionaryValue* dict = new DictionaryValue(); 199 DictionaryValue* dict = new DictionaryValue();
202 dict->SetInteger("level", level); 200 dict->SetInteger("level", level);
203 dict->SetString("header", header); 201 dict->SetString("header", header);
204 dict->SetString("message", message); 202 dict->SetString("message", message);
205 GpuDataManager::GetInstance()->AddLogMessage(dict); 203 GpuDataManager::GetInstance()->AddLogMessage(dict);
206 } 204 }
207 205
208 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) 206 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
209 207
210 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, 208 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id,
211 int32 render_view_id, 209 int32 render_view_id,
212 int32 route_id, 210 int32 command_buffer_route_id,
213 gfx::Size size) { 211 gfx::Size size) {
214 // 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
215 // make progress on the resizing command buffer until it receives the 213 // make progress on the resizing command buffer until it receives the
216 // response. 214 // response.
217 ScopedSendOnIOThread delayed_send( 215 ScopedSendOnIOThread delayed_send(
218 host_id_, 216 host_id_,
219 new AcceleratedSurfaceMsg_ResizeViewACK(route_id)); 217 new GpuMsg_ResizeViewACK(renderer_id,
218 command_buffer_route_id));
220 219
221 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id); 220 RenderViewHost* host = RenderViewHost::FromID(renderer_id, render_view_id);
222 if (!host) 221 if (!host)
223 return; 222 return;
224 223
225 RenderWidgetHostView* view = host->view(); 224 RenderWidgetHostView* view = host->view();
226 if (!view) 225 if (!view)
227 return; 226 return;
228 227
229 gfx::PluginWindowHandle handle = view->GetCompositingSurface(); 228 gfx::PluginWindowHandle handle = view->GetCompositingSurface();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 305 }
307 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 306 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
308 view->AcceleratedSurfaceNew( 307 view->AcceleratedSurfaceNew(
309 params.width, params.height, &surface_id, &surface_handle); 308 params.width, params.height, &surface_id, &surface_handle);
310 #endif 309 #endif
311 delayed_send.Cancel(); 310 delayed_send.Cancel();
312 Send(new AcceleratedSurfaceMsg_NewACK( 311 Send(new AcceleratedSurfaceMsg_NewACK(
313 params.route_id, surface_id, surface_handle)); 312 params.route_id, surface_id, surface_handle));
314 } 313 }
315 314
316 #endif
317
318 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( 315 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
319 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 316 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
320 TRACE_EVENT0("renderer", 317 TRACE_EVENT0("renderer",
321 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); 318 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped");
322 319
323 ScopedSendOnIOThread delayed_send( 320 ScopedSendOnIOThread delayed_send(
324 host_id_, 321 host_id_,
325 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); 322 new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id));
326 323
327 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 324 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
328 params.render_view_id); 325 params.render_view_id);
329 if (!host) 326 if (!host)
330 return; 327 return;
331 328
332 RenderWidgetHostView* view = host->view(); 329 RenderWidgetHostView* view = host->view();
333 if (!view) 330 if (!view)
334 return; 331 return;
335 332
336 delayed_send.Cancel(); 333 delayed_send.Cancel();
337 334
338 // View must send ACK message after next composite. 335 #if defined (OS_MACOSX)
339 view->AcceleratedSurfaceBuffersSwapped(params, host_id_); 336 view->AcceleratedSurfaceBuffersSwapped(
337 // Parameters needed to swap the IOSurface.
338 params.window,
339 params.surface_id,
340 // Parameters needed to formulate an acknowledgment.
341 params.renderer_id,
342 params.route_id,
343 host_id_);
344 #else // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
345 // view must send ACK message after next composite
346 view->AcceleratedSurfaceBuffersSwapped(
347 params.surface_id, params.route_id, host_id_);
348 #endif
340 } 349 }
341 350
351 #endif
352
342 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 353 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
343 354
344 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( 355 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
345 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { 356 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
346 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 357 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
347 params.render_view_id); 358 params.render_view_id);
348 if (!host) 359 if (!host)
349 return; 360 return;
350 RenderWidgetHostView* view = host->view(); 361 RenderWidgetHostView* view = host->view();
351 if (!view) 362 if (!view)
352 return; 363 return;
353 view->AcceleratedSurfaceRelease(params.identifier); 364 view->AcceleratedSurfaceRelease(params.identifier);
354 } 365 }
355 366
356 #endif 367 #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