| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const gfx::Vector2dF& max_scroll_offset_dip, | 123 const gfx::Vector2dF& max_scroll_offset_dip, |
| 124 const gfx::SizeF& scrollable_size_dip, | 124 const gfx::SizeF& scrollable_size_dip, |
| 125 float page_scale_factor, | 125 float page_scale_factor, |
| 126 float min_page_scale_factor, | 126 float min_page_scale_factor, |
| 127 float max_page_scale_factor) override; | 127 float max_page_scale_factor) override; |
| 128 void DidOverscroll(content::SynchronousCompositor* compositor, | 128 void DidOverscroll(content::SynchronousCompositor* compositor, |
| 129 const gfx::Vector2dF& accumulated_overscroll, | 129 const gfx::Vector2dF& accumulated_overscroll, |
| 130 const gfx::Vector2dF& latest_overscroll_delta, | 130 const gfx::Vector2dF& latest_overscroll_delta, |
| 131 const gfx::Vector2dF& current_fling_velocity) override; | 131 const gfx::Vector2dF& current_fling_velocity) override; |
| 132 ui::TouchHandleDrawable* CreateDrawable() override; | 132 ui::TouchHandleDrawable* CreateDrawable() override; |
| 133 void OnDrawHardwareProcessFrame( |
| 134 content::SynchronousCompositor::Frame frame) override; |
| 133 | 135 |
| 134 // CompositorFrameProducer overrides | 136 // CompositorFrameProducer overrides |
| 135 void OnParentDrawConstraintsUpdated( | 137 void OnParentDrawConstraintsUpdated( |
| 136 CompositorFrameConsumer* compositor_frame_consumer) override; | 138 CompositorFrameConsumer* compositor_frame_consumer) override; |
| 137 void RemoveCompositorFrameConsumer( | 139 void RemoveCompositorFrameConsumer( |
| 138 CompositorFrameConsumer* compositor_frame_consumer) override; | 140 CompositorFrameConsumer* compositor_frame_consumer) override; |
| 139 | 141 |
| 140 void SetActiveCompositorID(const CompositorID& compositor_id); | 142 void SetActiveCompositorID(const CompositorID& compositor_id); |
| 141 | 143 |
| 142 // Visible for testing. | 144 // Visible for testing. |
| 143 content::SynchronousCompositor* GetActiveCompositorForTesting() const { | 145 content::SynchronousCompositor* GetActiveCompositorForTesting() const { |
| 144 return compositor_; | 146 return compositor_; |
| 145 } | 147 } |
| 146 | 148 |
| 147 private: | 149 private: |
| 148 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip); | 150 void SetTotalRootLayerScrollOffset(const gfx::Vector2dF& new_value_dip); |
| 149 bool CanOnDraw(); | 151 bool CanOnDraw(); |
| 150 bool CompositeSW(SkCanvas* canvas); | 152 bool CompositeSW(SkCanvas* canvas); |
| 151 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 153 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 152 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, | 154 RootLayerStateAsValue(const gfx::Vector2dF& total_scroll_offset_dip, |
| 153 const gfx::SizeF& scrollable_size_dip); | 155 const gfx::SizeF& scrollable_size_dip); |
| 154 | 156 |
| 155 void ReturnUnusedResource(std::unique_ptr<ChildFrame> frame); | 157 void ReturnUnusedResource(std::unique_ptr<ChildFrame> frame); |
| 156 void ReturnResourceFromParent( | 158 void ReturnResourceFromParent( |
| 157 CompositorFrameConsumer* compositor_frame_consumer); | 159 CompositorFrameConsumer* compositor_frame_consumer); |
| 158 void ReleaseHardware(); | 160 void ReleaseHardware(); |
| 161 gfx::Rect ComputeViewportRectForTilePriority(); |
| 159 | 162 |
| 160 gfx::Vector2d max_scroll_offset() const; | 163 gfx::Vector2d max_scroll_offset() const; |
| 161 | 164 |
| 162 void UpdateMemoryPolicy(); | 165 void UpdateMemoryPolicy(); |
| 163 | 166 |
| 164 content::SynchronousCompositor* FindCompositor( | 167 content::SynchronousCompositor* FindCompositor( |
| 165 const CompositorID& compositor_id) const; | 168 const CompositorID& compositor_id) const; |
| 166 // For debug tracing or logging. Return the string representation of this | 169 // For debug tracing or logging. Return the string representation of this |
| 167 // view renderer's state. | 170 // view renderer's state. |
| 168 std::string ToString() const; | 171 std::string ToString() const; |
| 169 | 172 |
| 170 BrowserViewRendererClient* const client_; | 173 BrowserViewRendererClient* const client_; |
| 171 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 174 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 175 const bool async_on_draw_hardware_; |
| 172 CompositorFrameConsumer* current_compositor_frame_consumer_; | 176 CompositorFrameConsumer* current_compositor_frame_consumer_; |
| 173 std::set<CompositorFrameConsumer*> compositor_frame_consumers_; | 177 std::set<CompositorFrameConsumer*> compositor_frame_consumers_; |
| 174 | 178 |
| 175 // The current compositor that's owned by the current RVH. | 179 // The current compositor that's owned by the current RVH. |
| 176 content::SynchronousCompositor* compositor_; | 180 content::SynchronousCompositor* compositor_; |
| 177 // The process id and routing id of the most recent RVH according to | 181 // The process id and routing id of the most recent RVH according to |
| 178 // RVHChanged. | 182 // RVHChanged. |
| 179 CompositorID compositor_id_; | 183 CompositorID compositor_id_; |
| 180 // A map from compositor's per-WebView unique ID to the compositor's raw | 184 // A map from compositor's per-WebView unique ID to the compositor's raw |
| 181 // pointer. A raw pointer here is fine because the entry will be erased when | 185 // pointer. A raw pointer here is fine because the entry will be erased when |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 gfx::Vector2dF overscroll_rounding_error_; | 225 gfx::Vector2dF overscroll_rounding_error_; |
| 222 | 226 |
| 223 ParentCompositorDrawConstraints external_draw_constraints_; | 227 ParentCompositorDrawConstraints external_draw_constraints_; |
| 224 | 228 |
| 225 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 229 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 226 }; | 230 }; |
| 227 | 231 |
| 228 } // namespace android_webview | 232 } // namespace android_webview |
| 229 | 233 |
| 230 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 234 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |