Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHARED_RENDERER_STATE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "content/public/browser/android/synchronous_compositor.h" | 9 #include "content/public/browser/android/synchronous_compositor.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/geometry/vector2d.h" | 11 #include "ui/gfx/geometry/vector2d.h" |
| 12 | 12 |
| 13 namespace android_webview { | 13 namespace android_webview { |
| 14 | 14 |
| 15 class BrowserViewRendererClient; | 15 class BrowserViewRendererClient; |
| 16 | |
|
boliu
2014/04/28 22:22:15
spurious remove
hush (inactive)
2014/04/30 20:50:17
Done.
| |
| 17 // Set by BrowserViewRenderer and read by HardwareRenderer. | 16 // Set by BrowserViewRenderer and read by HardwareRenderer. |
| 18 struct DrawGLInput { | 17 struct DrawGLInput { |
| 19 unsigned int frame_id; | 18 unsigned int frame_id; |
| 20 gfx::Rect global_visible_rect; | 19 gfx::Rect global_visible_rect; |
| 21 gfx::Vector2d scroll_offset; | 20 gfx::Vector2d scroll_offset; |
| 22 int width; | 21 int width; |
| 23 int height; | 22 int height; |
| 24 | 23 |
| 25 DrawGLInput(); | 24 DrawGLInput(); |
| 26 }; | 25 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 44 BrowserViewRendererClient* client); | 43 BrowserViewRendererClient* client); |
| 45 ~SharedRendererState(); | 44 ~SharedRendererState(); |
| 46 | 45 |
| 47 void ClientRequestDrawGL(); | 46 void ClientRequestDrawGL(); |
| 48 | 47 |
| 49 // This function should only be called on UI thread. | 48 // This function should only be called on UI thread. |
| 50 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); | 49 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); |
| 51 | 50 |
| 52 // This function can be called on both UI and RT thread. | 51 // This function can be called on both UI and RT thread. |
| 53 content::SynchronousCompositor* GetCompositor(); | 52 content::SynchronousCompositor* GetCompositor(); |
| 53 | |
| 54 void SetMemoryPolicy(const content::SynchronousCompositorMemoryPolicy policy); | |
| 55 content::SynchronousCompositorMemoryPolicy GetMemoryPolicy() const; | |
| 56 | |
| 54 void SetDrawGLInput(const DrawGLInput& input); | 57 void SetDrawGLInput(const DrawGLInput& input); |
| 55 DrawGLInput GetDrawGLInput() const; | 58 DrawGLInput GetDrawGLInput() const; |
| 56 | 59 |
| 57 private: | 60 private: |
| 58 void ClientRequestDrawGLOnUIThread(); | 61 void ClientRequestDrawGLOnUIThread(); |
| 59 | 62 |
| 60 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 63 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
| 61 // TODO(boliu): Remove |client_on_ui_| from shared state. | 64 // TODO(boliu): Remove |client_on_ui_| from shared state. |
| 62 BrowserViewRendererClient* client_on_ui_; | 65 BrowserViewRendererClient* client_on_ui_; |
| 63 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 66 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
| 64 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 67 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
| 65 | 68 |
| 66 // Accessed by both UI and RT thread. | 69 // Accessed by both UI and RT thread. |
| 67 content::SynchronousCompositor* compositor_; | 70 content::SynchronousCompositor* compositor_; |
| 71 content::SynchronousCompositorMemoryPolicy memory_policy_; | |
| 68 DrawGLInput draw_gl_input_; | 72 DrawGLInput draw_gl_input_; |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 } // namespace android_webview | 75 } // namespace android_webview |
| 72 | 76 |
| 73 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 77 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| OLD | NEW |