| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| 7 | 7 |
| 8 #include "android_webview/browser/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/values.h" |
| 12 #include "content/public/browser/android/synchronous_compositor_client.h" | 13 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 13 #include "skia/ext/refptr.h" | 14 #include "skia/ext/refptr.h" |
| 14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 15 #include "ui/gfx/vector2d_f.h" | 16 #include "ui/gfx/vector2d_f.h" |
| 16 | 17 |
| 17 class SkCanvas; | 18 class SkCanvas; |
| 18 class SkPicture; | 19 class SkPicture; |
| 19 struct AwDrawGLInfo; | 20 struct AwDrawGLInfo; |
| 20 struct AwDrawSWFunctionTable; | 21 struct AwDrawSWFunctionTable; |
| 21 | 22 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // immediately discarded. This is a hack to force invoke parts of the | 106 // immediately discarded. This is a hack to force invoke parts of the |
| 106 // compositor that are not directly exposed here. | 107 // compositor that are not directly exposed here. |
| 107 void ForceFakeCompositeSW(); | 108 void ForceFakeCompositeSW(); |
| 108 | 109 |
| 109 // SynchronousCompositorClient overrides | 110 // SynchronousCompositorClient overrides |
| 110 virtual void DidInitializeCompositor( | 111 virtual void DidInitializeCompositor( |
| 111 content::SynchronousCompositor* compositor) OVERRIDE; | 112 content::SynchronousCompositor* compositor) OVERRIDE; |
| 112 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) | 113 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) |
| 113 OVERRIDE; | 114 OVERRIDE; |
| 114 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; | 115 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
| 115 virtual void SetMaxRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; | 116 virtual void SetTotalRootLayerScrollOffset( |
| 116 virtual void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_css) | 117 gfx::Vector2dF new_value_dip) OVERRIDE; |
| 117 OVERRIDE; | |
| 118 virtual void DidUpdateContent() OVERRIDE; | 118 virtual void DidUpdateContent() OVERRIDE; |
| 119 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; | 119 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; |
| 120 virtual bool IsExternalFlingActive() const OVERRIDE; | 120 virtual bool IsExternalFlingActive() const OVERRIDE; |
| 121 virtual void SetRootLayerPageScaleFactorAndLimits(float page_scale_factor, | 121 virtual void UpdateRootLayerState( |
| 122 float min_page_scale_factor, | 122 const gfx::Vector2dF& total_scroll_offset_dip, |
| 123 float max_page_scale_factor) | 123 const gfx::Vector2dF& max_scroll_offset_dip, |
| 124 OVERRIDE; | 124 const gfx::SizeF& scrollable_size_dip, |
| 125 virtual void SetRootLayerScrollableSize(gfx::SizeF scrollable_size) OVERRIDE; | 125 float page_scale_factor, |
| 126 float min_page_scale_factor, |
| 127 float max_page_scale_factor) OVERRIDE; |
| 126 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 128 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
| 127 gfx::Vector2dF latest_overscroll_delta, | 129 gfx::Vector2dF latest_overscroll_delta, |
| 128 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 130 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
| 129 | 131 |
| 130 private: | 132 private: |
| 131 // Checks the continuous invalidate and block invalidate state, and schedule | 133 // Checks the continuous invalidate and block invalidate state, and schedule |
| 132 // invalidates appropriately. If |force_invalidate| is true, then send a view | 134 // invalidates appropriately. If |force_invalidate| is true, then send a view |
| 133 // invalidate regardless of compositor expectation. | 135 // invalidate regardless of compositor expectation. |
| 134 void EnsureContinuousInvalidation(bool force_invalidate); | 136 void EnsureContinuousInvalidation(bool force_invalidate); |
| 135 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); | 137 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); |
| 136 bool CompositeSW(SkCanvas* canvas); | 138 bool CompositeSW(SkCanvas* canvas); |
| 137 void DidComposite(bool force_invalidate); | 139 void DidComposite(bool force_invalidate); |
| 140 scoped_ptr<base::Value> RootLayerStateAsValue( |
| 141 const gfx::SizeF& scrollable_size_dip); |
| 138 | 142 |
| 139 // If we call up view invalidate and OnDraw is not called before a deadline, | 143 // If we call up view invalidate and OnDraw is not called before a deadline, |
| 140 // then we keep ticking the SynchronousCompositor so it can make progress. | 144 // then we keep ticking the SynchronousCompositor so it can make progress. |
| 141 void FallbackTickFired(); | 145 void FallbackTickFired(); |
| 142 | 146 |
| 143 gfx::Vector2d max_scroll_offset() const; | 147 gfx::Vector2d max_scroll_offset() const; |
| 144 | 148 |
| 145 // For debug tracing or logging. Return the string representation of this | 149 // For debug tracing or logging. Return the string representation of this |
| 146 // view renderer's state and the |draw_info| if provided. | 150 // view renderer's state and the |draw_info| if provided. |
| 147 std::string ToString(AwDrawGLInfo* draw_info) const; | 151 std::string ToString(AwDrawGLInfo* draw_info) const; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // visible skew (especially noticeable when scrolling up and down in the same | 202 // visible skew (especially noticeable when scrolling up and down in the same |
| 199 // spot over a period of time). | 203 // spot over a period of time). |
| 200 gfx::Vector2dF overscroll_rounding_error_; | 204 gfx::Vector2dF overscroll_rounding_error_; |
| 201 | 205 |
| 202 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 206 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 203 }; | 207 }; |
| 204 | 208 |
| 205 } // namespace android_webview | 209 } // namespace android_webview |
| 206 | 210 |
| 207 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 211 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |