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

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

Issue 2571063002: Remove Blink-in-JS (Closed)
Patch Set: Created 4 years 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 DOMWrapperWorld& DOMWrapperWorld::mainWorld() { 100 DOMWrapperWorld& DOMWrapperWorld::mainWorld() {
101 ASSERT(isMainThread()); 101 ASSERT(isMainThread());
102 DEFINE_STATIC_REF( 102 DEFINE_STATIC_REF(
103 DOMWrapperWorld, cachedMainWorld, 103 DOMWrapperWorld, cachedMainWorld,
104 (DOMWrapperWorld::create(v8::Isolate::GetCurrent(), MainWorldId, 104 (DOMWrapperWorld::create(v8::Isolate::GetCurrent(), MainWorldId,
105 mainWorldExtensionGroup))); 105 mainWorldExtensionGroup)));
106 return *cachedMainWorld; 106 return *cachedMainWorld;
107 } 107 }
108 108
109 DOMWrapperWorld& DOMWrapperWorld::privateScriptIsolatedWorld() {
110 ASSERT(isMainThread());
111 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedPrivateScriptIsolatedWorld,
112 ());
113 if (!cachedPrivateScriptIsolatedWorld) {
114 cachedPrivateScriptIsolatedWorld = DOMWrapperWorld::create(
115 v8::Isolate::GetCurrent(), PrivateScriptIsolatedWorldId,
116 privateScriptIsolatedWorldExtensionGroup);
117 // This name must match the string in DevTools used to guard the
118 // privateScriptInspection experiment.
119 DOMWrapperWorld::setIsolatedWorldHumanReadableName(
120 PrivateScriptIsolatedWorldId, "private script");
121 isolatedWorldCount++;
122 }
123 return *cachedPrivateScriptIsolatedWorld;
124 }
125
126 PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::fromWorldId(v8::Isolate* isolate, 109 PassRefPtr<DOMWrapperWorld> DOMWrapperWorld::fromWorldId(v8::Isolate* isolate,
127 int worldId, 110 int worldId,
128 int extensionGroup) { 111 int extensionGroup) {
129 if (worldId == MainWorldId) 112 if (worldId == MainWorldId)
130 return &mainWorld(); 113 return &mainWorld();
131 return ensureIsolatedWorld(isolate, worldId, extensionGroup); 114 return ensureIsolatedWorld(isolate, worldId, extensionGroup);
132 } 115 }
133 116
134 typedef HashMap<int, DOMWrapperWorld*> WorldMap; 117 typedef HashMap<int, DOMWrapperWorld*> WorldMap;
135 static WorldMap& isolatedWorldMap() { 118 static WorldMap& isolatedWorldMap() {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 m_domObjectHolders.remove(holderBase); 321 m_domObjectHolders.remove(holderBase);
339 } 322 }
340 323
341 void DOMWrapperWorld::weakCallbackForDOMObjectHolder( 324 void DOMWrapperWorld::weakCallbackForDOMObjectHolder(
342 const v8::WeakCallbackInfo<DOMObjectHolderBase>& data) { 325 const v8::WeakCallbackInfo<DOMObjectHolderBase>& data) {
343 DOMObjectHolderBase* holderBase = data.GetParameter(); 326 DOMObjectHolderBase* holderBase = data.GetParameter();
344 holderBase->world()->unregisterDOMObjectHolder(holderBase); 327 holderBase->world()->unregisterDOMObjectHolder(holderBase);
345 } 328 }
346 329
347 } // namespace blink 330 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698