|
OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CC_RESOURCES_SCOPED_UI_RESOURCE_H_ | |
6 #define CC_RESOURCES_SCOPED_UI_RESOURCE_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "cc/resources/ui_resource_bitmap.h" | |
10 #include "ui/gfx/size.h" | |
11 | |
12 namespace cc { | |
13 | |
14 class LayerTreeHost; | |
15 typedef int UIResourceId; | |
aelias_OOO_until_Jul13
2013/07/25 23:45:11
I'm not sure every compiler out there is happy wit
powei
2013/07/26 23:07:27
Where should this definition live? It could be in
aelias_OOO_until_Jul13
2013/07/26 23:35:31
ui_resource_client.h seems OK.
| |
16 | |
17 class ScopedUIResource : public base::RefCounted<ScopedUIResource> { | |
aelias_OOO_until_Jul13
2013/07/25 23:45:11
I don't see a reason to refcount this class, pleas
powei
2013/07/26 23:07:27
Done. Switched back to client-based.
| |
18 public: | |
19 static scoped_refptr<ScopedUIResource> Create( | |
20 LayerTreeHost* host, | |
21 scoped_refptr<UIResourceBitmap> bitmap); | |
22 | |
23 ~ScopedUIResource() { ClearResource(); } | |
aelias_OOO_until_Jul13
2013/07/25 23:45:11
This needs to call ReleaseResource, not ClearResou
powei
2013/07/26 23:07:27
Done.
| |
24 | |
25 void ClearResource(); | |
26 void ResetResource(LayerTreeHost* host, | |
aelias_OOO_until_Jul13
2013/07/25 23:45:11
On second thought, this method isn't needed after
powei
2013/07/26 23:07:27
Done.
| |
27 scoped_refptr<UIResourceBitmap> bitmap); | |
28 void ReleaseResource(LayerTreeHost* host); | |
29 UIResourceId id() const { return id_; } | |
30 | |
31 protected: | |
32 ScopedUIResource(LayerTreeHost* host, scoped_refptr<UIResourceBitmap> bitmap); | |
33 | |
34 UIResourceId id_; | |
35 scoped_refptr<UIResourceBitmap> bitmap_; | |
36 | |
37 private: | |
38 scoped_refptr<UIResourceBitmap> GetBitmap(bool resource_lost); | |
39 }; | |
40 | |
41 } // namespace cc | |
42 | |
43 #endif // CC_RESOURCES_SCOPED_UI_RESOURCE_H_ | |
OLD | NEW |