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

Unified Diff: components/exo/surface.h

Issue 2724953007: [exo] Clean up BeginFrame distribution & add acks in Surface. (Closed)
Patch Set: rename instance var. Created 3 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
« no previous file with comments | « components/exo/compositor_frame_sink_holder.cc ('k') | components/exo/surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface.h
diff --git a/components/exo/surface.h b/components/exo/surface.h
index ecda81291a8948dcba8a9c4350a51148071d0e3e..8e4a6ad9b5635b0906474e6f367b71a8cb3dad34 100644
--- a/components/exo/surface.h
+++ b/components/exo/surface.h
@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/resources/transferable_resource.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/local_surface_id_allocator.h"
@@ -62,7 +63,8 @@ using CursorProvider = Pointer;
class Surface : public ui::ContextFactoryObserver,
public aura::WindowObserver,
public ui::PropertyHandler,
- public ui::CompositorVSyncManager::Observer {
+ public ui::CompositorVSyncManager::Observer,
+ public cc::BeginFrameObserverBase {
public:
using PropertyDeallocator = void (*)(int64_t value);
@@ -192,12 +194,8 @@ class Surface : public ui::ContextFactoryObserver,
// Call this to indicate that surface is being scheduled for a draw.
void WillDraw();
- // Returns true when there's an active frame callback that requires a
- // BeginFrame() call.
- bool NeedsBeginFrame() const;
-
- // Call this to indicate that it's a good time to start producing a new frame.
- void BeginFrame(base::TimeTicks frame_time);
+ // Called when the begin frame source has changed.
+ void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source);
// Check whether this Surface and its children need to create new cc::Surface
// IDs for their contents next time they get new buffer contents.
@@ -222,6 +220,10 @@ class Surface : public ui::ContextFactoryObserver,
return pending_damage_.contains(gfx::RectToSkIRect(damage));
}
+ // Overridden from cc::BeginFrameObserverBase:
+ bool OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) override;
+ void OnBeginFrameSourcePausedChanged(bool paused) override {}
+
private:
struct State {
State();
@@ -282,6 +284,9 @@ class Surface : public ui::ContextFactoryObserver,
// current_resource_.
void UpdateSurface(bool full_damage);
+ // Adds/Removes begin frame observer based on state.
+ void UpdateNeedsBeginFrame();
+
// This returns true when the surface has some contents assigned to it.
bool has_contents() const { return !!current_buffer_.buffer(); }
@@ -389,6 +394,11 @@ class Surface : public ui::ContextFactoryObserver,
// references to surfaces.
scoped_refptr<cc::SurfaceReferenceFactory> surface_reference_factory_;
+ // The begin frame source being observed.
+ cc::BeginFrameSource* begin_frame_source_ = nullptr;
+ bool needs_begin_frame_ = false;
+ cc::BeginFrameAck current_begin_frame_ack_;
+
DISALLOW_COPY_AND_ASSIGN(Surface);
};
« no previous file with comments | « components/exo/compositor_frame_sink_holder.cc ('k') | components/exo/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698