diff options
Diffstat (limited to 'cc/resources/scoped_ui_resource.h')
-rw-r--r-- | cc/resources/scoped_ui_resource.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/cc/resources/scoped_ui_resource.h b/cc/resources/scoped_ui_resource.h index c257e1e..a4525e6 100644 --- a/cc/resources/scoped_ui_resource.h +++ b/cc/resources/scoped_ui_resource.h @@ -15,27 +15,28 @@ 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 request was due to lost -// resource or not. class CC_EXPORT ScopedUIResource : public UIResourceClient { public: - static scoped_ptr<ScopedUIResource> Create(LayerTreeHost* host, - const UIResourceBitmap& bitmap); + static scoped_ptr<ScopedUIResource> Create( + LayerTreeHost* host, + scoped_refptr<UIResourceBitmap> bitmap); virtual ~ScopedUIResource(); + gfx::Size GetSize() const; + // UIResourceClient implementation. - virtual UIResourceBitmap GetBitmap(UIResourceId uid, - bool resource_lost) OVERRIDE; + virtual scoped_refptr<UIResourceBitmap> GetBitmap( + UIResourceId uid, + bool resource_lost) OVERRIDE; UIResourceId id() { return id_; } protected: - ScopedUIResource(LayerTreeHost* host, const UIResourceBitmap& bitmap); + ScopedUIResource(LayerTreeHost* host, scoped_refptr<UIResourceBitmap> bitmap); + + // An empty default contructor for testing. + ScopedUIResource(); - UIResourceBitmap bitmap_; + scoped_refptr<UIResourceBitmap> bitmap_; LayerTreeHost* host_; UIResourceId id_; |