blob: 1965c3e22e95c7bf5d156d2a25ae16b7b3232a22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_
#define ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_
#include <list>
#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
namespace android_webview {
class SharedRendererState;
class GLViewRendererManager {
public:
typedef SharedRendererState* RendererType;
private:
typedef std::list<RendererType> ListType;
public:
typedef ListType::iterator Key;
static GLViewRendererManager* GetInstance();
// TODO(boliu): Move RenderThread checking out of this class.
bool OnRenderThread() const;
Key PushBack(RendererType view);
// |key| must be already in manager. Move renderer corresponding to |key| to
// most recent.
void DidDrawGL(Key key);
void Remove(Key key);
RendererType GetMostRecentlyDrawn() const;
private:
friend struct base::DefaultLazyInstanceTraits<GLViewRendererManager>;
GLViewRendererManager();
~GLViewRendererManager();
void MarkRenderThread();
mutable base::Lock lock_;
base::PlatformThreadHandle render_thread_;
ListType mru_list_;
DISALLOW_COPY_AND_ASSIGN(GLViewRendererManager);
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_
|