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_IMPL_H_ | 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/trace_event/memory_dump_provider.h" |
11 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
12 #include "ui/android/resources/resource_manager.h" | 13 #include "ui/android/resources/resource_manager.h" |
13 #include "ui/android/ui_android_export.h" | 14 #include "ui/android/ui_android_export.h" |
14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 class UIResourceManager; | 19 class UIResourceManager; |
19 } // namespace cc | 20 } // namespace cc |
20 | 21 |
21 namespace ui { | 22 namespace ui { |
22 | 23 |
23 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { | 24 class UI_ANDROID_EXPORT ResourceManagerImpl |
| 25 : public ResourceManager, |
| 26 public base::trace_event::MemoryDumpProvider { |
24 public: | 27 public: |
25 static ResourceManagerImpl* FromJavaObject(jobject jobj); | 28 static ResourceManagerImpl* FromJavaObject(jobject jobj); |
26 | 29 |
27 explicit ResourceManagerImpl(gfx::NativeWindow native_window); | 30 explicit ResourceManagerImpl(gfx::NativeWindow native_window); |
28 ~ResourceManagerImpl() override; | 31 ~ResourceManagerImpl() override; |
29 | 32 |
30 void Init(cc::UIResourceManager* ui_resource_manager); | 33 void Init(cc::UIResourceManager* ui_resource_manager); |
31 | 34 |
32 // ResourceManager implementation. | 35 // ResourceManager implementation. |
33 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 36 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const base::android::JavaRef<jobject>& bitmap); | 74 const base::android::JavaRef<jobject>& bitmap); |
72 void ClearTintedResourceCache(JNIEnv* env, | 75 void ClearTintedResourceCache(JNIEnv* env, |
73 const base::android::JavaRef<jobject>& jobj); | 76 const base::android::JavaRef<jobject>& jobj); |
74 | 77 |
75 static bool RegisterResourceManager(JNIEnv* env); | 78 static bool RegisterResourceManager(JNIEnv* env); |
76 | 79 |
77 // Helper method for processing crushed sprite metadata; public for testing. | 80 // Helper method for processing crushed sprite metadata; public for testing. |
78 CrushedSpriteResource::SrcDstRects ProcessCrushedSpriteFrameRects( | 81 CrushedSpriteResource::SrcDstRects ProcessCrushedSpriteFrameRects( |
79 std::vector<std::vector<int>> frame_rects_vector); | 82 std::vector<std::vector<int>> frame_rects_vector); |
80 | 83 |
| 84 // base::trace_event::MemoryDumpProvider implementation. |
| 85 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 86 base::trace_event::ProcessMemoryDump* pmd) override; |
| 87 |
81 private: | 88 private: |
82 friend class TestResourceManagerImpl; | 89 friend class TestResourceManagerImpl; |
83 | 90 |
84 // Start loading the resource. virtual for testing. | 91 // Start loading the resource. virtual for testing. |
85 virtual void PreloadResourceFromJava(AndroidResourceType res_type, | 92 virtual void PreloadResourceFromJava(AndroidResourceType res_type, |
86 int res_id); | 93 int res_id); |
87 virtual void RequestResourceFromJava(AndroidResourceType res_type, | 94 virtual void RequestResourceFromJava(AndroidResourceType res_type, |
88 int res_id); | 95 int res_id); |
89 virtual void RequestCrushedSpriteResourceFromJava(int bitmap_res_id, | 96 virtual void RequestCrushedSpriteResourceFromJava(int bitmap_res_id, |
90 int metadata_res_id, | 97 int metadata_res_id, |
(...skipping 11 matching lines...) Expand all Loading... |
102 TintedResourceMap tinted_resources_; | 109 TintedResourceMap tinted_resources_; |
103 | 110 |
104 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 111 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
105 | 112 |
106 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); | 113 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); |
107 }; | 114 }; |
108 | 115 |
109 } // namespace ui | 116 } // namespace ui |
110 | 117 |
111 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 118 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
OLD | NEW |