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

Side by Side Diff: content/browser/compositor/software_browser_compositor_output_surface.cc

Issue 161413002: Revert of Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/software_browser_compositor_output_surface. h" 5 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/software_output_device.h" 11 #include "cc/output/software_output_device.h"
12 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" 12 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 13 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "ui/events/latency_info.h" 14 #include "ui/events/latency_info.h"
15 #include "ui/gfx/vsync_provider.h" 15 #include "ui/gfx/vsync_provider.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( 19 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface(
20 scoped_refptr<BrowserCompositorOutputSurfaceProxy> surface_proxy, 20 scoped_refptr<BrowserCompositorOutputSurfaceProxy> surface_proxy,
21 scoped_ptr<cc::SoftwareOutputDevice> software_device, 21 scoped_ptr<cc::SoftwareOutputDevice> software_device,
22 int surface_id, 22 int surface_id,
23 IDMap<BrowserCompositorOutputSurface>* output_surface_map, 23 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
24 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) 24 base::MessageLoopProxy* compositor_message_loop,
25 base::WeakPtr<ui::Compositor> compositor)
25 : BrowserCompositorOutputSurface(software_device.Pass(), 26 : BrowserCompositorOutputSurface(software_device.Pass(),
26 surface_id, 27 surface_id,
27 output_surface_map, 28 output_surface_map,
28 vsync_manager), 29 compositor_message_loop,
30 compositor),
29 output_surface_proxy_(surface_proxy) {} 31 output_surface_proxy_(surface_proxy) {}
30 32
31 SoftwareBrowserCompositorOutputSurface:: 33 SoftwareBrowserCompositorOutputSurface::
32 ~SoftwareBrowserCompositorOutputSurface() {} 34 ~SoftwareBrowserCompositorOutputSurface() {}
33 35
34 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( 36 void SoftwareBrowserCompositorOutputSurface::SwapBuffers(
35 cc::CompositorFrame* frame) { 37 cc::CompositorFrame* frame) {
36 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) { 38 for (size_t i = 0; i < frame->metadata.latency_info.size(); i++) {
37 frame->metadata.latency_info[i].AddLatencyNumber( 39 frame->metadata.latency_info[i].AddLatencyNumber(
38 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); 40 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
39 } 41 }
40 base::MessageLoop::current()->PostTask( 42 base::MessageLoop::current()->PostTask(
41 FROM_HERE, 43 FROM_HERE,
42 base::Bind( 44 base::Bind(
43 &RenderWidgetHostImpl::CompositorFrameDrawn, 45 &RenderWidgetHostImpl::CompositorFrameDrawn,
44 frame->metadata.latency_info)); 46 frame->metadata.latency_info));
45 47
46 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider(); 48 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider();
47 if (vsync_provider) { 49 if (vsync_provider) {
48 vsync_provider->GetVSyncParameters( 50 vsync_provider->GetVSyncParameters(
49 base::Bind(&BrowserCompositorOutputSurfaceProxy:: 51 base::Bind(&BrowserCompositorOutputSurfaceProxy::
50 OnUpdateVSyncParametersOnCompositorThread, 52 OnUpdateVSyncParametersOnCompositorThread,
51 output_surface_proxy_, 53 output_surface_proxy_,
52 surface_id_)); 54 surface_id_));
53 } 55 }
54 } 56 }
55 57
56 } // namespace content 58 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698