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_client.h" | 13 #include "content/public/browser/android/synchronous_compositor_client.h" |
14 #include "ui/gfx/vector2d_f.h" | 14 #include "ui/gfx/vector2d_f.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class SynchronousCompositor; | 17 class SynchronousCompositor; |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 typedef void* EGLContext; | 21 typedef void* EGLContext; |
22 class SkCanvas; | 22 class SkCanvas; |
23 | 23 |
24 namespace android_webview { | 24 namespace android_webview { |
25 | 25 |
| 26 class AwGLSurface; |
| 27 |
26 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 28 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
27 // IPC messages to the renderer and from there to WebKit. | 29 // IPC messages to the renderer and from there to WebKit. |
28 class InProcessViewRenderer : public BrowserViewRenderer, | 30 class InProcessViewRenderer : public BrowserViewRenderer, |
29 public content::SynchronousCompositorClient { | 31 public content::SynchronousCompositorClient { |
30 public: | 32 public: |
31 InProcessViewRenderer(BrowserViewRenderer::Client* client, | 33 InProcessViewRenderer(BrowserViewRenderer::Client* client, |
32 JavaHelper* java_helper, | 34 JavaHelper* java_helper, |
33 content::WebContents* web_contents); | 35 content::WebContents* web_contents); |
34 virtual ~InProcessViewRenderer(); | 36 virtual ~InProcessViewRenderer(); |
35 | 37 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool CompositeSW(SkCanvas* canvas); | 88 bool CompositeSW(SkCanvas* canvas); |
87 | 89 |
88 void UpdateCachedGlobalVisibleRect(); | 90 void UpdateCachedGlobalVisibleRect(); |
89 | 91 |
90 // If we call up view invalidate and OnDraw is not called before a deadline, | 92 // If we call up view invalidate and OnDraw is not called before a deadline, |
91 // then we keep ticking the SynchronousCompositor so it can make progress. | 93 // then we keep ticking the SynchronousCompositor so it can make progress. |
92 void FallbackTickFired(); | 94 void FallbackTickFired(); |
93 | 95 |
94 void NoLongerExpectsDrawGL(); | 96 void NoLongerExpectsDrawGL(); |
95 | 97 |
| 98 bool InitializeHwDraw(); |
| 99 |
96 // For debug tracing or logging. Return the string representation of this | 100 // For debug tracing or logging. Return the string representation of this |
97 // view renderer's state and the |draw_info| if provided. | 101 // view renderer's state and the |draw_info| if provided. |
98 std::string ToString(AwDrawGLInfo* draw_info) const; | 102 std::string ToString(AwDrawGLInfo* draw_info) const; |
99 | 103 |
100 BrowserViewRenderer::Client* client_; | 104 BrowserViewRenderer::Client* client_; |
101 BrowserViewRenderer::JavaHelper* java_helper_; | 105 BrowserViewRenderer::JavaHelper* java_helper_; |
102 content::WebContents* web_contents_; | 106 content::WebContents* web_contents_; |
103 content::SynchronousCompositor* compositor_; | 107 content::SynchronousCompositor* compositor_; |
104 | 108 |
105 bool visible_; | 109 bool visible_; |
(...skipping 14 matching lines...) Expand all Loading... |
120 | 124 |
121 // Holds a callback to FallbackTickFired while it is pending. | 125 // Holds a callback to FallbackTickFired while it is pending. |
122 base::CancelableClosure fallback_tick_; | 126 base::CancelableClosure fallback_tick_; |
123 | 127 |
124 int width_; | 128 int width_; |
125 int height_; | 129 int height_; |
126 | 130 |
127 bool attached_to_window_; | 131 bool attached_to_window_; |
128 bool hardware_initialized_; | 132 bool hardware_initialized_; |
129 bool hardware_failed_; | 133 bool hardware_failed_; |
| 134 scoped_refptr<AwGLSurface> gl_surface_; |
130 | 135 |
131 // Used only for detecting Android View System context changes. | 136 // Used only for detecting Android View System context changes. |
132 // Not to be used between draw calls. | 137 // Not to be used between draw calls. |
133 EGLContext last_egl_context_; | 138 EGLContext last_egl_context_; |
134 | 139 |
135 // Should always call UpdateCachedGlobalVisibleRect before using this. | 140 // Should always call UpdateCachedGlobalVisibleRect before using this. |
136 gfx::Rect cached_global_visible_rect_; | 141 gfx::Rect cached_global_visible_rect_; |
137 | 142 |
138 // Last View scroll when View.onDraw() was called. | 143 // Last View scroll when View.onDraw() was called. |
139 gfx::Vector2d scroll_at_start_of_frame_; | 144 gfx::Vector2d scroll_at_start_of_frame_; |
140 | 145 |
141 // Current scroll offset in CSS pixels. | 146 // Current scroll offset in CSS pixels. |
142 gfx::Vector2dF scroll_offset_css_; | 147 gfx::Vector2dF scroll_offset_css_; |
143 | 148 |
144 // Used to prevent rounding errors from accumulating enough to generate | 149 // Used to prevent rounding errors from accumulating enough to generate |
145 // visible skew (especially noticeable when scrolling up and down in the same | 150 // visible skew (especially noticeable when scrolling up and down in the same |
146 // spot over a period of time). | 151 // spot over a period of time). |
147 gfx::Vector2dF overscroll_rounding_error_; | 152 gfx::Vector2dF overscroll_rounding_error_; |
148 | 153 |
149 GLViewRendererManager::Key manager_key_; | 154 GLViewRendererManager::Key manager_key_; |
150 | 155 |
151 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 156 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
152 }; | 157 }; |
153 | 158 |
154 } // namespace android_webview | 159 } // namespace android_webview |
155 | 160 |
156 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ | 161 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |