| 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 "android_webview/browser/parent_compositor_draw_constraints.h" | 8 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
| 9 #include "android_webview/browser/shared_renderer_state.h" | 9 #include "android_webview/browser/shared_renderer_state.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "content/public/browser/android/synchronous_compositor.h" | 13 #include "content/public/browser/android/synchronous_compositor.h" |
| 14 #include "content/public/browser/android/synchronous_compositor_client.h" | 14 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/vector2d_f.h" | 16 #include "ui/gfx/geometry/vector2d_f.h" |
| 17 | 17 |
| 18 class SkCanvas; | 18 class SkCanvas; |
| 19 class SkPicture; | 19 class SkPicture; |
| 20 | 20 |
| 21 namespace content { |
| 22 class WebContents; |
| 23 } |
| 24 |
| 21 namespace android_webview { | 25 namespace android_webview { |
| 22 | 26 |
| 23 class BrowserViewRendererClient; | 27 class BrowserViewRendererClient; |
| 24 | 28 |
| 25 // Interface for all the WebView-specific content rendering operations. | 29 // Interface for all the WebView-specific content rendering operations. |
| 26 // Provides software and hardware rendering and the Capture Picture API. | 30 // Provides software and hardware rendering and the Capture Picture API. |
| 27 class BrowserViewRenderer : public content::SynchronousCompositorClient { | 31 class BrowserViewRenderer : public content::SynchronousCompositorClient { |
| 28 public: | 32 public: |
| 29 static void CalculateTileMemoryPolicy(); | 33 static void CalculateTileMemoryPolicy(); |
| 34 static BrowserViewRenderer* FromWebContents( |
| 35 content::WebContents* web_contents); |
| 30 | 36 |
| 31 BrowserViewRenderer( | 37 BrowserViewRenderer( |
| 32 BrowserViewRendererClient* client, | 38 BrowserViewRendererClient* client, |
| 33 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); | 39 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); |
| 34 | 40 |
| 35 ~BrowserViewRenderer() override; | 41 ~BrowserViewRenderer() override; |
| 36 | 42 |
| 43 void RegisterWithWebContents(content::WebContents* web_contents); |
| 44 |
| 37 SharedRendererState* GetAwDrawGLViewContext(); | 45 SharedRendererState* GetAwDrawGLViewContext(); |
| 38 bool RequestDrawGL(bool wait_for_completion); | 46 bool RequestDrawGL(bool wait_for_completion); |
| 39 | 47 |
| 40 // Called before either OnDrawHardware or OnDrawSoftware to set the view | 48 // Called before either OnDrawHardware or OnDrawSoftware to set the view |
| 41 // state of this frame. |scroll| is the view's current scroll offset. | 49 // state of this frame. |scroll| is the view's current scroll offset. |
| 42 // |global_visible_rect| is the intersection of the view size and the window | 50 // |global_visible_rect| is the intersection of the view size and the window |
| 43 // in window coordinates. | 51 // in window coordinates. |
| 44 void PrepareToDraw(const gfx::Vector2d& scroll, | 52 void PrepareToDraw(const gfx::Vector2d& scroll, |
| 45 const gfx::Rect& global_visible_rect); | 53 const gfx::Rect& global_visible_rect); |
| 46 | 54 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // visible skew (especially noticeable when scrolling up and down in the same | 200 // visible skew (especially noticeable when scrolling up and down in the same |
| 193 // spot over a period of time). | 201 // spot over a period of time). |
| 194 gfx::Vector2dF overscroll_rounding_error_; | 202 gfx::Vector2dF overscroll_rounding_error_; |
| 195 | 203 |
| 196 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 204 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 197 }; | 205 }; |
| 198 | 206 |
| 199 } // namespace android_webview | 207 } // namespace android_webview |
| 200 | 208 |
| 201 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 209 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |