Changeset 55424 in webkit


Ignore:
Timestamp:
Mar 2, 2010 12:48:21 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-02 Mads Ager <ager@chromium.org>

Reviewed by Adam Barth.

[V8] V8 should be notified of context disposals
https://bugs.webkit.org/show_bug.cgi?id=35526

Notify V8 of context disposals to allow it to clean up memory from those
contexts when idle. When disposing a context, start a timer that will
give V8 an idle notification after a while to force cleanup. Use a timer
to avoid performing an idle notification in the middle of navigation where
we know we are not idle.

  • WebCore.gypi:
  • bindings/v8/V8DOMWindowShell.cpp: (WebCore::V8DOMWindowShell::disposeContextHandles):
  • bindings/v8/V8GCForContextDispose.cpp: Added. (WebCore::V8GCForContextDispose::V8GCForContextDispose): (WebCore::V8GCForContextDispose::notifyContextDisposed): (WebCore::V8GCForContextDispose::notifyIdleSooner): (WebCore::V8GCForContextDispose::instance): (WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
  • bindings/v8/V8GCForContextDispose.h: Added.
  • bindings/v8/custom/V8DOMWindowCustom.cpp: (WebCore::WindowSetTimeoutImpl):

2010-03-02 Mads Ager <ager@chromium.org>

Reviewed by Adam Barth.

[V8] V8 should be notified of context disposals
https://bugs.webkit.org/show_bug.cgi?id=35526

Update V8 DEPS in order to get V8 API changes needed for context
disposal notifications.

  • DEPS:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55422 r55424  
     12010-03-02  Mads Ager  <ager@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        [V8] V8 should be notified of context disposals
     6        https://bugs.webkit.org/show_bug.cgi?id=35526
     7
     8        Notify V8 of context disposals to allow it to clean up memory from those
     9        contexts when idle.  When disposing a context, start a timer that will
     10        give V8 an idle notification after a while to force cleanup.  Use a timer
     11        to avoid performing an idle notification in the middle of navigation where
     12        we know we are not idle.
     13
     14        * WebCore.gypi:
     15        * bindings/v8/V8DOMWindowShell.cpp:
     16        (WebCore::V8DOMWindowShell::disposeContextHandles):
     17        * bindings/v8/V8GCForContextDispose.cpp: Added.
     18        (WebCore::V8GCForContextDispose::V8GCForContextDispose):
     19        (WebCore::V8GCForContextDispose::notifyContextDisposed):
     20        (WebCore::V8GCForContextDispose::notifyIdleSooner):
     21        (WebCore::V8GCForContextDispose::instance):
     22        (WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
     23        * bindings/v8/V8GCForContextDispose.h: Added.
     24        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     25        (WebCore::WindowSetTimeoutImpl):
     26
    1272010-03-02  Pavel Feldman  <pfeldman@chromium.org>
    228
  • trunk/WebCore/WebCore.gypi

    r55422 r55424  
    858858            'bindings/v8/V8GCController.cpp',
    859859            'bindings/v8/V8GCController.h',
     860            'bindings/v8/V8GCForContextDispose.cpp',
     861            'bindings/v8/V8GCForContextDispose.h',
    860862            'bindings/v8/V8Helpers.cpp',
    861863            'bindings/v8/V8Helpers.h',
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r54718 r55424  
    5252#include "V8DOMWindow.h"
    5353#include "V8Document.h"
     54#include "V8GCForContextDispose.h"
    5455#include "V8HiddenPropertyName.h"
    5556#include "V8History.h"
     
    151152        m_context.Dispose();
    152153        m_context.Clear();
     154
     155        // It's likely that disposing the context has created a lot of
     156        // garbage. Notify V8 about this so it'll have a chance of cleaning
     157        // it up when idle.
     158        V8GCForContextDispose::instance().notifyContextDisposed();
    153159    }
    154160
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r55096 r55424  
    5656#include "V8BindingState.h"
    5757#include "V8CustomEventListener.h"
     58#include "V8GCForContextDispose.h"
    5859#include "V8HTMLCollection.h"
    5960#include "V8MessagePortCustom.h"
     
    134135    } else {
    135136        id = DOMTimer::install(scriptContext, new ScheduledAction(V8Proxy::context(imp->frame()), functionString), timeout, singleShot);
     137    }
     138
     139    // Try to do the idle notification before the timeout expires to get better
     140    // use of any idle time. Aim for the middle of the interval for simplicity.
     141    if (timeout > 0) {
     142        double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2;
     143        V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval);
    136144    }
    137145
  • trunk/WebKit/chromium/ChangeLog

    r55419 r55424  
     12010-03-02  Mads Ager  <ager@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        [V8] V8 should be notified of context disposals
     6        https://bugs.webkit.org/show_bug.cgi?id=35526
     7
     8        Update V8 DEPS in order to get V8 API changes needed for context
     9        disposal notifications.
     10
     11        * DEPS:
     12
    1132010-03-02  Kenneth Russell  <kbr@google.com>
    214
  • trunk/WebKit/chromium/DEPS

    r55318 r55424  
    4444  'ots_rev': '26',
    4545  'skia_rev': '490',
    46   'v8_rev': '3963',
     46  'v8_rev': '3985',
    4747
    4848  # Windows:
Note: See TracChangeset for help on using the changeset viewer.