Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: android_webview/browser/in_process_view_renderer.h

Issue 22277004: Add gfx::SurfaceFactoryWebview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: null out on detach Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 namespace gfx {
22 class GLSurface;
23 }
24
21 typedef void* EGLContext; 25 typedef void* EGLContext;
22 class SkCanvas; 26 class SkCanvas;
23 27
24 namespace android_webview { 28 namespace android_webview {
25 29
30 class AwGLSurface;
31
26 // Provides RenderViewHost wrapper functionality for sending WebView-specific 32 // Provides RenderViewHost wrapper functionality for sending WebView-specific
27 // IPC messages to the renderer and from there to WebKit. 33 // IPC messages to the renderer and from there to WebKit.
28 class InProcessViewRenderer : public BrowserViewRenderer, 34 class InProcessViewRenderer : public BrowserViewRenderer,
29 public content::SynchronousCompositorClient { 35 public content::SynchronousCompositorClient {
30 public: 36 public:
31 InProcessViewRenderer(BrowserViewRenderer::Client* client, 37 InProcessViewRenderer(BrowserViewRenderer::Client* client,
32 JavaHelper* java_helper, 38 JavaHelper* java_helper,
33 content::WebContents* web_contents); 39 content::WebContents* web_contents);
34 virtual ~InProcessViewRenderer(); 40 virtual ~InProcessViewRenderer();
35 41
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool CompositeSW(SkCanvas* canvas); 92 bool CompositeSW(SkCanvas* canvas);
87 93
88 void UpdateCachedGlobalVisibleRect(); 94 void UpdateCachedGlobalVisibleRect();
89 95
90 // If we call up view invalidate and OnDraw is not called before a deadline, 96 // 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. 97 // then we keep ticking the SynchronousCompositor so it can make progress.
92 void FallbackTickFired(); 98 void FallbackTickFired();
93 99
94 void NoLongerExpectsDrawGL(); 100 void NoLongerExpectsDrawGL();
95 101
102 scoped_refptr<gfx::GLSurface> CreateGLSurface();
103 bool InitializeHwDraw();
104
96 // For debug tracing or logging. Return the string representation of this 105 // For debug tracing or logging. Return the string representation of this
97 // view renderer's state and the |draw_info| if provided. 106 // view renderer's state and the |draw_info| if provided.
98 std::string ToString(AwDrawGLInfo* draw_info) const; 107 std::string ToString(AwDrawGLInfo* draw_info) const;
99 108
100 BrowserViewRenderer::Client* client_; 109 BrowserViewRenderer::Client* client_;
101 BrowserViewRenderer::JavaHelper* java_helper_; 110 BrowserViewRenderer::JavaHelper* java_helper_;
102 content::WebContents* web_contents_; 111 content::WebContents* web_contents_;
103 content::SynchronousCompositor* compositor_; 112 content::SynchronousCompositor* compositor_;
104 113
105 bool visible_; 114 bool visible_;
(...skipping 14 matching lines...) Expand all
120 129
121 // Holds a callback to FallbackTickFired while it is pending. 130 // Holds a callback to FallbackTickFired while it is pending.
122 base::CancelableClosure fallback_tick_; 131 base::CancelableClosure fallback_tick_;
123 132
124 int width_; 133 int width_;
125 int height_; 134 int height_;
126 135
127 bool attached_to_window_; 136 bool attached_to_window_;
128 bool hardware_initialized_; 137 bool hardware_initialized_;
129 bool hardware_failed_; 138 bool hardware_failed_;
139 scoped_refptr<AwGLSurface> gl_surface_;
130 140
131 // Used only for detecting Android View System context changes. 141 // Used only for detecting Android View System context changes.
132 // Not to be used between draw calls. 142 // Not to be used between draw calls.
133 EGLContext last_egl_context_; 143 EGLContext last_egl_context_;
134 144
135 // Should always call UpdateCachedGlobalVisibleRect before using this. 145 // Should always call UpdateCachedGlobalVisibleRect before using this.
136 gfx::Rect cached_global_visible_rect_; 146 gfx::Rect cached_global_visible_rect_;
137 147
138 // Last View scroll when View.onDraw() was called. 148 // Last View scroll when View.onDraw() was called.
139 gfx::Vector2d scroll_at_start_of_frame_; 149 gfx::Vector2d scroll_at_start_of_frame_;
140 150
141 // Current scroll offset in CSS pixels. 151 // Current scroll offset in CSS pixels.
142 gfx::Vector2dF scroll_offset_css_; 152 gfx::Vector2dF scroll_offset_css_;
143 153
144 // Used to prevent rounding errors from accumulating enough to generate 154 // Used to prevent rounding errors from accumulating enough to generate
145 // visible skew (especially noticeable when scrolling up and down in the same 155 // visible skew (especially noticeable when scrolling up and down in the same
146 // spot over a period of time). 156 // spot over a period of time).
147 gfx::Vector2dF overscroll_rounding_error_; 157 gfx::Vector2dF overscroll_rounding_error_;
148 158
149 GLViewRendererManager::Key manager_key_; 159 GLViewRendererManager::Key manager_key_;
150 160
151 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); 161 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer);
152 }; 162 };
153 163
154 } // namespace android_webview 164 } // namespace android_webview
155 165
156 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ 166 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698