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

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

Issue 217053007: Revert of Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert 213543004 too Created 6 years, 8 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/v8/DOMRequestState.h ('k') | Source/bindings/v8/DOMWrapperWorld.cpp » ('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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro up = -1); 62 static PassRefPtr<DOMWrapperWorld> create(int worldId = -1, int extensionGro up = -1);
63 63
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 ASSERT(!context.IsEmpty());
75 return V8PerContextData::world(context); 75 return V8PerContextData::world(context);
76 } 76 }
77 77
78 static DOMWrapperWorld& current(v8::Isolate* isolate) 78 // Will return null if there is no DOMWrapperWorld for the current context.
79 static DOMWrapperWorld* current(v8::Isolate* isolate)
79 { 80 {
80 if (isMainThread() && worldOfInitializingWindow) { 81 if (isMainThread() && worldOfInitializingWindow) {
81 // It's possible that current() is being called while window is bein g initialized. 82 // It's possible that current() is being called while window is bein g initialized.
82 // In order to make current() workable during the initialization pha se, 83 // In order to make current() workable during the initialization pha se,
83 // we cache the world of the initializing window on worldOfInitializ ingWindow. 84 // we cache the world of the initializing window on worldOfInitializ ingWindow.
84 // If there is no initiazing window, worldOfInitializingWindow is 0. 85 // If there is no initiazing window, worldOfInitializingWindow is 0.
85 return *worldOfInitializingWindow; 86 return worldOfInitializingWindow;
86 } 87 }
87 return world(isolate->GetCurrentContext()); 88 return world(isolate->GetCurrentContext());
88 } 89 }
89 90
90 static DOMWrapperWorld& mainWorld(); 91 static DOMWrapperWorld* mainWorld();
91 92
92 // Associates an isolated world (see above for description) with a security 93 // Associates an isolated world (see above for description) with a security
93 // origin. XMLHttpRequest instances used in that world will be considered 94 // origin. XMLHttpRequest instances used in that world will be considered
94 // to come from that origin, not the frame's. 95 // to come from that origin, not the frame's.
95 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO rigin>); 96 static void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityO rigin>);
96 static void clearIsolatedWorldSecurityOrigin(int worldID); 97 static void clearIsolatedWorldSecurityOrigin(int worldID);
97 SecurityOrigin* isolatedWorldSecurityOrigin(); 98 SecurityOrigin* isolatedWorldSecurityOrigin();
98 99
99 // Associated an isolated world with a Content Security Policy. Resources 100 // Associated an isolated world with a Content Security Policy. Resources
100 // embedded into the main world's DOM from script executed in an isolated 101 // embedded into the main world's DOM from script executed in an isolated
(...skipping 30 matching lines...) Expand all
131 static DOMWrapperWorld* worldOfInitializingWindow; 132 static DOMWrapperWorld* worldOfInitializingWindow;
132 133
133 const int m_worldId; 134 const int m_worldId;
134 const int m_extensionGroup; 135 const int m_extensionGroup;
135 OwnPtr<DOMDataStore> m_domDataStore; 136 OwnPtr<DOMDataStore> m_domDataStore;
136 }; 137 };
137 138
138 } // namespace WebCore 139 } // namespace WebCore
139 140
140 #endif // DOMWrapperWorld_h 141 #endif // DOMWrapperWorld_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/DOMRequestState.h ('k') | Source/bindings/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698