OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/aura/software_browser_compositor_output_surface.h" | 5 #include "content/browser/aura/software_browser_compositor_output_surface.h" |
6 | 6 |
| 7 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
9 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
| 12 #include "content/browser/aura/browser_compositor_output_surface_proxy.h" |
11 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
12 #include "ui/events/latency_info.h" | 14 #include "ui/events/latency_info.h" |
| 15 #include "ui/gl/vsync_provider.h" |
13 | 16 |
14 namespace content { | 17 namespace content { |
15 | 18 |
16 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( | 19 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( |
17 scoped_ptr<cc::SoftwareOutputDevice> software_device) | 20 scoped_refptr<BrowserCompositorOutputSurfaceProxy> surface_proxy, |
18 : cc::OutputSurface(software_device.Pass()) {} | 21 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| 22 int surface_id, |
| 23 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
| 24 base::MessageLoopProxy* compositor_message_loop, |
| 25 base::WeakPtr<ui::Compositor> compositor) |
| 26 : BrowserCompositorOutputSurface(software_device.Pass(), |
| 27 surface_id, |
| 28 output_surface_map, |
| 29 compositor_message_loop, |
| 30 compositor), |
| 31 output_surface_proxy_(surface_proxy) {} |
| 32 |
| 33 SoftwareBrowserCompositorOutputSurface:: |
| 34 ~SoftwareBrowserCompositorOutputSurface() {} |
19 | 35 |
20 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( | 36 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( |
21 cc::CompositorFrame* frame) { | 37 cc::CompositorFrame* frame) { |
22 ui::LatencyInfo latency_info = frame->metadata.latency_info; | 38 ui::LatencyInfo latency_info = frame->metadata.latency_info; |
23 latency_info.AddLatencyNumber( | 39 latency_info.AddLatencyNumber( |
24 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); | 40 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
25 | 41 |
26 base::MessageLoop::current()->PostTask( | 42 base::MessageLoop::current()->PostTask( |
27 FROM_HERE, | 43 FROM_HERE, |
28 base::Bind( | 44 base::Bind( |
29 &RenderWidgetHostImpl::CompositorFrameDrawn, | 45 &RenderWidgetHostImpl::CompositorFrameDrawn, |
30 latency_info)); | 46 latency_info)); |
| 47 |
| 48 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider(); |
| 49 if (vsync_provider) { |
| 50 vsync_provider->GetVSyncParameters( |
| 51 base::Bind(&BrowserCompositorOutputSurfaceProxy:: |
| 52 OnUpdateVSyncParametersOnCompositorThread, |
| 53 output_surface_proxy_, |
| 54 surface_id_)); |
| 55 } |
31 } | 56 } |
32 | 57 |
33 } // namespace content | 58 } // namespace content |
OLD | NEW |