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

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

Issue 2511273002: Decouple BrowserCompositorOutputSurface from BeginFrameSource. (Closed)
Patch Set: Avoid duplicating code that updates VSync manager. Created 4 years 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "cc/output/output_surface_client.h" 15 #include "cc/output/output_surface_client.h"
16 #include "cc/output/output_surface_frame.h" 16 #include "cc/output/output_surface_frame.h"
17 #include "cc/output/software_output_device.h" 17 #include "cc/output/software_output_device.h"
18 #include "content/browser/renderer_host/render_widget_host_impl.h" 18 #include "content/browser/renderer_host/render_widget_host_impl.h"
19 #include "ui/events/latency_info.h" 19 #include "ui/events/latency_info.h"
20 #include "ui/gfx/vsync_provider.h" 20 #include "ui/gfx/vsync_provider.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( 24 SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface(
25 std::unique_ptr<cc::SoftwareOutputDevice> software_device, 25 std::unique_ptr<cc::SoftwareOutputDevice> software_device,
26 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, 26 const UpdateVSyncParametersCallback& update_vsync_parameters_callback,
27 cc::SyntheticBeginFrameSource* begin_frame_source,
28 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 27 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
29 : BrowserCompositorOutputSurface(std::move(software_device), 28 : BrowserCompositorOutputSurface(std::move(software_device),
30 vsync_manager, 29 update_vsync_parameters_callback),
31 begin_frame_source),
32 task_runner_(std::move(task_runner)), 30 task_runner_(std::move(task_runner)),
33 weak_factory_(this) {} 31 weak_factory_(this) {}
34 32
35 SoftwareBrowserCompositorOutputSurface:: 33 SoftwareBrowserCompositorOutputSurface::
36 ~SoftwareBrowserCompositorOutputSurface() { 34 ~SoftwareBrowserCompositorOutputSurface() {
37 } 35 }
38 36
39 void SoftwareBrowserCompositorOutputSurface::BindToClient( 37 void SoftwareBrowserCompositorOutputSurface::BindToClient(
40 cc::OutputSurfaceClient* client) { 38 cc::OutputSurfaceClient* client) {
41 DCHECK(client); 39 DCHECK(client);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 73 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
76 swap_time, 1); 74 swap_time, 1);
77 } 75 }
78 task_runner_->PostTask(FROM_HERE, 76 task_runner_->PostTask(FROM_HERE,
79 base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, 77 base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn,
80 frame.latency_info)); 78 frame.latency_info));
81 79
82 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider(); 80 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider();
83 if (vsync_provider) { 81 if (vsync_provider) {
84 vsync_provider->GetVSyncParameters(base::Bind( 82 vsync_provider->GetVSyncParameters(base::Bind(
85 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu, 83 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu,
danakj 2016/11/30 23:49:05 This is going to the base class just to call anoth
stanisc 2016/12/02 19:50:43 Done.
86 weak_factory_.GetWeakPtr())); 84 weak_factory_.GetWeakPtr()));
87 } 85 }
88 86
89 task_runner_->PostTask( 87 task_runner_->PostTask(
90 FROM_HERE, 88 FROM_HERE,
91 base::Bind(&SoftwareBrowserCompositorOutputSurface::SwapBuffersCallback, 89 base::Bind(&SoftwareBrowserCompositorOutputSurface::SwapBuffersCallback,
92 weak_factory_.GetWeakPtr())); 90 weak_factory_.GetWeakPtr()));
93 } 91 }
94 92
95 void SoftwareBrowserCompositorOutputSurface::SwapBuffersCallback() { 93 void SoftwareBrowserCompositorOutputSurface::SwapBuffersCallback() {
(...skipping 20 matching lines...) Expand all
116 return 0; 114 return 0;
117 } 115 }
118 116
119 #if defined(OS_MACOSX) 117 #if defined(OS_MACOSX)
120 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( 118 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
121 bool suspended) { 119 bool suspended) {
122 } 120 }
123 #endif 121 #endif
124 122
125 } // namespace content 123 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698