Add WKContextGarbageCollectJavaScriptObjects() which does a garbage collection in...
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2011 22:21:07 +0000 (22:21 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2011 22:21:07 +0000 (22:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67526

Reviewed by Darin Adler.

* UIProcess/API/C/WKContext.cpp:
(WKContextGarbageCollectJavaScriptObjects):
* UIProcess/API/C/WKContext.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::garbageCollectJavaScriptObjects): Send a message to WebProcess to garbage collect JS objects.
* UIProcess/WebContext.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::garbageCollectJavaScriptObjects): Call GCController::garbageCollectNow().
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Add GarbageCollectJavaScriptObjects message.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94454 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in

index bd811a2..0fba17f 100644 (file)
@@ -1,3 +1,21 @@
+2011-09-02  Ada Chan  <adachan@apple.com>
+
+        Add WKContextGarbageCollectJavaScriptObjects() which does a garbage collection in the WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=67526
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextGarbageCollectJavaScriptObjects):
+        * UIProcess/API/C/WKContext.h:
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::garbageCollectJavaScriptObjects): Send a message to WebProcess to garbage collect JS objects.
+        * UIProcess/WebContext.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::garbageCollectJavaScriptObjects): Call GCController::garbageCollectNow().
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in: Add GarbageCollectJavaScriptObjects message.
+
 2011-09-02  Anders Carlsson  <andersca@apple.com>
 
         Remove plug-in paths from web process sandbox
index 56b4fd0..2b6afb8 100644 (file)
@@ -237,3 +237,8 @@ void WKContextGetStatistics(WKContextRef contextRef, void* context, WKContextGet
     toImpl(contextRef)->getWebCoreStatistics(DictionaryCallback::create(context, callback));    
 }
 
+void WKContextGarbageCollectJavaScriptObjects(WKContextRef contextRef)
+{
+    toImpl(contextRef)->garbageCollectJavaScriptObjects();
+}
+
index 876c09d..cd6750e 100644 (file)
@@ -140,6 +140,8 @@ WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRe
     
 typedef void (*WKContextGetStatisticsFunction)(WKDictionaryRef statistics, WKErrorRef error, void* functionContext);
 WK_EXPORT void WKContextGetStatistics(WKContextRef context, void* functionContext, WKContextGetStatisticsFunction function);
+    
+WK_EXPORT void WKContextGarbageCollectJavaScriptObjects(WKContextRef context);
 
 #ifdef __cplusplus
 }
index 01dd4c1..9b6bc88 100644 (file)
@@ -829,4 +829,9 @@ void WebContext::didGetWebCoreStatistics(const StatisticsData& statisticsData, u
     callback->performCallbackWithReturnValue(statistics.get());
 }
     
+void WebContext::garbageCollectJavaScriptObjects()
+{
+    process()->send(Messages::WebProcess::GarbageCollectJavaScriptObjects(), 0);
+}
+
 } // namespace WebKit
index 79ff657..eaba67a 100644 (file)
@@ -181,6 +181,7 @@ public:
     bool httpPipeliningEnabled();
     
     void getWebCoreStatistics(PassRefPtr<DictionaryCallback>);
+    void garbageCollectJavaScriptObjects();
 
 private:
     WebContext(ProcessModel, const String& injectedBundlePath);
index 030abda..30d85e0 100644 (file)
@@ -934,6 +934,11 @@ void WebProcess::getWebCoreStatistics(uint64_t callbackID)
     m_connection->send(Messages::WebContext::DidGetWebCoreStatistics(data, callbackID), 0);
 }
 
+void WebProcess::garbageCollectJavaScriptObjects()
+{
+    gcController().garbageCollectNow();
+}
+
 #if ENABLE(PLUGIN_PROCESS)
 void WebProcess::pluginProcessCrashed(const String& pluginPath)
 {
index 0c5632f..d90784c 100644 (file)
@@ -178,6 +178,7 @@ private:
     void setTextCheckerState(const TextCheckerState&);
     
     void getWebCoreStatistics(uint64_t callbackID);
+    void garbageCollectJavaScriptObjects();
 
     // ChildProcess
     virtual bool shouldTerminate();
index fd666e6..55a3770 100644 (file)
@@ -69,4 +69,5 @@ messages -> WebProcess {
     SetEnhancedAccessibility(bool flag)
 
     GetWebCoreStatistics(uint64_t callbackID)
+    GarbageCollectJavaScriptObjects()
 }