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> |
| 9 |
| 10 #include "base/callback.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
10 #include "content/public/browser/android/synchronous_compositor.h" | 13 #include "content/public/browser/android/synchronous_compositor.h" |
11 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/geometry/vector2d.h" | 15 #include "ui/gfx/geometry/vector2d.h" |
13 | 16 |
14 namespace android_webview { | 17 namespace android_webview { |
15 | 18 |
16 class BrowserViewRendererClient; | 19 class BrowserViewRendererClient; |
17 | 20 |
(...skipping 30 matching lines...) Expand all Loading... |
48 void ClientRequestDrawGL(); | 51 void ClientRequestDrawGL(); |
49 | 52 |
50 // This function should only be called on UI thread. | 53 // This function should only be called on UI thread. |
51 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); | 54 void SetCompositorOnUiThread(content::SynchronousCompositor* compositor); |
52 | 55 |
53 // This function can be called on both UI and RT thread. | 56 // This function can be called on both UI and RT thread. |
54 content::SynchronousCompositor* GetCompositor(); | 57 content::SynchronousCompositor* GetCompositor(); |
55 void SetDrawGLInput(const DrawGLInput& input); | 58 void SetDrawGLInput(const DrawGLInput& input); |
56 DrawGLInput GetDrawGLInput() const; | 59 DrawGLInput GetDrawGLInput() const; |
57 | 60 |
| 61 void ClearClosureQueue(); |
| 62 void AppendClosure(const base::Closure& closure); |
| 63 // Will return empty closure if queue empty. |
| 64 base::Closure PopFrontClosure(); |
| 65 |
| 66 void SetHardwareInitialized(bool initialized); |
| 67 bool IsHardwareInitialized() const; |
| 68 |
58 private: | 69 private: |
59 void ClientRequestDrawGLOnUIThread(); | 70 void ClientRequestDrawGLOnUIThread(); |
60 | 71 |
61 scoped_refptr<base::MessageLoopProxy> ui_loop_; | 72 scoped_refptr<base::MessageLoopProxy> ui_loop_; |
62 // TODO(boliu): Remove |client_on_ui_| from shared state. | 73 // TODO(boliu): Remove |client_on_ui_| from shared state. |
63 BrowserViewRendererClient* client_on_ui_; | 74 BrowserViewRendererClient* client_on_ui_; |
64 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; | 75 base::WeakPtrFactory<SharedRendererState> weak_factory_on_ui_thread_; |
65 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; | 76 base::WeakPtr<SharedRendererState> ui_thread_weak_ptr_; |
66 | 77 |
67 // Accessed by both UI and RT thread. | 78 // Accessed by both UI and RT thread. |
68 mutable base::Lock lock_; | 79 mutable base::Lock lock_; |
69 content::SynchronousCompositor* compositor_; | 80 content::SynchronousCompositor* compositor_; |
70 DrawGLInput draw_gl_input_; | 81 DrawGLInput draw_gl_input_; |
| 82 std::queue<base::Closure> closure_queue_; |
| 83 bool hardware_initialized_; |
71 }; | 84 }; |
72 | 85 |
73 } // namespace android_webview | 86 } // namespace android_webview |
74 | 87 |
75 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ | 88 #endif // ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ |
OLD | NEW |