Changeset 115952 in webkit
- Timestamp:
- May 3, 2012 2:51:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r115948 r115952 1 2012-05-03 Stephanie Lewis <slewis@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=85450 unbounded growth of JSDOMWindowShells loading pages in the same window 4 <rdar://problem/11320059> REGRESSION (r115083): PLT3 shows linear memory growth and gets slower with each run 5 6 Reviewed by Brady Eidson. 7 8 The API added for DOMWindowExtension, didCreateGlobalObjectForFrame, would create a global object 9 for every world, even those that did not need the callback. This had the side effect of creating a 10 JSDOMWindowShell that the associated world didn't necessarily know to clean up. Instead of creating 11 unnecessary objects change the API to globalObjectIsAvailableForFrame and do not pass the global object 12 in the API. The object can be accessed later by those worlds which require it. 13 14 * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 15 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: 16 (WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame): rename API and remove globalObject parameter 17 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: 18 (InjectedBundlePageLoaderClient): ditto 19 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 20 (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable): ditto 21 1 22 2012-05-02 Alexander Færøy <ahf@0x90.dk> 2 23 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
r115083 r115952 104 104 typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); 105 105 typedef bool (*WKBundlePageShouldGoToBackForwardListItemCallback)(WKBundlePageRef page, WKBundleBackForwardListItemRef item, WKTypeRef* userData, const void *clientInfo); 106 typedef void (*WKBundlePage DidCreateGlobalObjectForFrameCallback)(WKBundlePageRef page, JSObjectRef globalObject, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo);106 typedef void (*WKBundlePageGlobalObjectIsAvailableForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo); 107 107 typedef void (*WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); 108 108 typedef void (*WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); … … 138 138 WKBundlePageDidDetectXSSForFrameCallback didDetectXSSForFrame; 139 139 WKBundlePageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; 140 WKBundlePage DidCreateGlobalObjectForFrameCallback didCreateGlobalObjectForFrame;140 WKBundlePageGlobalObjectIsAvailableForFrameCallback globalObjectIsAvailableForFrame; 141 141 WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback willDisconnectDOMWindowExtensionFromGlobalObject; 142 142 WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback didReconnectDOMWindowExtensionToGlobalObject; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
r115083 r115952 250 250 } 251 251 252 void InjectedBundlePageLoaderClient:: didCreateGlobalObjectForFrame(WebPage* page, JSObjectRef globalObject, WebFrame* frame, WebCore::DOMWrapperWorld* world)253 { 254 if (!m_client. didCreateGlobalObjectForFrame)252 void InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame(WebPage* page, WebFrame* frame, WebCore::DOMWrapperWorld* world) 253 { 254 if (!m_client.globalObjectIsAvailableForFrame) 255 255 return; 256 256 257 257 RefPtr<InjectedBundleScriptWorld> injectedWorld = InjectedBundleScriptWorld::getOrCreate(world); 258 m_client. didCreateGlobalObjectForFrame(toAPI(page), globalObject, toAPI(frame), toAPI(injectedWorld.get()), m_client.clientInfo);258 m_client.globalObjectIsAvailableForFrame(toAPI(page), toAPI(frame), toAPI(injectedWorld.get()), m_client.clientInfo); 259 259 } 260 260 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
r115083 r115952 75 75 void didHandleOnloadEventsForFrame(WebPage*, WebFrame*); 76 76 77 void didCreateGlobalObjectForFrame(WebPage*, JSObjectRef globalObject, WebFrame*, WebCore::DOMWrapperWorld*);77 void globalObjectIsAvailableForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*); 78 78 void willDisconnectDOMWindowExtensionFromGlobalObject(WebPage*, WebCore::DOMWindowExtension*); 79 79 void didReconnectDOMWindowExtensionToGlobalObject(WebPage*, WebCore::DOMWindowExtension*); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r115926 r115952 1417 1417 return; 1418 1418 1419 JSObjectRef globalObject = toRef(m_frame->coreFrame()->script()->globalObject(world)); 1420 1421 webPage->injectedBundleLoaderClient().didCreateGlobalObjectForFrame(webPage, globalObject, m_frame, world); 1422 1419 webPage->injectedBundleLoaderClient().globalObjectIsAvailableForFrame(webPage, m_frame, world); 1423 1420 } 1424 1421 -
trunk/Tools/ChangeLog
r115949 r115952 1 2012-05-03 Stephanie Lewis <slewis@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=85450 unbounded growth of JSDOMWindowShells loading pages in the same window 4 <rdar://problem/11320059> REGRESSION (r115083): PLT3 shows linear memory growth and gets slower with each run 5 6 Reviewed by Brady Eidson. 7 8 The API added for DOMWindowExtension, didCreateGlobalObjectForFrame, would create a global object 9 for every world, even those that did not need the callback. This had the side effect of creating a 10 JSDOMWindowShell that the associated world didn't necessarily know to clean up. Instead of creating 11 unnecessary objects change the API to globalObjectIsAvailableForFrame and do not pass the global object 12 in the API. The object can be accessed later by those worlds which require it. 13 14 * TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp: 15 (TestWebKitAPI): 16 (TestWebKitAPI::didReceiveMessageFromInjectedBundle): 17 * TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp: 18 (TestWebKitAPI): 19 (DOMWindowExtensionBasic): 20 (TestWebKitAPI::DOMWindowExtensionBasic::didCreatePage): 21 (TestWebKitAPI::DOMWindowExtensionBasic::globalObjectIsAvailableForFrame): 22 (TestWebKitAPI::globalObjectIsAvailableForFrameCallback): 23 1 24 2012-05-03 Nikolas Zimmermann <nzimmermann@rim.com> 2 25 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic.cpp
r115083 r115952 37 37 38 38 static const char* expectedMessages[] = { 39 " DidCreateGlobalObjectForFrame called",40 " DidCreateGlobalObjectForFrame called",41 " DidCreateGlobalObjectForFrame called",42 " DidCreateGlobalObjectForFrame called",39 "GlobalObjectIsAvailableForFrame called", 40 "GlobalObjectIsAvailableForFrame called", 41 "GlobalObjectIsAvailableForFrame called", 42 "GlobalObjectIsAvailableForFrame called", 43 43 "Subframe finished loading", 44 44 "Extension states:\nFirst page, main frame, standard world - Connected\nFirst page, main frame, non-standard world - Connected\nFirst page, subframe, standard world - Connected\nFirst page, subframe, non-standard world - Connected\nSecond page, main frame, standard world - Uncreated\nSecond page, main frame, non-standard world - Uncreated", … … 49 49 "WillDisconnectDOMWindowExtensionFromGlobalObject called", 50 50 "WillDisconnectDOMWindowExtensionFromGlobalObject called", 51 " DidCreateGlobalObjectForFrame called",52 " DidCreateGlobalObjectForFrame called",51 "GlobalObjectIsAvailableForFrame called", 52 "GlobalObjectIsAvailableForFrame called", 53 53 "Main frame finished loading", 54 54 "Extension states:\nFirst page, main frame, standard world - Disconnected\nFirst page, main frame, non-standard world - Disconnected\nFirst page, subframe, standard world - Disconnected\nFirst page, subframe, non-standard world - Disconnected\nSecond page, main frame, standard world - Connected\nSecond page, main frame, non-standard world - Connected", … … 81 81 messages.append(bodyString); 82 82 83 if (WKStringIsEqualToUTF8CString(messageName, " DidCreateGlobalObjectForFrame"))83 if (WKStringIsEqualToUTF8CString(messageName, "GlobalObjectIsAvailableForFrame")) 84 84 liveDOMExtensionCount++; 85 85 else if (WKStringIsEqualToUTF8CString(messageName, "WillDestroyGlobalObjectForDOMWindowExtension")) { -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
r115083 r115952 40 40 41 41 static void didFinishLoadForFrameCallback(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void* clientInfo); 42 static void didCreateGlobalObjectForFrameCallback(WKBundlePageRef, JSObjectRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo);42 static void globalObjectIsAvailableForFrameCallback(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo); 43 43 static void willDisconnectDOMWindowExtensionFromGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef, const void* clientInfo); 44 44 static void didReconnectDOMWindowExtensionToGlobalObjectCallback(WKBundlePageRef, WKBundleDOMWindowExtensionRef, const void* clientInfo); … … 69 69 virtual void didCreatePage(WKBundleRef, WKBundlePageRef); 70 70 71 void didCreateGlobalObjectForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);71 void globalObjectIsAvailableForFrame(WKBundleFrameRef, WKBundleScriptWorldRef); 72 72 void willDisconnectDOMWindowExtensionFromGlobalObject(WKBundleDOMWindowExtensionRef); 73 73 void didReconnectDOMWindowExtensionToGlobalObject(WKBundleDOMWindowExtensionRef); … … 161 161 pageLoaderClient.clientInfo = this; 162 162 pageLoaderClient.didFinishLoadForFrame = didFinishLoadForFrameCallback; 163 pageLoaderClient. didCreateGlobalObjectForFrame = didCreateGlobalObjectForFrameCallback;163 pageLoaderClient.globalObjectIsAvailableForFrame = globalObjectIsAvailableForFrameCallback; 164 164 pageLoaderClient.willDisconnectDOMWindowExtensionFromGlobalObject = willDisconnectDOMWindowExtensionFromGlobalObjectCallback; 165 165 pageLoaderClient.didReconnectDOMWindowExtensionToGlobalObject = didReconnectDOMWindowExtensionToGlobalObjectCallback; … … 181 181 } 182 182 183 void DOMWindowExtensionBasic:: didCreateGlobalObjectForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world)183 void DOMWindowExtensionBasic::globalObjectIsAvailableForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world) 184 184 { 185 185 WKBundleDOMWindowExtensionRef extension = WKBundleDOMWindowExtensionCreate(frame, world); … … 197 197 198 198 updateExtensionStateRecord(extension, Connected); 199 sendBundleMessage(" DidCreateGlobalObjectForFrame called");199 sendBundleMessage("GlobalObjectIsAvailableForFrame called"); 200 200 } 201 201 … … 232 232 } 233 233 234 static void didCreateGlobalObjectForFrameCallback(WKBundlePageRef, JSObjectRef, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void* clientInfo)235 { 236 ((DOMWindowExtensionBasic*)clientInfo)-> didCreateGlobalObjectForFrame(frame, world);234 static void globalObjectIsAvailableForFrameCallback(WKBundlePageRef, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void* clientInfo) 235 { 236 ((DOMWindowExtensionBasic*)clientInfo)->globalObjectIsAvailableForFrame(frame, world); 237 237 } 238 238
Note: See TracChangeset
for help on using the changeset viewer.