Connect SimpleCache Backend active_entries_ more closely to Entry lifetime.
[chromium-blink-merge.git] / android_webview / browser / gl_view_renderer_manager.h
blobf34d9cb261eeec555d7c63fbdf7fc9810a0a4160
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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_
6 #define ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_
8 #include <list>
10 #include "base/basictypes.h"
11 #include "base/lazy_instance.h"
12 #include "base/synchronization/lock.h"
13 #include "base/threading/platform_thread.h"
15 namespace android_webview {
17 class SharedRendererState;
19 class GLViewRendererManager {
20 public:
21 typedef SharedRendererState* RendererType;
23 private:
24 typedef std::list<RendererType> ListType;
26 public:
27 typedef ListType::iterator Key;
29 static GLViewRendererManager* GetInstance();
31 Key NullKey();
33 Key PushBack(RendererType view);
35 // |key| must be already in manager. Move renderer corresponding to |key| to
36 // most recent.
37 void DidDrawGL(Key key);
39 void Remove(Key key);
41 RendererType GetMostRecentlyDrawn() const;
43 private:
44 friend struct base::DefaultLazyInstanceTraits<GLViewRendererManager>;
46 GLViewRendererManager();
47 ~GLViewRendererManager();
49 mutable base::Lock lock_;
50 ListType mru_list_;
52 DISALLOW_COPY_AND_ASSIGN(GLViewRendererManager);
55 } // namespace android_webview
57 #endif // ANDROID_WEBVIEW_BROWSER_GL_VIEW_RENDERER_MANAGER_H_