Commit 1b0f7d5e authored by dfalcantara's avatar dfalcantara Committed by Commit bot

Revert of android: Remove custom browser compositor scheduling logic (patchset...

Revert of android: Remove custom browser compositor scheduling logic (patchset #6 id:100001 of https://codereview.chromium.org/1513933003/ )

Reason for revert:
Speculatively reverting CL to try and fix observer flakiness.
https://crbug.com/571030

Apologies if I'm off base!

Original issue's description:
> android: Remove custom browser compositor scheduling logic
>
> Use cc scheduler instead without a deadline.
> This is mostly obsolete now that Surfaces allow independent updates
> between renderer and browser.
>
> BUG=455894
>
> Committed: https://crrev.com/7f045e4f2e9f7142c79e2eeb30b70716a1ea8f0b
> Cr-Commit-Position: refs/heads/master@{#365861}

TBR=brianderson@chromium.org,sievers@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=455894

Review URL: https://codereview.chromium.org/1536323003

Cr-Commit-Position: refs/heads/master@{#366437}
parent dac8ac50
......@@ -48,8 +48,8 @@ class CONTENT_EXPORT CompositorImpl
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 @@ class CONTENT_EXPORT CompositorImpl
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 @@ class CONTENT_EXPORT CompositorImpl
override {}
// LayerTreeHostSingleThreadClient implementation.
void ScheduleComposite() override;
void ScheduleAnimation() override;
void DidPostSwapBuffers() override;
void DidAbortSwapBuffers() override;
......@@ -117,8 +118,38 @@ class CONTENT_EXPORT CompositorImpl
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,15 +177,39 @@ class CONTENT_EXPORT CompositorImpl
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_;
// Whether there is an OutputSurface request pending from the current
......@@ -165,7 +220,6 @@ class CONTENT_EXPORT CompositorImpl
gpu::Capabilities gpu_capabilities_;
bool needs_begin_frames_;
base::ObserverList<VSyncObserver, true> observer_list_;
base::WeakPtrFactory<CompositorImpl> weak_factory_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment