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

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

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