Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 } | 162 } |
| 163 | 163 |
| 164 typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; | 164 typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; |
| 165 static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() | 165 static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() |
| 166 { | 166 { |
| 167 ASSERT(isMainThread()); | 167 ASSERT(isMainThread()); |
| 168 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ()); | 168 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ()); |
| 169 return map; | 169 return map; |
| 170 } | 170 } |
| 171 | 171 |
| 172 typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap; | |
| 173 static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames() | |
| 174 { | |
| 175 ASSERT(isMainThread()); | |
| 176 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); | |
| 177 return map; | |
| 178 } | |
| 179 | |
| 172 SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin() | 180 SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin() |
| 173 { | 181 { |
| 174 ASSERT(this->isIsolatedWorld()); | 182 ASSERT(this->isIsolatedWorld()); |
| 175 IsolatedWorldSecurityOriginMap& origins = isolatedWorldSecurityOrigins(); | 183 IsolatedWorldSecurityOriginMap& origins = isolatedWorldSecurityOrigins(); |
| 176 IsolatedWorldSecurityOriginMap::iterator it = origins.find(worldId()); | 184 IsolatedWorldSecurityOriginMap::iterator it = origins.find(worldId()); |
| 177 return it == origins.end() ? 0 : it->value.get(); | 185 return it == origins.end() ? 0 : it->value.get(); |
| 178 } | 186 } |
| 179 | 187 |
| 180 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<Sec urityOrigin> securityOrigin) | 188 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<Sec urityOrigin> securityOrigin) |
| 181 { | 189 { |
| 182 ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); | 190 ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); |
| 183 if (securityOrigin) | 191 if (securityOrigin) |
| 184 isolatedWorldSecurityOrigins().set(worldID, securityOrigin); | 192 isolatedWorldSecurityOrigins().set(worldID, securityOrigin); |
| 185 else | 193 else |
| 186 isolatedWorldSecurityOrigins().remove(worldID); | 194 isolatedWorldSecurityOrigins().remove(worldID); |
| 187 } | 195 } |
| 188 | 196 |
| 197 void DOMWrapperWorld::setIsolatedWorldHumanReadableName(int worldID, const Strin g& humanReadableName) | |
| 198 { | |
| 199 ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); | |
| 200 if (!humanReadableName.isEmpty()) | |
| 201 isolatedWorldHumanReadableNames().set(worldID, humanReadableName); | |
| 202 else | |
| 203 isolatedWorldHumanReadableNames().remove(worldID); | |
| 204 } | |
| 205 | |
| 206 String DOMWrapperWorld::isolatedWorldHumanReadableName() | |
| 207 { | |
| 208 ASSERT(this->isIsolatedWorld()); | |
| 209 IsolatedWorldHumanReadableNameMap& humanReadableNames = isolatedWorldHumanRe adableNames(); | |
| 210 IsolatedWorldHumanReadableNameMap::iterator it = humanReadableNames.find(wor ldId()); | |
|
yurys
2013/05/24 04:58:44
Hm, why does DOMWrapperWorld use several static st
| |
| 211 return it == humanReadableNames.end() ? "" : it->value; | |
| 212 } | |
| 213 | |
| 189 void DOMWrapperWorld::clearIsolatedWorldSecurityOrigin(int worldID) | 214 void DOMWrapperWorld::clearIsolatedWorldSecurityOrigin(int worldID) |
| 190 { | 215 { |
| 191 ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); | 216 ASSERT(DOMWrapperWorld::isIsolatedWorldId(worldID)); |
| 192 isolatedWorldSecurityOrigins().remove(worldID); | 217 isolatedWorldSecurityOrigins().remove(worldID); |
| 193 } | 218 } |
| 194 | 219 |
| 195 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; | 220 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; |
| 196 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici es() | 221 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici es() |
| 197 { | 222 { |
| 198 ASSERT(isMainThread()); | 223 ASSERT(isMainThread()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 } | 262 } |
| 238 | 263 |
| 239 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) | 264 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) |
| 240 { | 265 { |
| 241 DOMActivityLoggerMap& loggers = domActivityLoggers(); | 266 DOMActivityLoggerMap& loggers = domActivityLoggers(); |
| 242 DOMActivityLoggerMap::iterator it = loggers.find(worldId); | 267 DOMActivityLoggerMap::iterator it = loggers.find(worldId); |
| 243 return it == loggers.end() ? 0 : it->value.get(); | 268 return it == loggers.end() ? 0 : it->value.get(); |
| 244 } | 269 } |
| 245 | 270 |
| 246 } // namespace WebCore | 271 } // namespace WebCore |
| OLD | NEW |