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

Unified Diff: cc/surfaces/surface_display_output_surface.cc

Issue 1821863002: Hook up ui::Compositor to Display's BeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test compilation Created 4 years, 9 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: cc/surfaces/surface_display_output_surface.cc
diff --git a/cc/surfaces/surface_display_output_surface.cc b/cc/surfaces/surface_display_output_surface.cc
index dfb491ede62bb7a5c41755c89514d399b93eb950..f616624a6dd345683d7bdf48572ae2e9f0370400 100644
--- a/cc/surfaces/surface_display_output_surface.cc
+++ b/cc/surfaces/surface_display_output_surface.cc
@@ -21,7 +21,7 @@ SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface(
scoped_refptr<ContextProvider> worker_context_provider)
: OutputSurface(std::move(context_provider),
std::move(worker_context_provider)),
- display_client_(NULL),
+ display_client_(nullptr),
factory_(surface_manager, this),
allocator_(allocator) {
factory_.set_needs_sync_points(false);
@@ -41,12 +41,6 @@ SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() {
}
}
-void SurfaceDisplayOutputSurface::ReceivedVSyncParameters(
- base::TimeTicks timebase,
- base::TimeDelta interval) {
- CommitVSyncParameters(timebase, interval);
-}
-
void SurfaceDisplayOutputSurface::SwapBuffers(CompositorFrame* frame) {
gfx::Size frame_size =
frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
@@ -76,11 +70,18 @@ bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) {
DCHECK(display_client_);
factory_.manager()->RegisterSurfaceFactoryClient(allocator_->id_namespace(),
this);
-
client_ = client;
+
// Avoid initializing GL context here, as this should be sharing the
// Display's context.
- return display_client_->Initialize();
+ if (!display_client_->Initialize())
+ return false;
+
+ BeginFrameSource* source = display_client_->BeginFrameSourceForChildren();
+ DCHECK(source);
+ factory_.manager()->RegisterBeginFrameSource(source,
+ allocator_->id_namespace());
sunnyps 2016/03/22 21:52:44 I think eventually we want the scheduler to make t
enne (OOO) 2016/03/22 22:16:21 I'm not sure what you mean by associating cc::Outp
sunnyps 2016/03/24 23:14:25 Sorry, I keep forgetting that the BFS is associate
+ return true;
}
void SurfaceDisplayOutputSurface::ForceReclaimResources() {
@@ -91,6 +92,11 @@ void SurfaceDisplayOutputSurface::ForceReclaimResources() {
void SurfaceDisplayOutputSurface::DetachFromClient() {
DCHECK(HasClient());
+
+ BeginFrameSource* source = display_client_->BeginFrameSourceForChildren();
+ DCHECK(source);
+ factory_.manager()->UnregisterBeginFrameSource(source);
+
// Unregister the SurfaceFactoryClient here instead of the dtor so that only
// one client is alive for this namespace at any given time.
factory_.manager()->UnregisterSurfaceFactoryClient(
@@ -109,7 +115,8 @@ void SurfaceDisplayOutputSurface::ReturnResources(
void SurfaceDisplayOutputSurface::SetBeginFrameSource(
BeginFrameSource* begin_frame_source) {
- // TODO(tansell): Hook this up.
+ DCHECK(client_);
+ client_->SetBeginFrameSource(begin_frame_source);
}
void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) {

Powered by Google App Engine
This is Rietveld 408576698