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_IN_PROCESS_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
7 | 7 |
8 #include "android_webview/browser/browser_view_renderer.h" | 8 #include "android_webview/browser/browser_view_renderer.h" |
9 | 9 |
| 10 #include "base/cancelable_callback.h" |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "content/public/browser/android/synchronous_compositor_client.h" | 12 #include "content/public/browser/android/synchronous_compositor_client.h" |
12 #include "ui/gfx/vector2d_f.h" | 13 #include "ui/gfx/vector2d_f.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class SynchronousCompositor; | 16 class SynchronousCompositor; |
16 class WebContents; | 17 class WebContents; |
17 } | 18 } |
18 | 19 |
19 typedef void* EGLContext; | 20 typedef void* EGLContext; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual void SetTotalRootLayerScrollOffset( | 62 virtual void SetTotalRootLayerScrollOffset( |
62 gfx::Vector2dF new_value_css) OVERRIDE; | 63 gfx::Vector2dF new_value_css) OVERRIDE; |
63 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; | 64 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; |
64 | 65 |
65 void WebContentsGone(); | 66 void WebContentsGone(); |
66 | 67 |
67 private: | 68 private: |
68 void EnsureContinuousInvalidation(AwDrawGLInfo* draw_info); | 69 void EnsureContinuousInvalidation(AwDrawGLInfo* draw_info); |
69 bool DrawSWInternal(jobject java_canvas, | 70 bool DrawSWInternal(jobject java_canvas, |
70 const gfx::Rect& clip_bounds); | 71 const gfx::Rect& clip_bounds); |
71 bool RenderSW(SkCanvas* canvas); | |
72 bool CompositeSW(SkCanvas* canvas); | 72 bool CompositeSW(SkCanvas* canvas); |
73 | 73 |
| 74 // If we call up view invalidate and OnDraw is not called before a deadline, |
| 75 // then we keep ticking the SynchronousCompositor so it can make progress. |
| 76 void FallbackTickFired(); |
| 77 |
74 BrowserViewRenderer::Client* client_; | 78 BrowserViewRenderer::Client* client_; |
75 BrowserViewRenderer::JavaHelper* java_helper_; | 79 BrowserViewRenderer::JavaHelper* java_helper_; |
76 content::WebContents* web_contents_; | 80 content::WebContents* web_contents_; |
77 content::SynchronousCompositor* compositor_; | 81 content::SynchronousCompositor* compositor_; |
78 | 82 |
79 bool visible_; | 83 bool visible_; |
80 float dip_scale_; | 84 float dip_scale_; |
81 | 85 |
82 // When true, we should continuously invalidate and keep drawing, for example | 86 // When true, we should continuously invalidate and keep drawing, for example |
83 // to drive animation. | 87 // to drive animation. |
84 bool continuous_invalidate_; | 88 bool continuous_invalidate_; |
85 // Used to block additional invalidates while one is already pending or before | 89 // Used to block additional invalidates while one is already pending or before |
86 // compositor draw which may switch continuous_invalidate on and off in the | 90 // compositor draw which may switch continuous_invalidate on and off in the |
87 // process. | 91 // process. |
88 bool block_invalidates_; | 92 bool block_invalidates_; |
| 93 // Holds a callback to FallbackTickFired while it is pending. |
| 94 base::CancelableClosure fallback_tick_; |
89 | 95 |
90 int width_; | 96 int width_; |
91 int height_; | 97 int height_; |
92 | 98 |
93 bool attached_to_window_; | 99 bool attached_to_window_; |
94 bool hardware_initialized_; | 100 bool hardware_initialized_; |
95 bool hardware_failed_; | 101 bool hardware_failed_; |
96 | 102 |
97 // Used only for detecting Android View System context changes. | 103 // Used only for detecting Android View System context changes. |
98 // Not to be used between draw calls. | 104 // Not to be used between draw calls. |
99 EGLContext last_egl_context_; | 105 EGLContext last_egl_context_; |
100 | 106 |
101 // Last View scroll when View.onDraw() was called. | 107 // Last View scroll when View.onDraw() was called. |
102 gfx::Vector2d scroll_at_start_of_frame_; | 108 gfx::Vector2d scroll_at_start_of_frame_; |
103 | 109 |
104 // Current scroll offset in CSS pixels. | 110 // Current scroll offset in CSS pixels. |
105 gfx::Vector2dF scroll_offset_css_; | 111 gfx::Vector2dF scroll_offset_css_; |
106 | 112 |
107 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 113 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
108 }; | 114 }; |
109 | 115 |
110 } // namespace android_webview | 116 } // namespace android_webview |
111 | 117 |
112 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 118 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |