| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
| 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // The ResourceManager serves as a cache for resources obtained through Android | 39 // The ResourceManager serves as a cache for resources obtained through Android |
| 40 // APIs and consumed by the compositor. | 40 // APIs and consumed by the compositor. |
| 41 class UI_ANDROID_EXPORT ResourceManager { | 41 class UI_ANDROID_EXPORT ResourceManager { |
| 42 public: | 42 public: |
| 43 struct Resource { | 43 struct Resource { |
| 44 public: | 44 public: |
| 45 Resource(); | 45 Resource(); |
| 46 ~Resource(); | 46 ~Resource(); |
| 47 gfx::Rect Border(const gfx::Size& bounds) const; | 47 gfx::Rect Border(const gfx::Size& bounds) const; |
| 48 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const; | 48 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const; |
| 49 size_t EstimateMemoryUsage() const; |
| 49 | 50 |
| 50 std::unique_ptr<cc::ScopedUIResource> ui_resource; | 51 std::unique_ptr<cc::ScopedUIResource> ui_resource; |
| 51 gfx::Size size; | 52 gfx::Size size; |
| 52 gfx::Rect padding; | 53 gfx::Rect padding; |
| 53 gfx::Rect aperture; | 54 gfx::Rect aperture; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Obtain a handle to the Java ResourceManager counterpart. | 57 // Obtain a handle to the Java ResourceManager counterpart. |
| 57 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; | 58 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; |
| 58 | 59 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return resource && resource->ui_resource ? resource->ui_resource->id() : 0; | 92 return resource && resource->ui_resource ? resource->ui_resource->id() : 0; |
| 92 } | 93 } |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 virtual ~ResourceManager() {} | 96 virtual ~ResourceManager() {} |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace ui | 99 } // namespace ui |
| 99 | 100 |
| 100 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ | 101 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_H_ |
| OLD | NEW |