#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();
bool OnRenderThread() const;
Key PushBack(RendererType view);
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);
};
}
#endif