OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_IN_PROCESS_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "android_webview/browser/browser_view_renderer.h" | 10 #include "android_webview/browser/browser_view_renderer.h" |
11 #include "android_webview/browser/gl_view_renderer_manager.h" | 11 #include "android_webview/browser/gl_view_renderer_manager.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "content/public/browser/android/synchronous_compositor.h" |
13 #include "content/public/browser/android/synchronous_compositor_client.h" | 14 #include "content/public/browser/android/synchronous_compositor_client.h" |
14 #include "ui/gfx/vector2d_f.h" | 15 #include "ui/gfx/vector2d_f.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class SynchronousCompositor; | 18 class SynchronousCompositor; |
18 class WebContents; | 19 class WebContents; |
19 } | 20 } |
20 | 21 |
21 typedef void* EGLContext; | 22 typedef void* EGLContext; |
22 class SkCanvas; | 23 class SkCanvas; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual void SetViewVisibility(bool visible) OVERRIDE; | 65 virtual void SetViewVisibility(bool visible) OVERRIDE; |
65 virtual void SetWindowVisibility(bool visible) OVERRIDE; | 66 virtual void SetWindowVisibility(bool visible) OVERRIDE; |
66 virtual void OnSizeChanged(int width, int height) OVERRIDE; | 67 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
67 virtual void ScrollTo(gfx::Vector2d new_value) OVERRIDE; | 68 virtual void ScrollTo(gfx::Vector2d new_value) OVERRIDE; |
68 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; | 69 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; |
69 virtual void OnDetachedFromWindow() OVERRIDE; | 70 virtual void OnDetachedFromWindow() OVERRIDE; |
70 virtual void SetDipScale(float dip_scale) OVERRIDE; | 71 virtual void SetDipScale(float dip_scale) OVERRIDE; |
71 virtual bool IsAttachedToWindow() OVERRIDE; | 72 virtual bool IsAttachedToWindow() OVERRIDE; |
72 virtual bool IsVisible() OVERRIDE; | 73 virtual bool IsVisible() OVERRIDE; |
73 virtual gfx::Rect GetScreenRect() OVERRIDE; | 74 virtual gfx::Rect GetScreenRect() OVERRIDE; |
| 75 virtual void TrimMemory(int level) OVERRIDE; |
74 | 76 |
75 // SynchronousCompositorClient overrides | 77 // SynchronousCompositorClient overrides |
76 virtual void DidInitializeCompositor( | 78 virtual void DidInitializeCompositor( |
77 content::SynchronousCompositor* compositor) OVERRIDE; | 79 content::SynchronousCompositor* compositor) OVERRIDE; |
78 virtual void DidDestroyCompositor( | 80 virtual void DidDestroyCompositor( |
79 content::SynchronousCompositor* compositor) OVERRIDE; | 81 content::SynchronousCompositor* compositor) OVERRIDE; |
80 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; | 82 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
81 virtual void SetMaxRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; | 83 virtual void SetMaxRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; |
82 virtual void SetTotalRootLayerScrollOffset( | 84 virtual void SetTotalRootLayerScrollOffset( |
83 gfx::Vector2dF new_value_css) OVERRIDE; | 85 gfx::Vector2dF new_value_css) OVERRIDE; |
(...skipping 17 matching lines...) Expand all Loading... |
101 bool invalidate_ignore_compositor); | 103 bool invalidate_ignore_compositor); |
102 bool DrawSWInternal(jobject java_canvas, | 104 bool DrawSWInternal(jobject java_canvas, |
103 const gfx::Rect& clip_bounds); | 105 const gfx::Rect& clip_bounds); |
104 bool CompositeSW(SkCanvas* canvas); | 106 bool CompositeSW(SkCanvas* canvas); |
105 | 107 |
106 void UpdateCachedGlobalVisibleRect(); | 108 void UpdateCachedGlobalVisibleRect(); |
107 | 109 |
108 // If we call up view invalidate and OnDraw is not called before a deadline, | 110 // If we call up view invalidate and OnDraw is not called before a deadline, |
109 // then we keep ticking the SynchronousCompositor so it can make progress. | 111 // then we keep ticking the SynchronousCompositor so it can make progress. |
110 void FallbackTickFired(); | 112 void FallbackTickFired(); |
| 113 void ForceFakeCompositeSW(); |
111 | 114 |
112 void NoLongerExpectsDrawGL(); | 115 void NoLongerExpectsDrawGL(); |
113 | 116 |
114 bool InitializeHwDraw(); | 117 bool InitializeHwDraw(); |
115 | 118 |
116 gfx::Vector2d max_scroll_offset() const; | 119 gfx::Vector2d max_scroll_offset() const; |
117 | 120 |
| 121 void SetMemoryPolicy(content::SynchronousCompositorMemoryPolicy& new_policy); |
| 122 |
118 // For debug tracing or logging. Return the string representation of this | 123 // For debug tracing or logging. Return the string representation of this |
119 // view renderer's state and the |draw_info| if provided. | 124 // view renderer's state and the |draw_info| if provided. |
120 std::string ToString(AwDrawGLInfo* draw_info) const; | 125 std::string ToString(AwDrawGLInfo* draw_info) const; |
121 | 126 |
122 BrowserViewRenderer::Client* client_; | 127 BrowserViewRenderer::Client* client_; |
123 BrowserViewRenderer::JavaHelper* java_helper_; | 128 BrowserViewRenderer::JavaHelper* java_helper_; |
124 content::WebContents* web_contents_; | 129 content::WebContents* web_contents_; |
125 content::SynchronousCompositor* compositor_; | 130 content::SynchronousCompositor* compositor_; |
126 | 131 |
127 bool is_paused_; | 132 bool is_paused_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Max scroll offset in CSS pixels. | 174 // Max scroll offset in CSS pixels. |
170 gfx::Vector2dF max_scroll_offset_dip_; | 175 gfx::Vector2dF max_scroll_offset_dip_; |
171 | 176 |
172 // Used to prevent rounding errors from accumulating enough to generate | 177 // Used to prevent rounding errors from accumulating enough to generate |
173 // visible skew (especially noticeable when scrolling up and down in the same | 178 // visible skew (especially noticeable when scrolling up and down in the same |
174 // spot over a period of time). | 179 // spot over a period of time). |
175 gfx::Vector2dF overscroll_rounding_error_; | 180 gfx::Vector2dF overscroll_rounding_error_; |
176 | 181 |
177 GLViewRendererManager::Key manager_key_; | 182 GLViewRendererManager::Key manager_key_; |
178 | 183 |
| 184 content::SynchronousCompositorMemoryPolicy memory_policy_; |
| 185 |
179 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 186 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
180 }; | 187 }; |
181 | 188 |
182 } // namespace android_webview | 189 } // namespace android_webview |
183 | 190 |
184 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ | 191 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |