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

Unified Diff: ui/compositor/compositor.h

Issue 775143003: cc: Implement unified BeginFrame on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: ui/compositor/compositor.h
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index bf61d29730e67aa70bd7c8533baa860a2335de42..7895ae764770a1015eb77789b9a411986ff0080c 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -13,10 +13,12 @@
#include "base/observer_list.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/surfaces/surface_sequence.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_single_thread_client.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/compositor/compositor_begin_frame_observer.h"
#include "ui/compositor/compositor_animation_observer.h"
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/compositor_observer.h"
@@ -223,6 +225,11 @@ class COMPOSITOR_EXPORT Compositor
void RemoveAnimationObserver(CompositorAnimationObserver* observer);
bool HasAnimationObserver(const CompositorAnimationObserver* observer) const;
+ void AddBeginFrameObserver(
+ CompositorBeginFrameObserver* observer,
+ const cc::BeginFrameArgs& last_begin_frame_args_sent_to_observer);
+ void RemoveBeginFrameObserver(CompositorBeginFrameObserver* observer);
+
// Creates a compositor lock. Returns NULL if it is not possible to lock at
// this time (i.e. we're waiting to complete a previous unlock).
scoped_refptr<CompositorLock> GetCompositorLock();
@@ -239,6 +246,14 @@ class COMPOSITOR_EXPORT Compositor
// Signals swap has aborted (e.g. lost context).
void OnSwapBuffersAborted();
+ // The "authoritative" vsync interval, if provided, will override interval
+ // reported from 3D context. This is typically the value reported by a more
+ // reliable source, e.g, the platform display configuration.
+ // In the particular case of ChromeOS -- this is the value queried through
+ // XRandR, which is more reliable than the value queried through the 3D
+ // context.
+ void SetAuthoritativeVSyncInterval(base::TimeDelta interval) const;
+
// LayerTreeHostClient implementation.
void WillBeginMainFrame(int frame_id) override {}
void DidBeginMainFrame() override {}
@@ -257,6 +272,7 @@ class COMPOSITOR_EXPORT Compositor
void DidCommit() override;
void DidCommitAndDrawFrame() override;
void DidCompleteSwapBuffers() override;
+ void SendBeginFramesToChildren(const cc::BeginFrameArgs& args) override;
// cc::LayerTreeHostSingleThreadClient implementation.
void DidPostSwapBuffers() override;
@@ -286,6 +302,9 @@ class COMPOSITOR_EXPORT Compositor
// Called to release any pending CompositorLock
void CancelCompositorLock();
+ // Request scheduling of next BeginFrame to LayerTreeHost.
+ void SetChildrenNeedBeginFrames(bool need_begin_frame);
+
gfx::Size size_;
ui::ContextFactory* context_factory_;
@@ -295,6 +314,7 @@ class COMPOSITOR_EXPORT Compositor
ObserverList<CompositorObserver> observer_list_;
ObserverList<CompositorAnimationObserver> animation_observer_list_;
+ ObserverList<CompositorBeginFrameObserver> begin_frame_observer_list_;
gfx::AcceleratedWidget widget_;
scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
@@ -304,6 +324,7 @@ class COMPOSITOR_EXPORT Compositor
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// The manager of vsync parameters for this compositor.
+ // TODO(simonhong): Remove CompositorVSyncManager when cros uses STP.
scoped_refptr<CompositorVSyncManager> vsync_manager_;
// The device scale factor of the monitor that this compositor is compositing
@@ -319,6 +340,9 @@ class COMPOSITOR_EXPORT Compositor
LayerAnimatorCollection layer_animator_collection_;
+ // Used to send to any new CompositorBeginFrameObserver immediately.
+ cc::BeginFrameArgs missed_begin_frame_args_;
+
base::WeakPtrFactory<Compositor> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(Compositor);

Powered by Google App Engine
This is Rietveld 408576698