| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 void BrowserCompositorOutputSurface::Initialize() { | 82 void BrowserCompositorOutputSurface::Initialize() { |
| 83 capabilities_.adjust_deadline_for_parent = false; | 83 capabilities_.adjust_deadline_for_parent = false; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool BrowserCompositorOutputSurface::BindToClient( | 86 bool BrowserCompositorOutputSurface::BindToClient( |
| 87 cc::OutputSurfaceClient* client) { | 87 cc::OutputSurfaceClient* client) { |
| 88 if (!OutputSurface::BindToClient(client)) | 88 if (!OutputSurface::BindToClient(client)) |
| 89 return false; | 89 return false; |
| 90 | 90 |
| 91 // Pass begin frame source up to Display to use for DisplayScheduler. | |
| 92 client->SetBeginFrameSource(synthetic_begin_frame_source_.get()); | |
| 93 | |
| 94 // Don't want vsync notifications until there is a client. | 91 // Don't want vsync notifications until there is a client. |
| 95 if (!use_begin_frame_scheduling_) | 92 if (!use_begin_frame_scheduling_) |
| 96 vsync_manager_->AddObserver(this); | 93 vsync_manager_->AddObserver(this); |
| 97 return true; | 94 return true; |
| 98 } | 95 } |
| 99 | 96 |
| 100 void BrowserCompositorOutputSurface::UpdateVSyncParametersInternal( | 97 void BrowserCompositorOutputSurface::UpdateVSyncParametersInternal( |
| 101 base::TimeTicks timebase, | 98 base::TimeTicks timebase, |
| 102 base::TimeDelta interval) { | 99 base::TimeDelta interval) { |
| 103 if (interval.is_zero()) { | 100 if (interval.is_zero()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 120 base::TimeDelta interval) { | 117 base::TimeDelta interval) { |
| 121 DCHECK(HasClient()); | 118 DCHECK(HasClient()); |
| 122 if (use_begin_frame_scheduling_) { | 119 if (use_begin_frame_scheduling_) { |
| 123 UpdateVSyncParametersInternal(timebase, interval); | 120 UpdateVSyncParametersInternal(timebase, interval); |
| 124 return; | 121 return; |
| 125 } | 122 } |
| 126 | 123 |
| 127 vsync_manager_->UpdateVSyncParameters(timebase, interval); | 124 vsync_manager_->UpdateVSyncParameters(timebase, interval); |
| 128 } | 125 } |
| 129 | 126 |
| 127 cc::BeginFrameSource* BrowserCompositorOutputSurface::GetBeginFrameSource() { |
| 128 // The BeginFrameSource for the Display and DisplayScheduler to use. |
| 129 return synthetic_begin_frame_source_.get(); |
| 130 } |
| 131 |
| 130 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { | 132 void BrowserCompositorOutputSurface::SetReflector(ReflectorImpl* reflector) { |
| 131 // Software mirroring is done by doing a GL copy out of the framebuffer - if | 133 // Software mirroring is done by doing a GL copy out of the framebuffer - if |
| 132 // we have overlays then that data will be missing. | 134 // we have overlays then that data will be missing. |
| 133 if (overlay_candidate_validator_) { | 135 if (overlay_candidate_validator_) { |
| 134 overlay_candidate_validator_->SetSoftwareMirrorMode(reflector != nullptr); | 136 overlay_candidate_validator_->SetSoftwareMirrorMode(reflector != nullptr); |
| 135 } | 137 } |
| 136 reflector_ = reflector; | 138 reflector_ = reflector; |
| 137 | 139 |
| 138 OnReflectorChanged(); | 140 OnReflectorChanged(); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void BrowserCompositorOutputSurface::OnReflectorChanged() { | 143 void BrowserCompositorOutputSurface::OnReflectorChanged() { |
| 142 } | 144 } |
| 143 | 145 |
| 144 base::Closure | 146 base::Closure |
| 145 BrowserCompositorOutputSurface::CreateCompositionStartedCallback() { | 147 BrowserCompositorOutputSurface::CreateCompositionStartedCallback() { |
| 146 return base::Closure(); | 148 return base::Closure(); |
| 147 } | 149 } |
| 148 | 150 |
| 149 cc::OverlayCandidateValidator* | 151 cc::OverlayCandidateValidator* |
| 150 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const { | 152 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const { |
| 151 return overlay_candidate_validator_.get(); | 153 return overlay_candidate_validator_.get(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace content | 156 } // namespace content |
| OLD | NEW |