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

Unified Diff: content/browser/compositor/browser_compositor_output_surface.cc

Issue 1016033006: Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable BeginFrame scheduling under flag 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 side-by-side diff with in-line comments
Download patch
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 2038725bc8650980e8b98990f7ed0518746c27a9..0e014c94a68524df657cf89dab59780b31d6d608 100644
--- a/content/browser/compositor/browser_compositor_output_surface.cc
+++ b/content/browser/compositor/browser_compositor_output_surface.cc
@@ -5,8 +5,10 @@
#include "content/browser/compositor/browser_compositor_output_surface.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/location.h"
#include "base/strings/string_number_conversions.h"
+#include "cc/base/switches.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"
@@ -20,7 +22,9 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
overlay_candidate_validator)
: OutputSurface(context_provider),
vsync_manager_(vsync_manager),
- reflector_(nullptr) {
+ reflector_(nullptr),
+ use_begin_frame_scheduling_(base::CommandLine::ForCurrentProcess()->
+ HasSwitch(cc::switches::kEnableBeginFrameScheduling)) {
overlay_candidate_validator_ = overlay_candidate_validator.Pass();
Initialize();
}
@@ -30,7 +34,9 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface(
const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
: OutputSurface(software_device.Pass()),
vsync_manager_(vsync_manager),
- reflector_(nullptr) {
+ reflector_(nullptr),
+ use_begin_frame_scheduling_(base::CommandLine::ForCurrentProcess()->
+ HasSwitch(cc::switches::kEnableBeginFrameScheduling)) {
Initialize();
}
@@ -40,7 +46,11 @@ BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() {
DCHECK(!reflector_);
if (!HasClient())
return;
- vsync_manager_->RemoveObserver(this);
+
+ // When BeginFrame scheduling is enabled, vsync info is not routed to renderer
+ // by using |vsync_manager_|. Instead, BeginFrame message is used.
+ if (!use_begin_frame_scheduling_)
+ vsync_manager_->RemoveObserver(this);
}
void BrowserCompositorOutputSurface::Initialize() {
@@ -52,8 +62,10 @@ bool BrowserCompositorOutputSurface::BindToClient(
cc::OutputSurfaceClient* client) {
if (!OutputSurface::BindToClient(client))
return false;
+
// Don't want vsync notifications until there is a client.
- vsync_manager_->AddObserver(this);
+ if (!use_begin_frame_scheduling_)
+ vsync_manager_->AddObserver(this);
return true;
}
@@ -61,6 +73,7 @@ void BrowserCompositorOutputSurface::OnUpdateVSyncParameters(
base::TimeTicks timebase,
base::TimeDelta interval) {
DCHECK(HasClient());
+ DCHECK(!use_begin_frame_scheduling_);
CommitVSyncParameters(timebase, interval);
}
@@ -68,6 +81,11 @@ void BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu(
base::TimeTicks timebase,
base::TimeDelta interval) {
DCHECK(HasClient());
+ if (use_begin_frame_scheduling_) {
+ CommitVSyncParameters(timebase, interval);
+ return;
+ }
+
vsync_manager_->UpdateVSyncParameters(timebase, interval);
}
« 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