| OLD | NEW |
| 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/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // no longer attached to, do not pass the frame along to the widget. Just ack | 242 // no longer attached to, do not pass the frame along to the widget. Just ack |
| 243 // it to the GPU process immediately, so we can proceed to the next frame. | 243 // it to the GPU process immediately, so we can proceed to the next frame. |
| 244 bool should_not_show_frame = | 244 bool should_not_show_frame = |
| 245 content::ImageTransportFactory::GetInstance() | 245 content::ImageTransportFactory::GetInstance() |
| 246 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id); | 246 ->SurfaceShouldNotShowFramesAfterSuspendForRecycle(params.surface_id); |
| 247 if (!should_not_show_frame) { | 247 if (!should_not_show_frame) { |
| 248 gfx::AcceleratedWidget native_widget = | 248 gfx::AcceleratedWidget native_widget = |
| 249 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( | 249 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( |
| 250 params.surface_id); | 250 params.surface_id); |
| 251 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 251 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
| 252 CAContextID ca_context_id = params.ca_context_id; | |
| 253 | |
| 254 DCHECK((params.ca_context_id == 0) ^ | 252 DCHECK((params.ca_context_id == 0) ^ |
| 255 (params.io_surface.get() == MACH_PORT_NULL)); | 253 (params.io_surface.get() == MACH_PORT_NULL)); |
| 256 if (params.io_surface.get()) { | 254 if (params.io_surface.get()) { |
| 257 io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface)); | 255 io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface)); |
| 258 } | 256 } |
| 259 | 257 |
| 260 ui::AcceleratedWidgetMacGotFrame(native_widget, ca_context_id, io_surface, | 258 ui::AcceleratedWidgetMacGotFrame( |
| 261 params.size, params.scale_factor, | 259 native_widget, params.ca_context_id, io_surface, params.use_detached, |
| 262 &ack_params.vsync_timebase, | 260 params.detached_ca_context_id, params.size, params.scale_factor, |
| 263 &ack_params.vsync_interval); | 261 &ack_params.vsync_timebase, &ack_params.vsync_interval); |
| 264 } else { | 262 } else { |
| 265 TRACE_EVENT0("browser", "Skipping recycled surface frame"); | 263 TRACE_EVENT0("browser", "Skipping recycled surface frame"); |
| 266 } | 264 } |
| 267 | 265 |
| 268 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted( | 266 content::ImageTransportFactory::GetInstance()->OnGpuSwapBuffersCompleted( |
| 269 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK); | 267 params.surface_id, params.latency_info, gfx::SwapResult::SWAP_ACK); |
| 270 | 268 |
| 271 Send(new AcceleratedSurfaceMsg_BufferPresented(ack_params)); | 269 Send(new AcceleratedSurfaceMsg_BufferPresented(ack_params)); |
| 272 } | 270 } |
| 273 #endif | 271 #endif |
| (...skipping 14 matching lines...) Expand all Loading... |
| 288 | 286 |
| 289 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, | 287 void GpuProcessHostUIShim::OnRemoveSubscription(int32_t process_id, |
| 290 unsigned int target) { | 288 unsigned int target) { |
| 291 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); | 289 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); |
| 292 if (rph) { | 290 if (rph) { |
| 293 rph->OnRemoveSubscription(target); | 291 rph->OnRemoveSubscription(target); |
| 294 } | 292 } |
| 295 } | 293 } |
| 296 | 294 |
| 297 } // namespace content | 295 } // namespace content |
| OLD | NEW |