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

Unified Diff: ui/compositor/compositor.h

Issue 1000503002: Add BeginFrameObserverProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to BeginFrameObserverProxy Created 5 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 | « ui/compositor/BUILD.gn ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.h
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 3a3e4cc829b1d675a2d3d64a7a139c69d94842a1..f46b496dde7e35553e3fa898a9647a1c789808a4 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -5,6 +5,7 @@
#ifndef UI_COMPOSITOR_COMPOSITOR_H_
#define UI_COMPOSITOR_COMPOSITOR_H_
+#include <list>
#include <string>
#include "base/containers/hash_tables.h"
@@ -13,6 +14,7 @@
#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"
@@ -132,6 +134,13 @@ class COMPOSITOR_EXPORT CompositorLock
DISALLOW_COPY_AND_ASSIGN(CompositorLock);
};
+// This class observes BeginFrame notification from LayerTreeHost.
+class COMPOSITOR_EXPORT CompositorBeginFrameObserver {
+ public:
+ virtual ~CompositorBeginFrameObserver() {}
+ virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
+};
+
// Compositor object to take care of GPU painting.
// A Browser compositor object is responsible for generating the final
// displayable form of pixels comprising a single widget's contents. It draws an
@@ -227,6 +236,9 @@ class COMPOSITOR_EXPORT Compositor
void RemoveAnimationObserver(CompositorAnimationObserver* observer);
bool HasAnimationObserver(const CompositorAnimationObserver* observer) const;
+ void AddBeginFrameObserver(CompositorBeginFrameObserver* observer);
+ void RemoveBeginFrameObserver(CompositorBeginFrameObserver* observer);
+
// Change the timeout behavior for all future locks that are created. Locks
// should time out if there is an expectation that the compositor will be
// responsive.
@@ -272,6 +284,7 @@ class COMPOSITOR_EXPORT Compositor
void DidCommitAndDrawFrame() override;
void DidCompleteSwapBuffers() override;
void DidCompletePageScaleAnimation() override {}
+ void SendBeginFramesToChildren(const cc::BeginFrameArgs& args) override;
// cc::LayerTreeHostSingleThreadClient implementation.
void DidPostSwapBuffers() override;
@@ -310,6 +323,7 @@ class COMPOSITOR_EXPORT Compositor
ObserverList<CompositorObserver, true> observer_list_;
ObserverList<CompositorAnimationObserver> animation_observer_list_;
+ std::list<CompositorBeginFrameObserver*> begin_frame_observer_list_;
gfx::AcceleratedWidget widget_;
scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
@@ -332,6 +346,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);
« no previous file with comments | « ui/compositor/BUILD.gn ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698