| 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/global_tile_manager.h" | 8 #include "android_webview/browser/global_tile_manager.h" |
| 9 #include "android_webview/browser/global_tile_manager_client.h" | 9 #include "android_webview/browser/global_tile_manager_client.h" |
| 10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
| 14 #include "base/values.h" |
| 14 #include "content/public/browser/android/synchronous_compositor_client.h" | 15 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 15 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
| 16 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 17 #include "ui/gfx/vector2d_f.h" | 18 #include "ui/gfx/vector2d_f.h" |
| 18 | 19 |
| 19 class SkCanvas; | 20 class SkCanvas; |
| 20 class SkPicture; | 21 class SkPicture; |
| 21 struct AwDrawGLInfo; | 22 struct AwDrawGLInfo; |
| 22 struct AwDrawSWFunctionTable; | 23 struct AwDrawSWFunctionTable; |
| 23 | 24 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void RequestMemoryPolicy(content::SynchronousCompositorMemoryPolicy& policy); | 114 void RequestMemoryPolicy(content::SynchronousCompositorMemoryPolicy& policy); |
| 114 | 115 |
| 115 void TrimMemory(const int level, const bool visible); | 116 void TrimMemory(const int level, const bool visible); |
| 116 | 117 |
| 117 // SynchronousCompositorClient overrides | 118 // SynchronousCompositorClient overrides |
| 118 virtual void DidInitializeCompositor( | 119 virtual void DidInitializeCompositor( |
| 119 content::SynchronousCompositor* compositor) OVERRIDE; | 120 content::SynchronousCompositor* compositor) OVERRIDE; |
| 120 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) | 121 virtual void DidDestroyCompositor(content::SynchronousCompositor* compositor) |
| 121 OVERRIDE; | 122 OVERRIDE; |
| 122 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; | 123 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
| 123 virtual void SetMaxRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; | |
| 124 virtual void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_css) | |
| 125 OVERRIDE; | |
| 126 virtual void DidUpdateContent() OVERRIDE; | 124 virtual void DidUpdateContent() OVERRIDE; |
| 127 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; | 125 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; |
| 126 virtual void UpdateRootLayerState( |
| 127 const gfx::Vector2dF& total_scroll_offset_dip, |
| 128 const gfx::Vector2dF& max_scroll_offset_dip, |
| 129 const gfx::SizeF& scrollable_size_dip, |
| 130 float page_scale_factor, |
| 131 float min_page_scale_factor, |
| 132 float max_page_scale_factor) OVERRIDE; |
| 128 virtual bool IsExternalFlingActive() const OVERRIDE; | 133 virtual bool IsExternalFlingActive() const OVERRIDE; |
| 129 virtual void SetRootLayerPageScaleFactorAndLimits(float page_scale_factor, | |
| 130 float min_page_scale_factor, | |
| 131 float max_page_scale_factor) | |
| 132 OVERRIDE; | |
| 133 virtual void SetRootLayerScrollableSize(gfx::SizeF scrollable_size) OVERRIDE; | |
| 134 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 134 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
| 135 gfx::Vector2dF latest_overscroll_delta, | 135 gfx::Vector2dF latest_overscroll_delta, |
| 136 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 136 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
| 137 | 137 |
| 138 // GlobalTileManagerClient overrides | 138 // GlobalTileManagerClient overrides |
| 139 virtual size_t GetNumTiles() const OVERRIDE; | 139 virtual size_t GetNumTiles() const OVERRIDE; |
| 140 virtual void SetNumTiles(size_t num_tiles, | 140 virtual void SetNumTiles(size_t num_tiles, |
| 141 bool effective_immediately) OVERRIDE; | 141 bool effective_immediately) OVERRIDE; |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); |
| 144 // Checks the continuous invalidate and block invalidate state, and schedule | 145 // Checks the continuous invalidate and block invalidate state, and schedule |
| 145 // invalidates appropriately. If |force_invalidate| is true, then send a view | 146 // invalidates appropriately. If |force_invalidate| is true, then send a view |
| 146 // invalidate regardless of compositor expectation. | 147 // invalidate regardless of compositor expectation. |
| 147 void EnsureContinuousInvalidation(bool force_invalidate); | 148 void EnsureContinuousInvalidation(bool force_invalidate); |
| 148 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); | 149 bool DrawSWInternal(jobject java_canvas, const gfx::Rect& clip_bounds); |
| 149 bool CompositeSW(SkCanvas* canvas); | 150 bool CompositeSW(SkCanvas* canvas); |
| 150 void DidComposite(bool force_invalidate); | 151 void DidComposite(bool force_invalidate); |
| 152 scoped_ptr<base::Value> RootLayerStateAsValue( |
| 153 const gfx::Vector2dF& total_scroll_offset_dip, |
| 154 const gfx::SizeF& scrollable_size_dip); |
| 151 | 155 |
| 152 // If we call up view invalidate and OnDraw is not called before a deadline, | 156 // If we call up view invalidate and OnDraw is not called before a deadline, |
| 153 // then we keep ticking the SynchronousCompositor so it can make progress. | 157 // then we keep ticking the SynchronousCompositor so it can make progress. |
| 154 void FallbackTickFired(); | 158 void FallbackTickFired(); |
| 155 | 159 |
| 156 // Force invoke the compositor to run produce a 1x1 software frame that is | 160 // Force invoke the compositor to run produce a 1x1 software frame that is |
| 157 // immediately discarded. This is a hack to force invoke parts of the | 161 // immediately discarded. This is a hack to force invoke parts of the |
| 158 // compositor that are not directly exposed here. | 162 // compositor that are not directly exposed here. |
| 159 void ForceFakeCompositeSW(); | 163 void ForceFakeCompositeSW(); |
| 160 | 164 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // used on data that must be modified immediately instead of being posted | 234 // used on data that must be modified immediately instead of being posted |
| 231 // back to UI. | 235 // back to UI. |
| 232 base::Lock render_thread_lock_; | 236 base::Lock render_thread_lock_; |
| 233 | 237 |
| 234 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 238 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 235 }; | 239 }; |
| 236 | 240 |
| 237 } // namespace android_webview | 241 } // namespace android_webview |
| 238 | 242 |
| 239 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 243 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |