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

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

Issue 615503004: Remove TextureImageTransportSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOTREACHED -> NOTIMPLEMENTED Created 6 years, 2 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 g_hosts_by_id.Pointer()->Remove(host_id_); 197 g_hosts_by_id.Pointer()->Remove(host_id_);
198 } 198 }
199 199
200 bool GpuProcessHostUIShim::OnControlMessageReceived( 200 bool GpuProcessHostUIShim::OnControlMessageReceived(
201 const IPC::Message& message) { 201 const IPC::Message& message) {
202 DCHECK(CalledOnValidThread()); 202 DCHECK(CalledOnValidThread());
203 203
204 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 204 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
205 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 205 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
206 OnLogMessage) 206 OnLogMessage)
207
208 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceInitialized, 207 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceInitialized,
209 OnAcceleratedSurfaceInitialized) 208 OnAcceleratedSurfaceInitialized)
210 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 209 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
211 OnAcceleratedSurfaceBuffersSwapped) 210 OnAcceleratedSurfaceBuffersSwapped)
212 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
213 OnAcceleratedSurfacePostSubBuffer)
214 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend,
215 OnAcceleratedSurfaceSuspend)
216 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, 211 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected,
217 OnGraphicsInfoCollected) 212 OnGraphicsInfoCollected)
218 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
219 OnAcceleratedSurfaceRelease)
220 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, 213 IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats,
221 OnVideoMemoryUsageStatsReceived); 214 OnVideoMemoryUsageStatsReceived);
222 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) 215 IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn)
223 216
224 IPC_MESSAGE_UNHANDLED_ERROR() 217 IPC_MESSAGE_UNHANDLED_ERROR()
225 IPC_END_MESSAGE_MAP() 218 IPC_END_MESSAGE_MAP()
226 219
227 return true; 220 return true;
228 } 221 }
229 222
(...skipping 13 matching lines...) Expand all
243 236
244 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 237 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
245 } 238 }
246 239
247 void GpuProcessHostUIShim::OnAcceleratedSurfaceInitialized(int32 surface_id, 240 void GpuProcessHostUIShim::OnAcceleratedSurfaceInitialized(int32 surface_id,
248 int32 route_id) { 241 int32 route_id) {
249 RenderWidgetHostViewBase* view = 242 RenderWidgetHostViewBase* view =
250 GetRenderWidgetHostViewFromSurfaceID(surface_id); 243 GetRenderWidgetHostViewFromSurfaceID(surface_id);
251 if (!view) 244 if (!view)
252 return; 245 return;
253 view->AcceleratedSurfaceInitialized(host_id_, route_id); 246 view->AcceleratedSurfaceInitialized(route_id);
254 } 247 }
255 248
256 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( 249 void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
257 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 250 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
251 #if defined(OS_MACOSX)
258 TRACE_EVENT0("renderer", 252 TRACE_EVENT0("renderer",
259 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped"); 253 "GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped");
260 if (!ui::LatencyInfo::Verify(params.latency_info, 254 if (!ui::LatencyInfo::Verify(params.latency_info,
261 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) 255 "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) {
262 return; 256 return;
257 }
263 258
264 #if defined(OS_MACOSX)
265 // On Mac with delegated rendering, accelerated surfaces are not necessarily 259 // On Mac with delegated rendering, accelerated surfaces are not necessarily
266 // associated with a RenderWidgetHostViewBase. 260 // associated with a RenderWidgetHostViewBase.
267 if (IsDelegatedRendererEnabled()) { 261 DCHECK(IsDelegatedRendererEnabled());
268 gfx::AcceleratedWidget native_widget = 262 gfx::AcceleratedWidget native_widget =
269 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( 263 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id);
270 params.surface_id); 264 BrowserCompositorViewMac::GotAcceleratedFrame(native_widget,
271 BrowserCompositorViewMac::GotAcceleratedFrame( 265 params.surface_handle,
272 native_widget, params.surface_handle, params.surface_id, 266 params.surface_id,
273 params.latency_info, params.size, params.scale_factor, 267 params.latency_info,
274 host_id_, params.route_id); 268 params.size,
275 return; 269 params.scale_factor,
276 } 270 host_id_,
271 params.route_id);
272 #else
273 NOTREACHED();
277 #endif 274 #endif
278
279 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
280 ack_params.mailbox = params.mailbox;
281 ack_params.sync_point = 0;
282 ScopedSendOnIOThread delayed_send(
283 host_id_,
284 new AcceleratedSurfaceMsg_BufferPresented(params.route_id,
285 ack_params));
286
287 RenderWidgetHostViewBase* view = GetRenderWidgetHostViewFromSurfaceID(
288 params.surface_id);
289 if (!view)
290 return;
291
292 delayed_send.Cancel();
293
294 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params view_params = params;
295
296 RenderWidgetHostImpl* impl =
297 RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
298 for (size_t i = 0; i < view_params.latency_info.size(); i++)
299 impl->AddLatencyInfoComponentIds(&view_params.latency_info[i]);
300
301 // View must send ACK message after next composite.
302 view->AcceleratedSurfaceBuffersSwapped(view_params, host_id_);
303 view->DidReceiveRendererFrame();
304 } 275 }
305 276
306 void GpuProcessHostUIShim::OnFrameDrawn( 277 void GpuProcessHostUIShim::OnFrameDrawn(
307 const std::vector<ui::LatencyInfo>& latency_info) { 278 const std::vector<ui::LatencyInfo>& latency_info) {
308 if (!ui::LatencyInfo::Verify(latency_info, 279 if (!ui::LatencyInfo::Verify(latency_info,
309 "GpuProcessHostUIShim::OnFrameDrawn")) 280 "GpuProcessHostUIShim::OnFrameDrawn"))
310 return; 281 return;
311 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 282 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
312 } 283 }
313 284
314 void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer(
315 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
316 TRACE_EVENT0("renderer",
317 "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer");
318 if (!ui::LatencyInfo::Verify(params.latency_info,
319 "GpuHostMsg_AcceleratedSurfacePostSubBuffer"))
320 return;
321 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
322 ack_params.mailbox = params.mailbox;
323 ack_params.sync_point = 0;
324 ScopedSendOnIOThread delayed_send(
325 host_id_,
326 new AcceleratedSurfaceMsg_BufferPresented(params.route_id,
327 ack_params));
328
329 RenderWidgetHostViewBase* view =
330 GetRenderWidgetHostViewFromSurfaceID(params.surface_id);
331 if (!view)
332 return;
333
334 delayed_send.Cancel();
335
336 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params view_params = params;
337
338 RenderWidgetHostImpl* impl =
339 RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
340 for (size_t i = 0; i < view_params.latency_info.size(); i++)
341 impl->AddLatencyInfoComponentIds(&view_params.latency_info[i]);
342
343 // View must send ACK message after next composite.
344 view->AcceleratedSurfacePostSubBuffer(view_params, host_id_);
345 view->DidReceiveRendererFrame();
346 }
347
348 void GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend(int32 surface_id) {
349 TRACE_EVENT0("renderer",
350 "GpuProcessHostUIShim::OnAcceleratedSurfaceSuspend");
351
352 RenderWidgetHostViewBase* view =
353 GetRenderWidgetHostViewFromSurfaceID(surface_id);
354 if (!view)
355 return;
356
357 view->AcceleratedSurfaceSuspend();
358 }
359
360 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
361 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
362 RenderWidgetHostViewBase* view = GetRenderWidgetHostViewFromSurfaceID(
363 params.surface_id);
364 if (!view)
365 return;
366 view->AcceleratedSurfaceRelease();
367 }
368
369 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( 285 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
370 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { 286 const GPUVideoMemoryUsageStats& video_memory_usage_stats) {
371 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( 287 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
372 video_memory_usage_stats); 288 video_memory_usage_stats);
373 } 289 }
374 290
375 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/browser/renderer_host/render_widget_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698