Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Unified Diff: cc/resources/scoped_ui_resource.h

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments by danakj and aelias. Modified tests. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/scoped_ui_resource.h
diff --git a/cc/resources/scoped_ui_resource.h b/cc/resources/scoped_ui_resource.h
index 628d372c552f2707965b2011731dc3db4b0cc141..2790ecb90b8fcc0fdc75b38d00691844c51af85d 100644
--- a/cc/resources/scoped_ui_resource.h
+++ b/cc/resources/scoped_ui_resource.h
@@ -15,6 +15,12 @@ namespace cc {
class LayerTreeHost;
+// ScopedUIResource creates an UIResource from a bitmap and a LayerTreeHost.
+// This class holds a pointer to the host so that when the instance goes out of
+// scope, the created resource is deleted. On a GetBitmap call from the
+// UIResource manager, ScopeUIResource always returns the reference to the
+// initially given bitmap, regardless of whether the resquest was because of
+// lost resource or not.
class CC_EXPORT ScopedUIResource : public UIResourceClient {
public:
static scoped_ptr<ScopedUIResource> Create(
@@ -22,10 +28,12 @@ class CC_EXPORT ScopedUIResource : public UIResourceClient {
scoped_refptr<UIResourceBitmap> bitmap);
virtual ~ScopedUIResource();
+ // UIResourceClient implementation.
virtual scoped_refptr<UIResourceBitmap> GetBitmap(
UIResourceId uid,
bool resource_lost) OVERRIDE;
- UIResourceId id() { return id_; }
+
+ UIResourceId id();
protected:
ScopedUIResource(LayerTreeHost* host, scoped_refptr<UIResourceBitmap> bitmap);

Powered by Google App Engine
This is Rietveld 408576698