OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_GL_VIEW_RENDERER_MANAGER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/synchronization/lock.h" |
| 12 #include "base/threading/platform_thread.h" |
11 | 13 |
12 namespace android_webview { | 14 namespace android_webview { |
13 | 15 |
14 class BrowserViewRenderer; | 16 class BrowserViewRenderer; |
15 | 17 |
16 class GLViewRendererManager { | 18 class GLViewRendererManager { |
17 typedef std::list<BrowserViewRenderer*> ListType; | 19 typedef std::list<BrowserViewRenderer*> ListType; |
18 public: | 20 public: |
19 typedef ListType::iterator Key; | 21 typedef ListType::iterator Key; |
20 | 22 |
21 GLViewRendererManager(); | 23 GLViewRendererManager(); |
22 ~GLViewRendererManager(); | 24 ~GLViewRendererManager(); |
23 | 25 |
| 26 bool OnRenderThread() const; |
| 27 |
24 // If |key| is NullKey(), then |view| is inserted at the front and a new key | 28 // If |key| is NullKey(), then |view| is inserted at the front and a new key |
25 // is returned. Otherwise |key| must point to |view| which is moved to the | 29 // is returned. Otherwise |key| must point to |view| which is moved to the |
26 // front. | 30 // front. |
27 Key DidDrawGL(Key key, BrowserViewRenderer* view); | 31 Key DidDrawGL(Key key, BrowserViewRenderer* view); |
28 | 32 |
29 void NoLongerExpectsDrawGL(Key key); | 33 void NoLongerExpectsDrawGL(Key key); |
30 | 34 |
31 BrowserViewRenderer* GetMostRecentlyDrawn() const; | 35 BrowserViewRenderer* GetMostRecentlyDrawn() const; |
32 | 36 |
33 Key NullKey(); | 37 Key NullKey(); |
34 | 38 |
35 private: | 39 private: |
| 40 void MarkRenderThread(); |
| 41 |
| 42 mutable base::Lock lock_; |
| 43 base::PlatformThreadHandle render_thread_; |
36 ListType mru_list_; | 44 ListType mru_list_; |
37 | 45 |
38 DISALLOW_COPY_AND_ASSIGN(GLViewRendererManager); | 46 DISALLOW_COPY_AND_ASSIGN(GLViewRendererManager); |
39 }; | 47 }; |
40 | 48 |
41 } // namespace android_webview | 49 } // namespace android_webview |
42 | 50 |
43 #endif // ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_ | 51 #endif // ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_ |
OLD | NEW |