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

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

Issue 1124523003: Revert of Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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/browser_compositor_output_surface.h" 5 #include "content/browser/compositor/browser_compositor_output_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" 10 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h"
11 #include "content/browser/compositor/reflector_impl.h" 11 #include "content/browser/compositor/reflector_impl.h"
12 #include "content/common/gpu/client/context_provider_command_buffer.h" 12 #include "content/common/gpu/client/context_provider_command_buffer.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( 16 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
17 const scoped_refptr<cc::ContextProvider>& context_provider, 17 const scoped_refptr<cc::ContextProvider>& context_provider,
18 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
18 scoped_ptr<BrowserCompositorOverlayCandidateValidator> 19 scoped_ptr<BrowserCompositorOverlayCandidateValidator>
19 overlay_candidate_validator) 20 overlay_candidate_validator)
20 : OutputSurface(context_provider), 21 : OutputSurface(context_provider),
22 vsync_manager_(vsync_manager),
21 reflector_(nullptr) { 23 reflector_(nullptr) {
22 overlay_candidate_validator_ = overlay_candidate_validator.Pass(); 24 overlay_candidate_validator_ = overlay_candidate_validator.Pass();
23 Initialize(); 25 Initialize();
24 } 26 }
25 27
26 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( 28 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
27 scoped_ptr<cc::SoftwareOutputDevice> software_device) 29 scoped_ptr<cc::SoftwareOutputDevice> software_device,
30 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
28 : OutputSurface(software_device.Pass()), 31 : OutputSurface(software_device.Pass()),
32 vsync_manager_(vsync_manager),
29 reflector_(nullptr) { 33 reflector_(nullptr) {
30 Initialize(); 34 Initialize();
31 } 35 }
32 36
33 BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() { 37 BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() {
34 if (reflector_) 38 if (reflector_)
35 reflector_->DetachFromOutputSurface(); 39 reflector_->DetachFromOutputSurface();
36 DCHECK(!reflector_); 40 DCHECK(!reflector_);
41 if (!HasClient())
42 return;
43 vsync_manager_->RemoveObserver(this);
37 } 44 }
38 45
39 void BrowserCompositorOutputSurface::Initialize() { 46 void BrowserCompositorOutputSurface::Initialize() {
40 capabilities_.max_frames_pending = 1; 47 capabilities_.max_frames_pending = 1;
41 capabilities_.adjust_deadline_for_parent = false; 48 capabilities_.adjust_deadline_for_parent = false;
42 } 49 }
43 50
51 bool BrowserCompositorOutputSurface::BindToClient(
52 cc::OutputSurfaceClient* client) {
53 if (!OutputSurface::BindToClient(client))
54 return false;
55 // Don't want vsync notifications until there is a client.
56 vsync_manager_->AddObserver(this);
57 return true;
58 }
59
60 void BrowserCompositorOutputSurface::OnUpdateVSyncParameters(
61 base::TimeTicks timebase,
62 base::TimeDelta interval) {
63 DCHECK(HasClient());
64 CommitVSyncParameters(timebase, interval);
65 }
66
44 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( 67 void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu(
45 base::TimeTicks timebase, 68 base::TimeTicks timebase,
46 base::TimeDelta interval) { 69 base::TimeDelta interval) {
47 DCHECK(HasClient()); 70 DCHECK(HasClient());
48 CommitVSyncParameters(timebase, interval); 71 vsync_manager_->UpdateVSyncParameters(timebase, interval);
49 } 72 }
50 73
51 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { 74 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) {
52 // Software mirroring is done by doing a GL copy out of the framebuffer - if 75 // Software mirroring is done by doing a GL copy out of the framebuffer - if
53 // we have overlays then that data will be missing. 76 // we have overlays then that data will be missing.
54 if (overlay_candidate_validator_) { 77 if (overlay_candidate_validator_) {
55 overlay_candidate_validator_->SetSoftwareMirrorMode(reflector != nullptr); 78 overlay_candidate_validator_->SetSoftwareMirrorMode(reflector != nullptr);
56 } 79 }
57 reflector_ = reflector; 80 reflector_ = reflector;
58 } 81 }
59 82
60 cc::OverlayCandidateValidator* 83 cc::OverlayCandidateValidator*
61 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const { 84 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const {
62 return overlay_candidate_validator_.get(); 85 return overlay_candidate_validator_.get();
63 } 86 }
64 87
65 } // namespace content 88 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/browser_compositor_output_surface.h ('k') | content/browser/compositor/delegated_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698