Index: content/browser/compositor/browser_compositor_output_surface.cc |
diff --git a/content/browser/compositor/browser_compositor_output_surface.cc b/content/browser/compositor/browser_compositor_output_surface.cc |
index f865702effe067a645bc434c72882385ed5195a5..7712f144dc7e9d962c8a4a920191f940d49d2264 100644 |
--- a/content/browser/compositor/browser_compositor_output_surface.cc |
+++ b/content/browser/compositor/browser_compositor_output_surface.cc |
@@ -10,7 +10,9 @@ |
#include "base/command_line.h" |
#include "base/location.h" |
#include "base/strings/string_number_conversions.h" |
+#include "base/thread_task_runner_handle.h" |
#include "cc/base/switches.h" |
+#include "cc/output/output_surface_client.h" |
#include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h" |
#include "content/browser/compositor/reflector_impl.h" |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
@@ -25,10 +27,13 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
overlay_candidate_validator) |
: OutputSurface(context_provider, worker_context_provider), |
vsync_manager_(vsync_manager), |
+ synthetic_begin_frame_source_(new cc::SyntheticBeginFrameSource( |
+ base::ThreadTaskRunnerHandle::Get().get(), |
no sievers
2016/04/05 23:12:52
Shouldn't it be the same thread that BindToClient(
enne (OOO)
2016/04/06 21:42:58
Done.
|
+ cc::BeginFrameArgs::DefaultInterval())), |
reflector_(nullptr), |
use_begin_frame_scheduling_( |
- base::CommandLine::ForCurrentProcess() |
- ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ cc::switches::kEnableBeginFrameScheduling)) { |
overlay_candidate_validator_ = std::move(overlay_candidate_validator); |
Initialize(); |
} |
@@ -38,10 +43,13 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) |
: OutputSurface(std::move(software_device)), |
vsync_manager_(vsync_manager), |
+ synthetic_begin_frame_source_(new cc::SyntheticBeginFrameSource( |
+ base::ThreadTaskRunnerHandle::Get().get(), |
+ cc::BeginFrameArgs::DefaultInterval())), |
reflector_(nullptr), |
use_begin_frame_scheduling_( |
- base::CommandLine::ForCurrentProcess() |
- ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ cc::switches::kEnableBeginFrameScheduling)) { |
Initialize(); |
} |
@@ -67,18 +75,31 @@ bool BrowserCompositorOutputSurface::BindToClient( |
if (!OutputSurface::BindToClient(client)) |
return false; |
+ // Pass begin frame source up to Display to use for DisplayScheduler. |
+ client->SetBeginFrameSource(synthetic_begin_frame_source_.get()); |
+ |
// Don't want vsync notifications until there is a client. |
if (!use_begin_frame_scheduling_) |
vsync_manager_->AddObserver(this); |
return true; |
} |
+void BrowserCompositorOutputSurface::UpdateVSyncParametersInternal( |
+ base::TimeTicks timebase, |
+ base::TimeDelta interval) { |
+ if (interval == base::TimeDelta()) { |
+ // TODO(brianderson): We should not be receiving 0 intervals. |
+ interval = cc::BeginFrameArgs::DefaultInterval(); |
+ } |
+ synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval); |
+} |
+ |
void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( |
base::TimeTicks timebase, |
base::TimeDelta interval) { |
DCHECK(HasClient()); |
DCHECK(!use_begin_frame_scheduling_); |
- CommitVSyncParameters(timebase, interval); |
+ UpdateVSyncParametersInternal(timebase, interval); |
} |
void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( |
@@ -86,7 +107,7 @@ void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu( |
base::TimeDelta interval) { |
DCHECK(HasClient()); |
if (use_begin_frame_scheduling_) { |
- CommitVSyncParameters(timebase, interval); |
+ UpdateVSyncParametersInternal(timebase, interval); |
return; |
} |