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

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

Issue 2957513002: Removed calls to RefPtr::Release in return statements with auto move. (Closed)
Patch Set: rebased Created 3 years, 5 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 #if DCHECK_IS_ON() 150 #if DCHECK_IS_ON()
151 DCHECK(IsIsolatedWorldId(world_id)); 151 DCHECK(IsIsolatedWorldId(world_id));
152 #endif 152 #endif
153 153
154 WorldMap& map = GetWorldMap(); 154 WorldMap& map = GetWorldMap();
155 auto it = map.find(world_id); 155 auto it = map.find(world_id);
156 if (it != map.end()) { 156 if (it != map.end()) {
157 RefPtr<DOMWrapperWorld> world = it->value; 157 RefPtr<DOMWrapperWorld> world = it->value;
158 DCHECK(world->IsIsolatedWorld()); 158 DCHECK(world->IsIsolatedWorld());
159 DCHECK_EQ(world_id, world->GetWorldId()); 159 DCHECK_EQ(world_id, world->GetWorldId());
160 return world.Release(); 160 return world;
161 } 161 }
162 162
163 return AdoptRef(new DOMWrapperWorld(isolate, WorldType::kIsolated, world_id)); 163 return AdoptRef(new DOMWrapperWorld(isolate, WorldType::kIsolated, world_id));
164 } 164 }
165 165
166 typedef HashMap<int, RefPtr<SecurityOrigin>> IsolatedWorldSecurityOriginMap; 166 typedef HashMap<int, RefPtr<SecurityOrigin>> IsolatedWorldSecurityOriginMap;
167 static IsolatedWorldSecurityOriginMap& IsolatedWorldSecurityOrigins() { 167 static IsolatedWorldSecurityOriginMap& IsolatedWorldSecurityOrigins() {
168 DCHECK(IsMainThread()); 168 DCHECK(IsMainThread());
169 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ()); 169 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ());
170 return map; 170 return map;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 DCHECK(script_wrappable); 299 DCHECK(script_wrappable);
300 DCHECK(IsMainThread()); 300 DCHECK(IsMainThread());
301 301
302 script_wrappable->UnsetWrapperIfAny(); 302 script_wrappable->UnsetWrapperIfAny();
303 303
304 for (auto& world : GetWorldMap().Values()) 304 for (auto& world : GetWorldMap().Values())
305 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); 305 world->DomDataStore().UnsetWrapperIfAny(script_wrappable);
306 } 306 }
307 307
308 } // namespace blink 308 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698