Changeset 52937 in webkit
- Timestamp:
- Jan 7, 2010 12:00:38 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52933 r52937 1 2010-01-07 Adam Barth <abarth@webkit.org> 2 3 No review, rolling out r52847. 4 http://trac.webkit.org/changeset/52847 5 https://bugs.webkit.org/show_bug.cgi?id=33232 6 7 Might have caused a perf regression. I'm rolling this out to see if it 8 heals the perf bot. 9 10 * bindings/v8/ScriptController.cpp: 11 (WebCore::ScriptController::ScriptController): 12 (WebCore::ScriptController::~ScriptController): 13 (WebCore::ScriptController::updateSecurityOrigin): 14 (WebCore::ScriptController::evaluateInIsolatedWorld): 15 (WebCore::ScriptController::haveInterpreter): 16 (WebCore::ScriptController::clearWindowShell): 17 (WebCore::ScriptController::updateDocument): 18 * bindings/v8/ScriptController.h: 19 * bindings/v8/V8DOMWindowShell.cpp: 20 * bindings/v8/V8DOMWindowShell.h: 21 * bindings/v8/V8DOMWrapper.cpp: 22 (WebCore::V8DOMWrapper::instantiateV8Object): 23 (WebCore::V8DOMWrapper::convertDocumentToV8Object): 24 (WebCore::V8DOMWrapper::convertNewNodeToV8Object): 25 * bindings/v8/V8IsolatedContext.cpp: 26 (WebCore::V8IsolatedContext::V8IsolatedContext): 27 * bindings/v8/V8Proxy.cpp: 28 (WebCore::V8Proxy::V8Proxy): 29 (WebCore::V8Proxy::~V8Proxy): 30 (WebCore::V8Proxy::handleOutOfMemory): 31 (WebCore::V8Proxy::evaluateInIsolatedWorld): 32 (WebCore::V8Proxy::setInjectedScriptContextDebugId): 33 (WebCore::V8Proxy::clearForClose): 34 (WebCore::V8Proxy::clearForNavigation): 35 (WebCore::V8Proxy::context): 36 (WebCore::V8Proxy::mainWorldContext): 37 (WebCore::V8Proxy::currentContext): 38 (WebCore::V8Proxy::setContextDebugId): 39 * bindings/v8/V8Proxy.h: 40 (WebCore::V8Proxy::windowShell): 41 * bindings/v8/WorldContextHandle.cpp: 42 (WebCore::WorldContextHandle::adjustedContext): 43 1 44 2010-01-07 Dan Bernstein <mitz@apple.com> 2 45 -
trunk/WebCore/bindings/v8/ScriptController.cpp
r52882 r52937 107 107 , m_paused(false) 108 108 , m_proxy(new V8Proxy(frame)) 109 , m_windowShell(V8DOMWindowShell::create(frame))110 109 #if ENABLE(NETSCAPE_PLUGIN_API) 111 110 , m_windowScriptNPObject(0) … … 118 117 { 119 118 m_proxy->disconnectFrame(); 120 m_windowShell.clear();121 119 } 122 120 … … 143 141 void ScriptController::updateSecurityOrigin() 144 142 { 145 m_ windowShell->updateSecurityOrigin();143 m_proxy->windowShell()->updateSecurityOrigin(); 146 144 } 147 145 … … 208 206 void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources) 209 207 { 210 // FIXME: This will need to get reorganized once we have a windowShell for the isolated world.211 m_windowShell->initContextIfNeeded();212 208 m_proxy->evaluateInIsolatedWorld(worldID, sources, 0); 213 209 } … … 296 292 bool ScriptController::haveInterpreter() const 297 293 { 298 return m_ windowShell->isContextInitialized();294 return m_proxy->windowShell()->isContextInitialized(); 299 295 } 300 296 … … 440 436 } 441 437 442 V8DOMWindowShell* ScriptController::mainWorldWindowShell() const443 {444 m_windowShell->initContextIfNeeded();445 return m_windowShell.get();446 }447 438 448 439 void ScriptController::clearWindowShell() 449 440 { 450 441 m_mainWorldScriptState.clear(); 451 m_proxy->resetIsolatedWorlds();452 442 453 443 // V8 binding expects ScriptController::clearWindowShell only be called 454 // when a frame is loading a new page. V8 DOMWindowShell::clearForNavigation444 // when a frame is loading a new page. V8Proxy::clearForNavigation 455 445 // creates a new context for the new page. 456 m_windowShell->clearForNavigation(); 457 } 458 459 void ScriptController::clearForClose() 460 { 461 m_windowShell->clearForClose(); 462 } 463 464 void ScriptController::destroyWindowShell() 465 { 466 m_windowShell->clearForClose(); 467 m_windowShell->destroyGlobal(); 446 m_proxy->clearForNavigation(); 468 447 } 469 448 … … 475 454 void ScriptController::updateDocument() 476 455 { 477 m_ windowShell->updateDocument();456 m_proxy->windowShell()->updateDocument(); 478 457 } 479 458 -
trunk/WebCore/bindings/v8/ScriptController.h
r52882 r52937 64 64 V8Proxy* proxy() { return m_proxy.get(); } 65 65 66 V8DOMWindowShell* mainWorldWindowShell() const;67 68 66 ScriptValue executeScript(const ScriptSourceCode&); 69 67 ScriptValue executeScript(const String& script, bool forceUserGesture = false); … … 156 154 void updateDocument(); 157 155 158 void clearForClose();159 160 // This is very destructive (e.g., out of memory).161 void destroyWindowShell();162 163 156 void updateSecurityOrigin(); 164 157 void clearScriptObjects(); … … 190 183 bool m_paused; 191 184 192 // FIXME: V8Proxy should eventually be removed.193 185 OwnPtr<V8Proxy> m_proxy; 194 195 // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld.196 RefPtr<V8DOMWindowShell> m_windowShell;197 198 186 typedef HashMap<Widget*, NPObject*> PluginObjectMap; 199 187 -
trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp
r52882 r52937 131 131 : m_frame(frame) 132 132 { 133 }134 135 V8DOMWindowShell::~V8DOMWindowShell()136 {137 clearForClose();138 destroyGlobal();139 133 } 140 134 -
trunk/WebCore/bindings/v8/V8DOMWindowShell.h
r52867 r52937 47 47 static PassRefPtr<V8DOMWindowShell> create(Frame*); 48 48 49 virtual ~V8DOMWindowShell();50 51 49 v8::Handle<v8::Context> context() const { return m_context; } 52 53 // This method is slower than |context()|, but sometimes we need local handles.54 v8::Local<v8::Context> localHandleForContext() const { return v8::Local<v8::Context>::New(m_context); }55 50 56 51 // Update document object of the frame. … … 71 66 void clearForNavigation(); 72 67 void clearForClose(); 68 73 69 void destroyGlobal(); 74 70 -
trunk/WebCore/bindings/v8/V8DOMWrapper.cpp
r52867 r52937 836 836 if (proxy) 837 837 // FIXME: Fix this to work properly with isolated worlds (see above). 838 instance = proxy-> frame()->script()->mainWorldWindowShell()->createWrapperFromCache(descriptorType);838 instance = proxy->windowShell()->createWrapperFromCache(descriptorType); 839 839 else { 840 840 v8::Local<v8::Function> function = getTemplate(descriptorType)->GetFunction(); … … 1238 1238 // checking if the node already has a wrapper. 1239 1239 V8Proxy* proxy = V8Proxy::retrieve(document->frame()); 1240 if (proxy) { 1241 // This code looks wacky: 1242 // 1) The test for |proxy| above is really a test whether JavaScript 1243 // is enabled in this frame. I have no idea if that's needed. 1244 // 2) Calling initContextIfNeeded here is redundant becase just 1245 // grabbing mainWorldWindowShell() already calls initContextIfNeeded. 1246 // FIXME: I bet we can clean this up a bit! 1247 proxy->frame()->script()->mainWorldWindowShell()->initContextIfNeeded(); 1248 } 1240 if (proxy) 1241 proxy->windowShell()->initContextIfNeeded(); 1249 1242 1250 1243 DOMWrapperMap<Node>& domNodeMap = getDOMNodeMap(); … … 1335 1328 1336 1329 if (isDocument) { 1337 if (proxy) { 1338 // FIXME: Don't we need to do this for every world? 1339 proxy->frame()->script()->mainWorldWindowShell()->updateDocumentWrapper(result); 1340 } 1330 if (proxy) 1331 proxy->windowShell()->updateDocumentWrapper(result); 1341 1332 1342 1333 if (type == V8ClassIndex::HTMLDOCUMENT) { -
trunk/WebCore/bindings/v8/V8IsolatedContext.cpp
r52847 r52937 54 54 : m_world(IsolatedWorld::create()) 55 55 { 56 // FIXME: None of this code belongs here! Basically, ScriptController57 // should create a new DOMWrapperWorld and a new windowShell and then58 // evaluate the script.59 60 V8DOMWindowShell* mainWorldWindowShell = proxy->frame()->script()->mainWorldWindowShell();61 62 56 v8::HandleScope scope; 63 57 // FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context. 64 m_context = SharedPersistent<v8::Context>::create( mainWorldWindowShell->createNewContext(v8::Handle<v8::Object>(), extensionGroup));58 m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup)); 65 59 if (m_context->get().IsEmpty()) 66 60 return; … … 73 67 V8DOMWindowShell::installHiddenObjectPrototype(m_context->get()); 74 68 // FIXME: This will go away once we have a windowShell for the isolated world. 75 mainWorldWindowShell->installDOMWindow(m_context->get(), proxy->frame()->domWindow());69 proxy->windowShell()->installDOMWindow(m_context->get(), proxy->frame()->domWindow()); 76 70 77 71 // Using the default security token means that the canAccess is always -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r52850 r52937 214 214 V8Proxy::V8Proxy(Frame* frame) 215 215 : m_frame(frame) 216 , m_windowShell(V8DOMWindowShell::create(frame)) 216 217 , m_inlineCode(false) 217 218 , m_timerCallback(false) … … 222 223 V8Proxy::~V8Proxy() 223 224 { 224 resetIsolatedWorlds(); 225 clearForClose(); 226 windowShell()->destroyGlobal(); 225 227 } 226 228 … … 245 247 Frame* frame = V8Proxy::retrieveFrame(context); 246 248 247 frame->script()->destroyWindowShell(); 249 V8Proxy* proxy = V8Proxy::retrieve(frame); 250 if (proxy) { 251 // Clean m_context, and event handlers. 252 proxy->clearForClose(); 253 254 proxy->windowShell()->destroyGlobal(); 255 } 248 256 249 257 ChromiumBridge::notifyJSOutOfMemory(frame); … … 259 267 void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup) 260 268 { 269 // FIXME: This will need to get reorganized once we have a windowShell for the isolated world. 270 windowShell()->initContextIfNeeded(); 271 261 272 v8::HandleScope handleScope; 262 273 V8IsolatedContext* isolatedContext = 0; … … 304 315 // Setup context id for JS debugger. 305 316 v8::Context::Scope contextScope(targetContext); 306 v8::Handle<v8::Context> context = m_frame->script()->mainWorldWindowShell()->localHandleForContext();317 v8::Handle<v8::Context> context = windowShell()->context(); 307 318 if (context.IsEmpty()) 308 319 return false; … … 572 583 } 573 584 m_isolatedWorlds.clear(); 585 } 586 587 void V8Proxy::clearForClose() 588 { 589 resetIsolatedWorlds(); 590 windowShell()->clearForClose(); 591 } 592 593 void V8Proxy::clearForNavigation() 594 { 595 resetIsolatedWorlds(); 596 windowShell()->clearForNavigation(); 574 597 } 575 598 … … 633 656 v8::Local<v8::Context> V8Proxy::context(Frame* frame) 634 657 { 635 // FIXME: Move this function to ScriptController.636 658 v8::Local<v8::Context> context = V8Proxy::mainWorldContext(frame); 637 659 if (context.IsEmpty()) … … 649 671 v8::Local<v8::Context> V8Proxy::context() 650 672 { 651 // FIXME: Move this function to ScriptController.652 673 if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) { 653 674 RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext(); … … 656 677 return v8::Local<v8::Context>::New(context->get()); 657 678 } 658 return m_frame->script()->mainWorldWindowShell()->localHandleForContext(); 679 return mainWorldContext(); 680 } 681 682 v8::Local<v8::Context> V8Proxy::mainWorldContext() 683 { 684 windowShell()->initContextIfNeeded(); 685 return v8::Local<v8::Context>::New(windowShell()->context()); 659 686 } 660 687 661 688 v8::Local<v8::Context> V8Proxy::mainWorldContext(Frame* frame) 662 689 { 663 // FIXME: Move this function to ScriptController.664 if (! frame->script()->isEnabled())690 V8Proxy* proxy = retrieve(frame); 691 if (!proxy) 665 692 return v8::Local<v8::Context>(); 666 693 667 return frame->script()->mainWorldWindowShell()->localHandleForContext();694 return proxy->mainWorldContext(); 668 695 } 669 696 670 697 v8::Local<v8::Context> V8Proxy::currentContext() 671 698 { 672 // FIXME: Why does this function exist?673 699 return v8::Context::GetCurrent(); 674 700 } … … 805 831 { 806 832 ASSERT(debugId > 0); 833 <<<<<<< HEAD 807 834 v8::HandleScope scope; 808 835 v8::Local<v8::Context> context = m_frame->script()->mainWorldWindowShell()->localHandleForContext(); 836 ======= 837 v8::Handle<v8::Context> context = windowShell()->context(); 838 >>>>>>> 99d3c27... 2010-01-05 Adam Barth <abarth@webkit.org> 809 839 if (context.IsEmpty()) 810 840 return false; -
trunk/WebCore/bindings/v8/V8Proxy.h
r52847 r52937 153 153 Frame* frame() { return m_frame; } 154 154 155 void clearForNavigation(); 156 void clearForClose(); 157 155 158 // FIXME: Need comment. User Gesture related. 156 159 bool inlineCode() const { return m_inlineCode; } … … 307 310 308 311 v8::Local<v8::Context> context(); 312 v8::Local<v8::Context> mainWorldContext(); 313 314 // FIXME: This should eventually take DOMWrapperWorld argument! 315 V8DOMWindowShell* windowShell() const { return m_windowShell.get(); } 309 316 310 317 bool setContextDebugId(int id); … … 329 336 static void reportUnsafeAccessTo(Frame* target, DelayReporting delay); 330 337 331 // FIXME: This should move to ScriptController.332 void resetIsolatedWorlds();333 334 338 private: 335 339 // If m_recursionCount is 0, let LocalStorage know so we can release 336 340 // the storage mutex. 337 341 void releaseStorageMutex(); 342 343 void resetIsolatedWorlds(); 338 344 339 345 // Returns false when we're out of memory in V8. … … 365 371 Frame* m_frame; 366 372 373 // For the moment, we have one of these. Soon we will have one per DOMWrapperWorld. 374 RefPtr<V8DOMWindowShell> m_windowShell; 375 367 376 // Utility context holding JavaScript functions used internally. 368 377 static v8::Persistent<v8::Context> m_utilityContext; -
trunk/WebCore/bindings/v8/WorldContextHandle.cpp
r52847 r52937 32 32 #include "WorldContextHandle.h" 33 33 34 #include "Frame.h"35 34 #include "V8IsolatedContext.h" 36 35 … … 50 49 { 51 50 if (m_worldToUse == UseMainWorld) 52 return proxy-> frame()->script()->mainWorldWindowShell()->localHandleForContext();51 return proxy->mainWorldContext(); 53 52 if (!m_context || m_context->get().IsEmpty()) 54 53 return proxy->context(); -
trunk/WebKit/chromium/ChangeLog
r52898 r52937 1 2010-01-07 Adam Barth <abarth@webkit.org> 2 3 No review, rolling out r52847. 4 http://trac.webkit.org/changeset/52847 5 https://bugs.webkit.org/show_bug.cgi?id=33232 6 7 Might have caused a perf regression. 8 9 * src/FrameLoaderClientImpl.cpp: 10 (WebKit::FrameLoaderClientImpl::detachedFromParent3): 11 1 12 2010-01-06 Mike Belshe <mike@belshe.com> 2 13 -
trunk/WebKit/chromium/src/FrameLoaderClientImpl.cpp
r52847 r52937 216 216 // go to a page and then navigate to a new page without getting any asserts 217 217 // or crashes. 218 m_webFrame->frame()->script()-> clearForClose();219 218 m_webFrame->frame()->script()->proxy()->clearForClose(); 219 220 220 // Stop communicating with the WebFrameClient at this point since we are no 221 221 // longer associated with the Page.
Note: See TracChangeset
for help on using the changeset viewer.