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

Unified Diff: content/browser/renderer_host/compositor_impl_android.h

Issue 1536323003: Revert of android: Remove custom browser compositor scheduling logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositor_impl_android.h
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h
index 65be041c8e184713a94299027ef55eef4c83e175..7dc3837a856a482806bf6c3315979dfed47d8bd1 100644
--- a/content/browser/renderer_host/compositor_impl_android.h
+++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -48,8 +48,8 @@
public:
class VSyncObserver {
public:
- virtual void OnVSync(base::TimeTicks timebase,
- base::TimeDelta interval) = 0;
+ virtual void OnUpdateVSyncParameters(base::TimeTicks timebase,
+ base::TimeDelta interval) = 0;
};
CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window);
@@ -64,7 +64,6 @@
void AddObserver(VSyncObserver* observer);
void RemoveObserver(VSyncObserver* observer);
- void OnNeedsBeginFramesChange(bool needs_begin_frames);
// ui::ResourceProvider implementation.
cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override;
@@ -107,6 +106,8 @@
override {}
// LayerTreeHostSingleThreadClient implementation.
+ void ScheduleComposite() override;
+ void ScheduleAnimation() override;
void DidPostSwapBuffers() override;
void DidAbortSwapBuffers() override;
@@ -117,8 +118,38 @@
void OnVSync(base::TimeTicks frame_time,
base::TimeDelta vsync_period) override;
void SetNeedsAnimate() override;
+
void SetVisible(bool visible);
+
+ enum CompositingTrigger {
+ DO_NOT_COMPOSITE,
+ COMPOSITE_IMMEDIATELY,
+ COMPOSITE_EVENTUALLY,
+ };
+ void PostComposite(CompositingTrigger trigger);
+ void Composite(CompositingTrigger trigger);
void CreateOutputSurface();
+
+ bool WillCompositeThisFrame() const {
+ return current_composite_task_ &&
+ !current_composite_task_->callback().is_null();
+ }
+ bool DidCompositeThisFrame() const {
+ return current_composite_task_ &&
+ current_composite_task_->callback().is_null();
+ }
+ bool WillComposite() const {
+ return WillCompositeThisFrame() ||
+ composite_on_vsync_trigger_ != DO_NOT_COMPOSITE;
+ }
+ void CancelComposite() {
+ DCHECK(WillComposite());
+ if (WillCompositeThisFrame())
+ current_composite_task_->Cancel();
+ current_composite_task_.reset();
+ composite_on_vsync_trigger_ = DO_NOT_COMPOSITE;
+ will_composite_immediately_ = false;
+ }
void CreateLayerTreeHost();
void OnGpuChannelEstablished();
@@ -146,14 +177,38 @@
gfx::NativeWindow root_window_;
+ // Used locally to track whether a call to LTH::Composite() did result in
+ // a posted SwapBuffers().
+ bool did_post_swapbuffers_;
+
+ // Used locally to inhibit ScheduleComposite() during
+ // UpdateLayerTreeHost().
+ bool ignore_schedule_composite_;
+
+ // Whether we need to composite in general because of any invalidation or
+ // explicit request.
+ bool needs_composite_;
+
// Whether we need to update animations on the next composite.
bool needs_animate_;
+
+ // Whether we posted a task and are about to composite.
+ bool will_composite_immediately_;
+
+ // How we should schedule Composite during the next vsync.
+ CompositingTrigger composite_on_vsync_trigger_;
+
+ // The Composite operation scheduled for the current vsync interval.
+ scoped_ptr<base::CancelableClosure> current_composite_task_;
// The number of SwapBuffer calls that have not returned and ACK'd from
// the GPU thread.
unsigned int pending_swapbuffers_;
size_t num_successive_context_creation_failures_;
+
+ base::TimeDelta vsync_period_;
+ base::TimeTicks last_vsync_;
base::OneShotTimer establish_gpu_channel_timeout_;
@@ -165,7 +220,6 @@
gpu::Capabilities gpu_capabilities_;
- bool needs_begin_frames_;
base::ObserverList<VSyncObserver, true> observer_list_;
base::WeakPtrFactory<CompositorImpl> weak_factory_;
« no previous file with comments | « no previous file | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698