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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp

Issue 2759703002: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 years, 9 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 /* 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // WorkerWorld should be disposed of before the dtor. 161 // WorkerWorld should be disposed of before the dtor.
162 if (!isWorkerWorld()) 162 if (!isWorkerWorld())
163 dispose(); 163 dispose();
164 DCHECK(!worldMap().contains(m_worldId)); 164 DCHECK(!worldMap().contains(m_worldId));
165 } 165 }
166 166
167 void DOMWrapperWorld::dispose() { 167 void DOMWrapperWorld::dispose() {
168 m_domObjectHolders.clear(); 168 m_domObjectHolders.clear();
169 m_domDataStore.reset(); 169 m_domDataStore.reset();
170 DCHECK(worldMap().contains(m_worldId)); 170 DCHECK(worldMap().contains(m_worldId));
171 worldMap().remove(m_worldId); 171 worldMap().erase(m_worldId);
172 } 172 }
173 173
174 PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld( 174 PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::ensureIsolatedWorld(
175 v8::Isolate* isolate, 175 v8::Isolate* isolate,
176 int worldId) { 176 int worldId) {
177 ASSERT(isIsolatedWorldId(worldId)); 177 ASSERT(isIsolatedWorldId(worldId));
178 178
179 WorldMap& map = worldMap(); 179 WorldMap& map = worldMap();
180 auto it = map.find(worldId); 180 auto it = map.find(worldId);
181 if (it != map.end()) { 181 if (it != map.end()) {
(...skipping 20 matching lines...) Expand all
202 return it == origins.end() ? 0 : it->value.get(); 202 return it == origins.end() ? 0 : it->value.get();
203 } 203 }
204 204
205 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin( 205 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(
206 int worldId, 206 int worldId,
207 PassRefPtr<SecurityOrigin> securityOrigin) { 207 PassRefPtr<SecurityOrigin> securityOrigin) {
208 ASSERT(isIsolatedWorldId(worldId)); 208 ASSERT(isIsolatedWorldId(worldId));
209 if (securityOrigin) 209 if (securityOrigin)
210 isolatedWorldSecurityOrigins().set(worldId, std::move(securityOrigin)); 210 isolatedWorldSecurityOrigins().set(worldId, std::move(securityOrigin));
211 else 211 else
212 isolatedWorldSecurityOrigins().remove(worldId); 212 isolatedWorldSecurityOrigins().erase(worldId);
213 } 213 }
214 214
215 typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap; 215 typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap;
216 static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames() { 216 static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames() {
217 ASSERT(isMainThread()); 217 ASSERT(isMainThread());
218 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); 218 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ());
219 return map; 219 return map;
220 } 220 }
221 221
222 String DOMWrapperWorld::isolatedWorldHumanReadableName() { 222 String DOMWrapperWorld::isolatedWorldHumanReadableName() {
(...skipping 24 matching lines...) Expand all
247 return it == policies.end() ? false : it->value; 247 return it == policies.end() ? false : it->value;
248 } 248 }
249 249
250 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy( 250 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(
251 int worldId, 251 int worldId,
252 const String& policy) { 252 const String& policy) {
253 ASSERT(isIsolatedWorldId(worldId)); 253 ASSERT(isIsolatedWorldId(worldId));
254 if (!policy.isEmpty()) 254 if (!policy.isEmpty())
255 isolatedWorldContentSecurityPolicies().set(worldId, true); 255 isolatedWorldContentSecurityPolicies().set(worldId, true);
256 else 256 else
257 isolatedWorldContentSecurityPolicies().remove(worldId); 257 isolatedWorldContentSecurityPolicies().erase(worldId);
258 } 258 }
259 259
260 template <typename T> 260 template <typename T>
261 void DOMWrapperWorld::registerDOMObjectHolder(v8::Isolate* isolate, 261 void DOMWrapperWorld::registerDOMObjectHolder(v8::Isolate* isolate,
262 T* object, 262 T* object,
263 v8::Local<v8::Value> wrapper) { 263 v8::Local<v8::Value> wrapper) {
264 registerDOMObjectHolderInternal( 264 registerDOMObjectHolderInternal(
265 DOMObjectHolder<T>::create(isolate, object, wrapper)); 265 DOMObjectHolder<T>::create(isolate, object, wrapper));
266 } 266 }
267 267
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 int worldId = *s_nextWorldId; 309 int worldId = *s_nextWorldId;
310 CHECK_GE(worldId, WorldId::UnspecifiedWorldIdStart); 310 CHECK_GE(worldId, WorldId::UnspecifiedWorldIdStart);
311 *s_nextWorldId = worldId + 1; 311 *s_nextWorldId = worldId + 1;
312 return worldId; 312 return worldId;
313 } 313 }
314 NOTREACHED(); 314 NOTREACHED();
315 return InvalidWorldId; 315 return InvalidWorldId;
316 } 316 }
317 317
318 } // namespace blink 318 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698