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

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

Issue 176963017: Remove WrapperWorldType from V8 binding (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static const int mainWorldExtensionGroup = 0; 64 static const int mainWorldExtensionGroup = 0;
65 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte nsionGroup); 65 static PassRefPtr<DOMWrapperWorld> ensureIsolatedWorld(int worldId, int exte nsionGroup);
66 ~DOMWrapperWorld(); 66 ~DOMWrapperWorld();
67 void dispose(); 67 void dispose();
68 68
69 static bool isolatedWorldsExist() { return isolatedWorldCount; } 69 static bool isolatedWorldsExist() { return isolatedWorldCount; }
70 static void allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds); 70 static void allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& worlds);
71 71
72 static DOMWrapperWorld* world(v8::Handle<v8::Context> context) 72 static DOMWrapperWorld* world(v8::Handle<v8::Context> context)
73 { 73 {
74 ASSERT(!context.IsEmpty());
74 return V8PerContextData::world(context); 75 return V8PerContextData::world(context);
75 } 76 }
76 77
77 // Will return null if there is no DOMWrapperWorld for the current context. 78 // Will return null if there is no DOMWrapperWorld for the current context.
78 static DOMWrapperWorld* current(v8::Isolate* isolate) 79 static DOMWrapperWorld* current(v8::Isolate* isolate)
79 { 80 {
80 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); 81 if (isMainThread() && worldOfInitializingWindow) {
81 if (context.IsEmpty()) { 82 // It's possible that current() is being called while window is bein g initialized.
82 // If a worker thread calls current() with an empty context, it mean s that there is no DOMWrapperWorld.
83 if (!isMainThread())
84 return 0;
85
86 // If the main thread calls current() with an empty context, it's po ssible that
87 // current() is being called while window is being initialized.
88 // In order to make current() workable during the initialization pha se, 83 // In order to make current() workable during the initialization pha se,
89 // we cache the world of the initializing window on worldOfInitializ ingWindow. 84 // we cache the world of the initializing window on worldOfInitializ ingWindow.
90 // If there is no initiazing window, worldOfInitializingWindow is 0. 85 // If there is no initiazing window, worldOfInitializingWindow is 0.
91 return worldOfInitializingWindow; 86 return worldOfInitializingWindow;
92 } 87 }
93 return world(context); 88 return world(isolate->GetCurrentContext());
94 } 89 }
95 90
96 static DOMWrapperWorld* mainWorld(); 91 static DOMWrapperWorld* mainWorld();
97 92
98 // Associates an isolated world (see above for description) with a security 93 // Associates an isolated world (see above for description) with a security
99 // origin. XMLHttpRequest instances used in that world will be considered 94 // origin. XMLHttpRequest instances used in that world will be considered
100 // to come from that origin, not the frame's. 95 // to come from that origin, not the frame's.
101 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO rigin>); 96 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO rigin>);
102 static void clearIsolatedWorldSecurityOrigin(int worldID); 97 static void clearIsolatedWorldSecurityOrigin(int worldID);
103 SecurityOrigin* isolatedWorldSecurityOrigin(); 98 SecurityOrigin* isolatedWorldSecurityOrigin();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 static DOMWrapperWorld* worldOfInitializingWindow; 132 static DOMWrapperWorld* worldOfInitializingWindow;
138 133
139 const int m_worldId; 134 const int m_worldId;
140 const int m_extensionGroup; 135 const int m_extensionGroup;
141 OwnPtr<DOMDataStore> m_domDataStore; 136 OwnPtr<DOMDataStore> m_domDataStore;
142 }; 137 };
143 138
144 } // namespace WebCore 139 } // namespace WebCore
145 140
146 #endif // DOMWrapperWorld_h 141 #endif // DOMWrapperWorld_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698