Changeset 126098 in webkit


Ignore:
Timestamp:
Aug 20, 2012 5:02:03 PM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8] Move collectGarbage() from ScriptController to V8GCController
https://bugs.webkit.org/show_bug.cgi?id=94455

Reviewed by Adam Barth.

  • This patch moves collectGarbage() from ScriptController to V8GCController.
  • This patch makes collectGarbage() a static method.
  • This patch removes ScriptController::lowMemoryNotification()

since it is not used at all.

No tests. No change in behavior.

Source/WebCore:

  • bindings/v8/ScriptController.cpp:
  • bindings/v8/ScriptController.h:
  • bindings/v8/V8GCController.cpp:

(WebCore::V8GCController::collectGarbage):
(WebCore):

  • bindings/v8/V8GCController.h:

(V8GCController):

Source/WebKit/chromium:

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::collectGarbage):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126096 r126098  
     12012-08-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Move collectGarbage() from ScriptController to V8GCController
     4        https://bugs.webkit.org/show_bug.cgi?id=94455
     5
     6        Reviewed by Adam Barth.
     7
     8        - This patch moves collectGarbage() from ScriptController to V8GCController.
     9        - This patch makes collectGarbage() a static method.
     10        - This patch removes ScriptController::lowMemoryNotification()
     11        since it is not used at all.
     12
     13        No tests. No change in behavior.
     14
     15        * bindings/v8/ScriptController.cpp:
     16        * bindings/v8/ScriptController.h:
     17        * bindings/v8/V8GCController.cpp:
     18        (WebCore::V8GCController::collectGarbage):
     19        (WebCore):
     20        * bindings/v8/V8GCController.h:
     21        (V8GCController):
     22
    1232012-08-20  Kentaro Hara  <haraken@chromium.org>
    224
  • trunk/Source/WebCore/bindings/v8/ScriptController.cpp

    r126096 r126098  
    345345}
    346346
    347 void ScriptController::collectGarbage()
    348 {
    349     v8::HandleScope handleScope;
    350 
    351     v8::Persistent<v8::Context> v8Context = v8::Context::New();
    352     if (v8Context.IsEmpty())
    353         return;
    354     {
    355         v8::Context::Scope scope(v8Context);
    356         v8::Local<v8::String> source = v8::String::New("if (gc) gc();");
    357         v8::Local<v8::String> name = v8::String::New("gc");
    358         v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
    359         if (!script.IsEmpty()) {
    360             V8RecursionScope::MicrotaskSuppression scope;
    361             script->Run();
    362         }
    363     }
    364     v8Context.Dispose();
    365 }
    366 
    367 void ScriptController::lowMemoryNotification()
    368 {
    369     v8::V8::LowMemoryNotification();
    370 }
    371 
    372347bool ScriptController::haveInterpreter() const
    373348{
  • trunk/Source/WebCore/bindings/v8/ScriptController.h

    r126086 r126098  
    120120    ScriptController* existingWindowShell(DOMWrapperWorld*) { return this; }
    121121
    122     void collectGarbage();
    123 
    124     // Notify V8 that the system is running low on memory.
    125     void lowMemoryNotification();
    126 
    127122    // Creates a property of the global object of a frame.
    128123    void bindToWindowObject(Frame*, const String& key, NPObject*);
  • trunk/Source/WebCore/bindings/v8/V8GCController.cpp

    r125491 r126098  
    4949#include "V8DOMImplementation.h"
    5050#include "V8MessagePort.h"
     51#include "V8RecursionScope.h"
    5152#include "V8StyleSheet.h"
    5253#include "V8StyleSheetList.h"
     
    531532}
    532533
     534void V8GCController::collectGarbage()
     535{
     536    v8::HandleScope handleScope;
     537
     538    v8::Persistent<v8::Context> context = v8::Context::New();
     539    if (context.IsEmpty())
     540        return;
     541    {
     542        v8::Context::Scope scope(context);
     543        v8::Local<v8::String> source = v8::String::New("if (gc) gc();");
     544        v8::Local<v8::String> name = v8::String::New("gc");
     545        v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
     546        if (!script.IsEmpty()) {
     547            V8RecursionScope::MicrotaskSuppression scope;
     548            script->Run();
     549        }
     550    }
     551    context.Dispose();
     552}
     553
    533554}  // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/V8GCController.h

    r125491 r126098  
    7878        static void checkMemoryUsage();
    7979        static void collectGarbageIfNecessary();
     80        static void collectGarbage();
    8081
    8182    private:
  • trunk/Source/WebKit/chromium/ChangeLog

    r126095 r126098  
     12012-08-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Move collectGarbage() from ScriptController to V8GCController
     4        https://bugs.webkit.org/show_bug.cgi?id=94455
     5
     6        Reviewed by Adam Barth.
     7
     8        - This patch moves collectGarbage() from ScriptController to V8GCController.
     9        - This patch makes collectGarbage() a static method.
     10        - This patch removes ScriptController::lowMemoryNotification()
     11        since it is not used at all.
     12
     13        No tests. No change in behavior.
     14
     15        * src/WebFrameImpl.cpp:
     16        (WebKit::WebFrameImpl::collectGarbage):
     17
    1182012-08-20  Adam Barth  <abarth@webkit.org>
    219
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r126083 r126098  
    195195#include "V8DOMFileSystem.h"
    196196#include "V8FileEntry.h"
     197#include "V8GCController.h"
    197198#include <public/WebFileSystem.h>
    198199#endif
     
    899900    // FIXME: Move this to the ScriptController and make it JS neutral.
    900901#if USE(V8)
    901     m_frame->script()->collectGarbage();
     902    V8GCController::collectGarbage();
    902903#else
    903904    notImplemented();
Note: See TracChangeset for help on using the changeset viewer.