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 <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 BrowserViewRendererClient* client); | 48 BrowserViewRendererClient* client); |
49 ~SharedRendererState(); | 49 ~SharedRendererState(); |
50 | 50 |
51 void ClientRequestDrawGL(); | 51 void ClientRequestDrawGL(); |
52 | 52 |
53 // This function should only be called on UI thread. | 53 // This function should only be called on UI thread. |
54 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); | 54 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); |
55 | 55 |
56 // This function can be called on both UI and RT thread. | 56 // This function can be called on both UI and RT thread. |
57 content::SynchronousCompositor* GetCompositor(); | 57 content::SynchronousCompositor* GetCompositor(); |
| 58 |
| 59 void SetMemoryPolicy(const content::SynchronousCompositorMemoryPolicy policy); |
| 60 content::SynchronousCompositorMemoryPolicy GetMemoryPolicy() const; |
| 61 |
| 62 void SetMemoryPolicyDirty(bool is_dirty); |
| 63 bool IsMemoryPolicyDirty() const; |
58 void SetDrawGLInput(const DrawGLInput& input); | 64 void SetDrawGLInput(const DrawGLInput& input); |
59 DrawGLInput GetDrawGLInput() const; | 65 DrawGLInput GetDrawGLInput() const; |
60 | 66 |
61 void ClearClosureQueue(); | 67 void ClearClosureQueue(); |
62 void AppendClosure(const base::Closure& closure); | 68 void AppendClosure(const base::Closure& closure); |
63 // Will return empty closure if queue empty. | 69 // Will return empty closure if queue empty. |
64 base::Closure PopFrontClosure(); | 70 base::Closure PopFrontClosure(); |
65 | 71 |
66 void SetHardwareInitialized(bool initialized); | 72 void SetHardwareInitialized(bool initialized); |
67 bool IsHardwareInitialized() const; | 73 bool IsHardwareInitialized() const; |
68 | 74 |
69 private: | 75 private: |
70 void ClientRequestDrawGLOnUIThread(); | 76 void ClientRequestDrawGLOnUIThread(); |
71 | 77 |
72 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 78 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
73 // TODO(boliu): Remove |client_on_ui_| from shared state. | 79 // TODO(boliu): Remove |client_on_ui_| from shared state. |
74 BrowserViewRendererClient* client_on_ui_; | 80 BrowserViewRendererClient* client_on_ui_; |
75 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 81 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
76 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 82 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
77 | 83 |
78 // Accessed by both UI and RT thread. | 84 // Accessed by both UI and RT thread. |
79 mutable base::Lock lock_; | 85 mutable base::Lock lock_; |
80 content::SynchronousCompositor* compositor_; | 86 content::SynchronousCompositor* compositor_; |
| 87 content::SynchronousCompositorMemoryPolicy memory_policy_; |
| 88 // Set to true when SetMemoryPolicy called with a different memory policy. |
| 89 // Set to false when memory policy is read and enforced to compositor. |
| 90 bool memory_policy_dirty_; |
81 DrawGLInput draw_gl_input_; | 91 DrawGLInput draw_gl_input_; |
82 std::queue<base::Closure> closure_queue_; | 92 std::queue<base::Closure> closure_queue_; |
83 bool hardware_initialized_; | 93 bool hardware_initialized_; |
84 }; | 94 }; |
85 | 95 |
86 } // namespace android_webview | 96 } // namespace android_webview |
87 | 97 |
88 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 98 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
OLD | NEW |