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

Unified Diff: android_webview/browser/browser_view_renderer.h

Issue 817603002: cc: Make scheduling be driven by vsync for android webview. (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
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer.cc » ('j') | cc/scheduler/scheduler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/browser_view_renderer.h
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h
index e1388a50d62e1a00bca6200f6201758fb5fd0026..463663b881ed454b91bb7d116e9fc5ac60e4b736 100644
--- a/android_webview/browser/browser_view_renderer.h
+++ b/android_webview/browser/browser_view_renderer.h
@@ -49,6 +49,8 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
bool OnDrawHardware();
bool OnDrawSoftware(SkCanvas* canvas);
+ void OnVSync(base::TimeTicks frame_time, base::TimeDelta vsync_period);
+
// CapturePicture API methods.
skia::RefPtr<SkPicture> CapturePicture(int width, int height);
void EnableOnNewPicture(bool enabled);
@@ -84,7 +86,8 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
content::SynchronousCompositor* compositor) override;
virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor)
override;
- virtual void SetContinuousInvalidate(bool invalidate) override;
+ virtual void SetNeedsVSyncs(bool needs_vsyncs) override;
+ virtual void PostInvalidate() override;
virtual void DidUpdateContent() override;
virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() override;
virtual void UpdateRootLayerState(
@@ -100,44 +103,26 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
gfx::Vector2dF current_fling_velocity) override;
void UpdateParentDrawConstraints();
- void DidSkipCommitFrame();
void InvalidateOnFunctorDestroy();
private:
- void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
- // Checks the continuous invalidate and block invalidate state, and schedule
- // invalidates appropriately. If |force_invalidate| is true, then send a view
- // invalidate regardless of compositor expectation. If |skip_reschedule_tick|
- // is true and if there is already a pending fallback tick, don't reschedule
- // them.
- void EnsureContinuousInvalidation(bool force_invalidate,
- bool skip_reschedule_tick);
bool CompositeSW(SkCanvas* canvas);
- void DidComposite();
- void DidSkipCompositeInDraw();
+ scoped_ptr<cc::CompositorFrame> CompositeHw();
+
+ void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
scoped_refptr<base::debug::ConvertableToTraceFormat> RootLayerStateAsValue(
const gfx::Vector2dF& total_scroll_offset_dip,
const gfx::SizeF& scrollable_size_dip);
- scoped_ptr<cc::CompositorFrame> CompositeHw();
void ReturnUnusedResource(scoped_ptr<cc::CompositorFrame> frame);
void ReturnResourceFromParent();
-
- // If we call up view invalidate and OnDraw is not called before a deadline,
- // then we keep ticking the SynchronousCompositor so it can make progress.
- // Do this in a two stage tick due to native MessageLoop favors delayed task,
- // so ensure delayed task is inserted only after the draw task returns.
- void PostFallbackTick();
- void FallbackTickFired();
-
- // Force invoke the compositor to run produce a 1x1 software frame that is
- // immediately discarded. This is a hack to force invoke parts of the
- // compositor that are not directly exposed here.
- void ForceFakeCompositeSW();
-
+
gfx::Vector2d max_scroll_offset() const;
size_t CalculateDesiredMemoryPolicy();
+
+ void UpdateNeedsVSyncs();
+
// For debug tracing or logging. Return the string representation of this
// view renderer's state.
std::string ToString() const;
@@ -165,20 +150,16 @@ class BrowserViewRenderer : public content::SynchronousCompositorClient {
// tiling priority.
ParentCompositorDrawConstraints parent_draw_constraints_;
- // When true, we should continuously invalidate and keep drawing, for example
+ // When true, we should ask for vsyncs and pass them on, for example
// to drive animation. This value is set by the compositor and should always
// reflect the expectation of the compositor and not be reused for other
// states.
- bool compositor_needs_continuous_invalidate_;
-
- bool invalidate_after_composite_;
-
- // Used to block additional invalidates while one is already pending.
- bool block_invalidates_;
+ bool compositor_needs_vsyncs_;
- base::CancelableClosure post_fallback_tick_;
- base::CancelableClosure fallback_tick_fired_;
- bool fallback_tick_pending_;
+ // This is actually used to decide if we're asking for vsyncs. Sometimes we
+ // want to stop vsync callbacks even if the compositor is asking for them.
+ // e.g. when paused (backgrounded) or window not visible.
+ bool needs_vsyncs_;
gfx::Size size_;
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer.cc » ('j') | cc/scheduler/scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698