| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 BrowserViewRendererClient* client); | 44 BrowserViewRendererClient* client); |
| 45 ~SharedRendererState(); | 45 ~SharedRendererState(); |
| 46 | 46 |
| 47 void ClientRequestDrawGL(); | 47 void ClientRequestDrawGL(); |
| 48 | 48 |
| 49 // This function should only be called on UI thread. | 49 // This function should only be called on UI thread. |
| 50 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); | 50 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); |
| 51 | 51 |
| 52 // This function can be called on both UI and RT thread. | 52 // This function can be called on both UI and RT thread. |
| 53 content::SynchronousCompositor* GetCompositor(); | 53 content::SynchronousCompositor* GetCompositor(); |
| 54 |
| 55 void SetMemoryPolicy(const content::SynchronousCompositorMemoryPolicy policy); |
| 56 content::SynchronousCompositorMemoryPolicy GetMemoryPolicy() const; |
| 57 |
| 58 void SetMemoryPolicyDirty(bool is_dirty); |
| 59 bool IsMemoryPolicyDirty() const; |
| 54 void SetDrawGLInput(const DrawGLInput& input); | 60 void SetDrawGLInput(const DrawGLInput& input); |
| 55 DrawGLInput GetDrawGLInput() const; | 61 DrawGLInput GetDrawGLInput() const; |
| 56 | 62 |
| 57 private: | 63 private: |
| 58 void ClientRequestDrawGLOnUIThread(); | 64 void ClientRequestDrawGLOnUIThread(); |
| 59 | 65 |
| 60 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 66 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
| 61 // TODO(boliu): Remove |client_on_ui_| from shared state. | 67 // TODO(boliu): Remove |client_on_ui_| from shared state. |
| 62 BrowserViewRendererClient* client_on_ui_; | 68 BrowserViewRendererClient* client_on_ui_; |
| 63 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 69 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
| 64 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 70 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
| 65 | 71 |
| 66 // Accessed by both UI and RT thread. | 72 // Accessed by both UI and RT thread. |
| 67 content::SynchronousCompositor* compositor_; | 73 content::SynchronousCompositor* compositor_; |
| 74 content::SynchronousCompositorMemoryPolicy memory_policy_; |
| 75 // Set to true when SetMemoryPolicy called with a different memory policy. |
| 76 // Set to false when memory policy is read and enforced to compositor. |
| 77 bool memory_policy_dirty_; |
| 68 DrawGLInput draw_gl_input_; | 78 DrawGLInput draw_gl_input_; |
| 69 }; | 79 }; |
| 70 | 80 |
| 71 } // namespace android_webview | 81 } // namespace android_webview |
| 72 | 82 |
| 73 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 83 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
| OLD | NEW |