Chromium Code Reviews| Index: Source/bindings/v8/DOMWrapperWorld.cpp |
| diff --git a/Source/bindings/v8/DOMWrapperWorld.cpp b/Source/bindings/v8/DOMWrapperWorld.cpp |
| index 7b5f2fd86fd5d9c2729531b6664cf9ddf37280d3..95d5c9e6ad5efbba13a3dde49ec50bfd971481ed 100644 |
| --- a/Source/bindings/v8/DOMWrapperWorld.cpp |
| +++ b/Source/bindings/v8/DOMWrapperWorld.cpp |
| @@ -169,6 +169,14 @@ static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() |
| return map; |
| } |
| +typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap; |
| +static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames() |
| +{ |
| + ASSERT(isMainThread()); |
| + DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); |
| + return map; |
| +} |
| + |
| SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin() |
| { |
| ASSERT(this->isIsolatedWorld()); |
| @@ -186,6 +194,23 @@ void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<Sec |
| isolatedWorldSecurityOrigins().remove(worldID); |
| } |
| +void DOMWrapperWorld::setIsolatedWorldHumanReadableName(int worldID, const String& humanReadableName) |
| +{ |
| + ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); |
| + if (!humanReadableName.isEmpty()) |
| + isolatedWorldHumanReadableNames().set(worldID, humanReadableName); |
| + else |
| + isolatedWorldHumanReadableNames().remove(worldID); |
| +} |
| + |
| +String DOMWrapperWorld::isolatedWorldHumanReadableName() |
| +{ |
| + ASSERT(this->isIsolatedWorld()); |
| + IsolatedWorldHumanReadableNameMap& humanReadableNames = isolatedWorldHumanReadableNames(); |
| + IsolatedWorldHumanReadableNameMap::iterator it = humanReadableNames.find(worldId()); |
|
yurys
2013/05/24 04:58:44
Hm, why does DOMWrapperWorld use several static st
|
| + return it == humanReadableNames.end() ? "" : it->value; |
| +} |
| + |
| void DOMWrapperWorld::clearIsolatedWorldSecurityOrigin(int worldID) |
| { |
| ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); |