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

Side by Side Diff: ui/android/resources/resource_manager_impl.h

Issue 2325623003: Replace IDMap with std::unordered_map in ResourceManager (Closed)
Patch Set: nits Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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/id_map.h"
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "ui/android/resources/resource_manager.h" 11 #include "ui/android/resources/resource_manager.h"
13 #include "ui/android/ui_android_export.h" 12 #include "ui/android/ui_android_export.h"
14 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
16 15
17 namespace ui { 16 namespace ui {
18 17
19 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { 18 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager {
20 public: 19 public:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 78
80 // Start loading the resource. virtual for testing. 79 // Start loading the resource. virtual for testing.
81 virtual void PreloadResourceFromJava(AndroidResourceType res_type, 80 virtual void PreloadResourceFromJava(AndroidResourceType res_type,
82 int res_id); 81 int res_id);
83 virtual void RequestResourceFromJava(AndroidResourceType res_type, 82 virtual void RequestResourceFromJava(AndroidResourceType res_type,
84 int res_id); 83 int res_id);
85 virtual void RequestCrushedSpriteResourceFromJava(int bitmap_res_id, 84 virtual void RequestCrushedSpriteResourceFromJava(int bitmap_res_id,
86 int metadata_res_id, 85 int metadata_res_id,
87 bool reloading); 86 bool reloading);
88 87
89 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; 88 using ResourceMap = std::unordered_map<int, std::unique_ptr<Resource> >;
aelias_OOO_until_Jul13 2016/09/09 21:50:05 Please use "AndroidResourceType" instead of raw in
aelias_OOO_until_Jul13 2016/09/09 21:59:45 Sorry, I realized this is not correct. It looks l
mdjones 2016/09/12 16:55:09 At the very least it would help with the understan
90 typedef IDMap<CrushedSpriteResource, IDMapOwnPointer> 89 using CrushedSpriteResourceMap =
91 CrushedSpriteResourceMap; 90 std::unordered_map<int, std::unique_ptr<CrushedSpriteResource> >;
aelias_OOO_until_Jul13 2016/09/09 21:50:05 nit: no need for space between ">" characters in C
mdjones 2016/09/12 16:55:09 Done.
92 typedef std::unordered_map<int, std::unique_ptr<ResourceMap> > 91 using TintedResourceMap =
93 TintedResourceMap; 92 std::unordered_map<int, std::unique_ptr<ResourceMap> >;
aelias_OOO_until_Jul13 2016/09/09 21:50:05 Please use "SkColor" instead of raw int.
mdjones 2016/09/12 16:55:09 Done.
94 93
95 cc::LayerTreeHost* host_; 94 cc::LayerTreeHost* host_;
96 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; 95 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT];
97 CrushedSpriteResourceMap crushed_sprite_resources_; 96 CrushedSpriteResourceMap crushed_sprite_resources_;
98 TintedResourceMap tinted_resources_; 97 TintedResourceMap tinted_resources_;
99 98
100 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 99 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
101 100
102 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); 101 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl);
103 }; 102 };
104 103
105 } // namespace ui 104 } // namespace ui
106 105
107 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ 106 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | ui/android/resources/resource_manager_impl.cc » ('j') | ui/android/resources/resource_manager_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698