am 5a6934c0: Merge "Don\'t pollute the namespace for two uses."
* commit '5a6934c07946743e622df52ba1155d97129b37f0': Don't pollute the namespace for two uses.
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include "ResourceIdCache.h"
|
#include "ResourceIdCache.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
static size_t mHits = 0;
|
static size_t mHits = 0;
|
||||||
@@ -29,7 +28,7 @@ struct CacheEntry {
|
|||||||
CacheEntry(const android::String16& name, uint32_t resId) : hashedName(name), id(resId) { }
|
CacheEntry(const android::String16& name, uint32_t resId) : hashedName(name), id(resId) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
static map< uint32_t, CacheEntry > mIdMap;
|
static std::map< uint32_t, CacheEntry > mIdMap;
|
||||||
|
|
||||||
|
|
||||||
// djb2; reasonable choice for strings when collisions aren't particularly important
|
// djb2; reasonable choice for strings when collisions aren't particularly important
|
||||||
@@ -63,7 +62,7 @@ uint32_t ResourceIdCache::lookup(const android::String16& package,
|
|||||||
bool onlyPublic) {
|
bool onlyPublic) {
|
||||||
const String16 hashedName = makeHashableName(package, type, name, onlyPublic);
|
const String16 hashedName = makeHashableName(package, type, name, onlyPublic);
|
||||||
const uint32_t hashcode = hash(hashedName);
|
const uint32_t hashcode = hash(hashedName);
|
||||||
map<uint32_t, CacheEntry>::iterator item = mIdMap.find(hashcode);
|
std::map<uint32_t, CacheEntry>::iterator item = mIdMap.find(hashcode);
|
||||||
if (item == mIdMap.end()) {
|
if (item == mIdMap.end()) {
|
||||||
// cache miss
|
// cache miss
|
||||||
mMisses++;
|
mMisses++;
|
||||||
|
|||||||
Reference in New Issue
Block a user