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

Side by Side Diff: Source/bindings/v8/DOMWrapperWorld.cpp

Issue 137953010: Remove isolatedWorldForEnteredContext() and isolatedWorldForIsolate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (isMainWorld()) 60 if (isMainWorld())
61 m_domDataStore = adoptPtr(new DOMDataStore(MainWorld)); 61 m_domDataStore = adoptPtr(new DOMDataStore(MainWorld));
62 else if (isIsolatedWorld()) 62 else if (isIsolatedWorld())
63 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); 63 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld));
64 else if (isWorkerWorld()) 64 else if (isWorkerWorld())
65 m_domDataStore = adoptPtr(new DOMDataStore(WorkerWorld)); 65 m_domDataStore = adoptPtr(new DOMDataStore(WorkerWorld));
66 } 66 }
67 67
68 DOMWrapperWorld* DOMWrapperWorld::current(v8::Isolate* isolate) 68 DOMWrapperWorld* DOMWrapperWorld::current(v8::Isolate* isolate)
69 { 69 {
70 ASSERT(isolate->InContext());
71 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); 70 v8::Handle<v8::Context> context = isolate->GetCurrentContext();
72 if (!toDOMWindow(context)) 71 if (context.IsEmpty() || !contextHasCorrectPrototype(context))
73 return 0; 72 return 0;
74 ASSERT(isMainThread());
75 if (DOMWrapperWorld* world = isolatedWorld(context)) 73 if (DOMWrapperWorld* world = isolatedWorld(context))
76 return world; 74 return world;
77 return mainWorld(); 75 return mainWorld();
78 } 76 }
79 77
80 DOMWrapperWorld* DOMWrapperWorld::mainWorld() 78 DOMWrapperWorld* DOMWrapperWorld::mainWorld()
81 { 79 {
82 ASSERT(isMainThread()); 80 ASSERT(isMainThread());
83 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create (MainWorldId, mainWorldExtensionGroup))); 81 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create (MainWorldId, mainWorldExtensionGroup)));
84 return cachedMainWorld; 82 return cachedMainWorld;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 DOMActivityLoggerMap::iterator it = loggers.find(worldId); 226 DOMActivityLoggerMap::iterator it = loggers.find(worldId);
229 return it == loggers.end() ? 0 : it->value.get(); 227 return it == loggers.end() ? 0 : it->value.get();
230 } 228 }
231 229
232 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context ) 230 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context )
233 { 231 {
234 return V8WindowShell::contextHasCorrectPrototype(context); 232 return V8WindowShell::contextHasCorrectPrototype(context);
235 } 233 }
236 234
237 } // namespace WebCore 235 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp ('k') | Source/bindings/v8/ScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698