| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "android_webview/browser/parent_compositor_draw_constraints.h" | 12 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
| 13 #include "android_webview/browser/shared_renderer_state.h" | 13 #include "android_webview/browser/render_thread_manager.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/cancelable_callback.h" | 15 #include "base/cancelable_callback.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "content/public/browser/android/synchronous_compositor.h" | 18 #include "content/public/browser/android/synchronous_compositor.h" |
| 19 #include "content/public/browser/android/synchronous_compositor_client.h" | 19 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 20 #include "skia/ext/refptr.h" | 20 #include "skia/ext/refptr.h" |
| 21 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 22 #include "ui/gfx/geometry/size_f.h" | 22 #include "ui/gfx/geometry/size_f.h" |
| 23 #include "ui/gfx/geometry/vector2d_f.h" | 23 #include "ui/gfx/geometry/vector2d_f.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 BrowserViewRenderer( | 45 BrowserViewRenderer( |
| 46 BrowserViewRendererClient* client, | 46 BrowserViewRendererClient* client, |
| 47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 47 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| 48 bool disable_page_visibility); | 48 bool disable_page_visibility); |
| 49 | 49 |
| 50 ~BrowserViewRenderer() override; | 50 ~BrowserViewRenderer() override; |
| 51 | 51 |
| 52 void RegisterWithWebContents(content::WebContents* web_contents); | 52 void RegisterWithWebContents(content::WebContents* web_contents); |
| 53 | 53 |
| 54 // The BrowserViewRenderer client is responsible for ensuring that the | 54 // The BrowserViewRenderer client is responsible for ensuring that the |
| 55 // SharedRendererState has been set correctly via this method. | 55 // RenderThreadManager has been set correctly via this method. |
| 56 void SetSharedRendererState(SharedRendererState* shared_renderer_state); | 56 void SetRenderThreadManager(RenderThreadManager* render_thread_manager); |
| 57 | 57 |
| 58 // Called before either OnDrawHardware or OnDrawSoftware to set the view | 58 // Called before either OnDrawHardware or OnDrawSoftware to set the view |
| 59 // state of this frame. |scroll| is the view's current scroll offset. | 59 // state of this frame. |scroll| is the view's current scroll offset. |
| 60 // |global_visible_rect| is the intersection of the view size and the window | 60 // |global_visible_rect| is the intersection of the view size and the window |
| 61 // in window coordinates. | 61 // in window coordinates. |
| 62 void PrepareToDraw(const gfx::Vector2d& scroll, | 62 void PrepareToDraw(const gfx::Vector2d& scroll, |
| 63 const gfx::Rect& global_visible_rect); | 63 const gfx::Rect& global_visible_rect); |
| 64 | 64 |
| 65 // Main handlers for view drawing. A false return value indicates no new | 65 // Main handlers for view drawing. A false return value indicates no new |
| 66 // frame is produced. | 66 // frame is produced. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 void UpdateMemoryPolicy(); | 142 void UpdateMemoryPolicy(); |
| 143 | 143 |
| 144 uint32_t GetCompositorID(content::SynchronousCompositor* compositor); | 144 uint32_t GetCompositorID(content::SynchronousCompositor* compositor); |
| 145 // For debug tracing or logging. Return the string representation of this | 145 // For debug tracing or logging. Return the string representation of this |
| 146 // view renderer's state. | 146 // view renderer's state. |
| 147 std::string ToString() const; | 147 std::string ToString() const; |
| 148 | 148 |
| 149 BrowserViewRendererClient* const client_; | 149 BrowserViewRendererClient* const client_; |
| 150 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 150 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 151 SharedRendererState* shared_renderer_state_; | 151 RenderThreadManager* render_thread_manager_; |
| 152 bool disable_page_visibility_; | 152 bool disable_page_visibility_; |
| 153 | 153 |
| 154 // The current compositor that's owned by the current RVH. | 154 // The current compositor that's owned by the current RVH. |
| 155 content::SynchronousCompositor* compositor_; | 155 content::SynchronousCompositor* compositor_; |
| 156 // A map from compositor's per-WebView unique ID to the compositor's raw | 156 // A map from compositor's per-WebView unique ID to the compositor's raw |
| 157 // pointer. A raw pointer here is fine because the entry will be erased when | 157 // pointer. A raw pointer here is fine because the entry will be erased when |
| 158 // a compositor is destroyed. | 158 // a compositor is destroyed. |
| 159 std::map<size_t, content::SynchronousCompositor*> compositor_map_; | 159 std::map<size_t, content::SynchronousCompositor*> compositor_map_; |
| 160 | 160 |
| 161 bool is_paused_; | 161 bool is_paused_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 uint32_t next_compositor_id_; | 196 uint32_t next_compositor_id_; |
| 197 | 197 |
| 198 ParentCompositorDrawConstraints external_draw_constraints_; | 198 ParentCompositorDrawConstraints external_draw_constraints_; |
| 199 | 199 |
| 200 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 200 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 } // namespace android_webview | 203 } // namespace android_webview |
| 204 | 204 |
| 205 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 205 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |