Changeset 118133 in webkit


Ignore:
Timestamp:
May 23, 2012 12:06:11 AM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8] Pass Isolate to v8::Null() in custom bindings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=87207

Reviewed by Adam Barth.

The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to v8::Null() in custom bindings.

Also this patch makes V8DeviceMotionEventCustom::createAccelerationObject()
and V8DeviceMotionEventCustom::createRotationRateObject() static.

No tests. No change in behavior.

  • bindings/v8/custom/V8BlobCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8CSSRuleCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8CSSStyleSheetCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8CSSValueCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8ClipboardCustom.cpp:

(WebCore::V8Clipboard::typesAccessorGetter):

  • bindings/v8/custom/V8CoordinatesCustom.cpp:

(WebCore::V8Coordinates::altitudeAccessorGetter):
(WebCore::V8Coordinates::altitudeAccuracyAccessorGetter):
(WebCore::V8Coordinates::headingAccessorGetter):
(WebCore::V8Coordinates::speedAccessorGetter):

  • bindings/v8/custom/V8DOMStringMapCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8DOMTokenListCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8DOMWindowCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8DataViewCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8DeviceMotionEventCustom.cpp:

(WebCore::V8DeviceMotionEvent::accelerationAccessorGetter):
(WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter):
(WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter):
(WebCore::V8DeviceMotionEvent::intervalAccessorGetter):

  • bindings/v8/custom/V8DeviceOrientationEventCustom.cpp:

(WebCore::V8DeviceOrientationEvent::alphaAccessorGetter):
(WebCore::V8DeviceOrientationEvent::betaAccessorGetter):
(WebCore::V8DeviceOrientationEvent::gammaAccessorGetter):
(WebCore::V8DeviceOrientationEvent::absoluteAccessorGetter):

  • bindings/v8/custom/V8DocumentCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8DocumentLocationCustom.cpp:

(WebCore::V8Document::locationAccessorGetter):

  • bindings/v8/custom/V8EntryCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8EntrySyncCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8EventCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8Float32ArrayCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8Float64ArrayCustom.cpp:

(WebCore::toV8):

  • bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:

(WebCore::V8HTMLCanvasElement::getContextCallback):

  • bindings/v8/custom/V8HTMLDocumentCustom.cpp:

(WebCore::toV8):

Location:
trunk/Source/WebCore
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r118131 r118133  
     12012-05-23  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass Isolate to v8::Null() in custom bindings (Part 1)
     4        https://bugs.webkit.org/show_bug.cgi?id=87207
     5
     6        Reviewed by Adam Barth.
     7
     8        The objective is to pass Isolate around in V8 bindings.
     9        This patch passes Isolate to v8::Null() in custom bindings.
     10
     11        Also this patch makes V8DeviceMotionEventCustom::createAccelerationObject()
     12        and V8DeviceMotionEventCustom::createRotationRateObject() static.
     13
     14        No tests. No change in behavior.
     15
     16        * bindings/v8/custom/V8BlobCustom.cpp:
     17        (WebCore::toV8):
     18        * bindings/v8/custom/V8CSSRuleCustom.cpp:
     19        (WebCore::toV8):
     20        * bindings/v8/custom/V8CSSStyleSheetCustom.cpp:
     21        (WebCore::toV8):
     22        * bindings/v8/custom/V8CSSValueCustom.cpp:
     23        (WebCore::toV8):
     24        * bindings/v8/custom/V8ClipboardCustom.cpp:
     25        (WebCore::V8Clipboard::typesAccessorGetter):
     26        * bindings/v8/custom/V8CoordinatesCustom.cpp:
     27        (WebCore::V8Coordinates::altitudeAccessorGetter):
     28        (WebCore::V8Coordinates::altitudeAccuracyAccessorGetter):
     29        (WebCore::V8Coordinates::headingAccessorGetter):
     30        (WebCore::V8Coordinates::speedAccessorGetter):
     31        * bindings/v8/custom/V8DOMStringMapCustom.cpp:
     32        (WebCore::toV8):
     33        * bindings/v8/custom/V8DOMTokenListCustom.cpp:
     34        (WebCore::toV8):
     35        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     36        (WebCore::toV8):
     37        * bindings/v8/custom/V8DataViewCustom.cpp:
     38        (WebCore::toV8):
     39        * bindings/v8/custom/V8DeviceMotionEventCustom.cpp:
     40        (WebCore::V8DeviceMotionEvent::accelerationAccessorGetter):
     41        (WebCore::V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter):
     42        (WebCore::V8DeviceMotionEvent::rotationRateAccessorGetter):
     43        (WebCore::V8DeviceMotionEvent::intervalAccessorGetter):
     44        * bindings/v8/custom/V8DeviceOrientationEventCustom.cpp:
     45        (WebCore::V8DeviceOrientationEvent::alphaAccessorGetter):
     46        (WebCore::V8DeviceOrientationEvent::betaAccessorGetter):
     47        (WebCore::V8DeviceOrientationEvent::gammaAccessorGetter):
     48        (WebCore::V8DeviceOrientationEvent::absoluteAccessorGetter):
     49        * bindings/v8/custom/V8DocumentCustom.cpp:
     50        (WebCore::toV8):
     51        * bindings/v8/custom/V8DocumentLocationCustom.cpp:
     52        (WebCore::V8Document::locationAccessorGetter):
     53        * bindings/v8/custom/V8EntryCustom.cpp:
     54        (WebCore::toV8):
     55        * bindings/v8/custom/V8EntrySyncCustom.cpp:
     56        (WebCore::toV8):
     57        * bindings/v8/custom/V8EventCustom.cpp:
     58        (WebCore::toV8):
     59        * bindings/v8/custom/V8Float32ArrayCustom.cpp:
     60        (WebCore::toV8):
     61        * bindings/v8/custom/V8Float64ArrayCustom.cpp:
     62        (WebCore::toV8):
     63        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
     64        (WebCore::V8HTMLCanvasElement::getContextCallback):
     65        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
     66        (WebCore::toV8):
     67
    1682012-05-22  MORITA Hajime  <morrita@google.com>
    269
  • trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp

    r118071 r118133  
    4848{
    4949    if (!impl)
    50         return v8::Null();
     50        return v8::Null(isolate);
    5151
    5252    if (impl->isFile())
  • trunk/Source/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp

    r115366 r118133  
    4747{
    4848    if (!impl)
    49         return v8::Null();
     49        return v8::Null(isolate);
    5050    switch (impl->type()) {
    5151    case CSSRule::UNKNOWN_RULE:
  • trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp

    r115366 r118133  
    4040{
    4141    if (!impl)
    42         return v8::Null();
     42        return v8::Null(isolate);
    4343    v8::Handle<v8::Object> wrapper = V8CSSStyleSheet::wrap(impl, isolate);
    4444    // Add a hidden reference from stylesheet object to its owner node.
  • trunk/Source/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp

    r115366 r118133  
    4646{
    4747    if (!impl)
    48         return v8::Null();
     48        return v8::Null(isolate);
    4949    if (impl->isWebKitCSSTransformValue())
    5050        return toV8(static_cast<WebKitCSSTransformValue*>(impl), isolate);
  • trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp

    r118071 r118133  
    5252    HashSet<String> types = clipboard->types();
    5353    if (types.isEmpty())
    54         return v8::Null();
     54        return v8::Null(info.GetIsolate());
    5555
    5656    v8::Local<v8::Array> result = v8::Array::New(types.size());
  • trunk/Source/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp

    r95901 r118133  
    3939    Coordinates* imp = V8Coordinates::toNative(holder);
    4040    if (!imp->canProvideAltitude())
    41         return v8::Null();
     41        return v8::Null(info.GetIsolate());
    4242    return v8::Number::New(imp->altitude());
    4343}
     
    4949    Coordinates* imp = V8Coordinates::toNative(holder);
    5050    if (!imp->canProvideAltitudeAccuracy())
    51         return v8::Null();
     51        return v8::Null(info.GetIsolate());
    5252    return v8::Number::New(imp->altitudeAccuracy());
    5353}
     
    5959    Coordinates* imp = V8Coordinates::toNative(holder);
    6060    if (!imp->canProvideHeading())
    61         return v8::Null();
     61        return v8::Null(info.GetIsolate());
    6262    return v8::Number::New(imp->heading());
    6363}
     
    6969    Coordinates* imp = V8Coordinates::toNative(holder);
    7070    if (!imp->canProvideSpeed())
    71         return v8::Null();
     71        return v8::Null(info.GetIsolate());
    7272    return v8::Number::New(imp->speed());
    7373}
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp

    r117873 r118133  
    8888{
    8989    if (!impl)
    90         return v8::Null();
     90        return v8::Null(isolate);
    9191    v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl, isolate);
    9292    // Add a hidden reference from the element to the DOMStringMap.
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp

    r115366 r118133  
    4242{
    4343    if (!impl)
    44         return v8::Null();
     44        return v8::Null(isolate);
    4545    v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl, isolate);
    4646    // Add a hidden reference from the element to the DOMTokenList.
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r118063 r118133  
    604604{
    605605    if (!window)
    606         return v8::Null();
     606        return v8::Null(isolate);
    607607    // Initializes environment of a frame, and return the global object
    608608    // of the frame.
  • trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp

    r118071 r118133  
    6161{
    6262    if (!impl)
    63         return v8::Null();
     63        return v8::Null(isolate);
    6464    return V8DataView::wrap(impl, isolate);
    6565}
  • trunk/Source/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp

    r68257 r118133  
    4040namespace {
    4141
    42 v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration)
     42static v8::Handle<v8::Value> createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, v8::Isolate* isolate)
    4343{
    4444    v8::Local<v8::Object> object = v8::Object::New();
    45     object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null());
    46     object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null());
    47     object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null());
     45    object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null(isolate));
     46    object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null(isolate));
     47    object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null(isolate));
    4848    return object;
    4949}
    5050
    51 v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate)
     51static v8::Handle<v8::Value> createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, v8::Isolate* isolate)
    5252{
    5353    v8::Local<v8::Object> object = v8::Object::New();
    54     object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null());
    55     object->Set(v8::String::New("beta"),  rotationRate->canProvideBeta()  ? v8::Number::New(rotationRate->beta())  : v8::Null());
    56     object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null());
     54    object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null(isolate));
     55    object->Set(v8::String::New("beta"),  rotationRate->canProvideBeta()  ? v8::Number::New(rotationRate->beta())  : v8::Null(isolate));
     56    object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null(isolate));
    5757    return object;
    5858}
     
    130130    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
    131131    if (!imp->deviceMotionData()->acceleration())
    132         return v8::Null();
    133     return createAccelerationObject(imp->deviceMotionData()->acceleration());
     132        return v8::Null(info.GetIsolate());
     133    return createAccelerationObject(imp->deviceMotionData()->acceleration(), info.GetIsolate());
    134134}
    135135
     
    140140    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
    141141    if (!imp->deviceMotionData()->accelerationIncludingGravity())
    142         return v8::Null();
    143     return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity());
     142        return v8::Null(info.GetIsolate());
     143    return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity(), info.GetIsolate());
    144144}
    145145
     
    150150    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
    151151    if (!imp->deviceMotionData()->rotationRate())
    152         return v8::Null();
    153     return createRotationRateObject(imp->deviceMotionData()->rotationRate());
     152        return v8::Null(info.GetIsolate());
     153    return createRotationRateObject(imp->deviceMotionData()->rotationRate(), info.GetIsolate());
    154154}
    155155
     
    160160    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
    161161    if (!imp->deviceMotionData()->canProvideInterval())
    162         return v8::Null();
     162        return v8::Null(info.GetIsolate());
    163163    return v8::Number::New(imp->deviceMotionData()->interval());
    164164}
  • trunk/Source/WebCore/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp

    r105036 r118133  
    4444    DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
    4545    if (!imp->orientation()->canProvideAlpha())
    46         return v8::Null();
     46        return v8::Null(info.GetIsolate());
    4747    return v8::Number::New(imp->orientation()->alpha());
    4848}
     
    5454    DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
    5555    if (!imp->orientation()->canProvideBeta())
    56         return v8::Null();
     56        return v8::Null(info.GetIsolate());
    5757    return v8::Number::New(imp->orientation()->beta());
    5858}
     
    6464    DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
    6565    if (!imp->orientation()->canProvideGamma())
    66         return v8::Null();
     66        return v8::Null(info.GetIsolate());
    6767    return v8::Number::New(imp->orientation()->gamma());
    6868}
     
    7474    DeviceOrientationEvent* imp = V8DeviceOrientationEvent::toNative(holder);
    7575    if (!imp->orientation()->canProvideAbsolute())
    76         return v8::Null();
     76        return v8::Null(info.GetIsolate());
    7777    return v8::Boolean::New(imp->orientation()->absolute());
    7878}
  • trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp

    r117733 r118133  
    120120{
    121121    if (!impl)
    122         return v8::Null();
     122        return v8::Null(isolate);
    123123    if (impl->isHTMLDocument())
    124124        return toV8(static_cast<HTMLDocument*>(impl), isolate, forceNewObject);
  • trunk/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp

    r114925 r118133  
    3939    Document* document = V8Document::toNative(info.Holder());
    4040    if (!document->frame())
    41         return v8::Null();
     41        return v8::Null(info.GetIsolate());
    4242
    4343    DOMWindow* window = document->frame()->domWindow();
  • trunk/Source/WebCore/bindings/v8/custom/V8EntryCustom.cpp

    r114925 r118133  
    4848{
    4949    if (!impl)
    50         return v8::Null();
     50        return v8::Null(isolate);
    5151
    5252    if (impl->isFile())
  • trunk/Source/WebCore/bindings/v8/custom/V8EntrySyncCustom.cpp

    r114925 r118133  
    4848{
    4949    if (!impl)
    50         return v8::Null();
     50        return v8::Null(isolate);
    5151
    5252    if (impl->isFile())
  • trunk/Source/WebCore/bindings/v8/custom/V8EventCustom.cpp

    r115366 r118133  
    7777{
    7878    if (!event)
    79         return v8::Null();
     79        return v8::Null(isolate);
    8080
    8181    String desiredInterface = event->interfaceName();
  • trunk/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp

    r115366 r118133  
    5858{
    5959    if (!impl)
    60         return v8::Null();
     60        return v8::Null(isolate);
    6161    v8::Handle<v8::Object> wrapper = V8Float32Array::wrap(impl, isolate);
    6262    if (!wrapper.IsEmpty())
  • trunk/Source/WebCore/bindings/v8/custom/V8Float64ArrayCustom.cpp

    r115366 r118133  
    5353{
    5454    if (!impl)
    55         return v8::Null();
     55        return v8::Null(isolate);
    5656    v8::Handle<v8::Object> wrapper = V8Float64Array::wrap(impl, isolate);
    5757    if (!wrapper.IsEmpty())
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp

    r115068 r118133  
    8585    CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
    8686    if (!result)
    87         return v8::Null();
     87        return v8::Null(args.GetIsolate());
    8888    if (result->is2d())
    8989        return toV8(static_cast<CanvasRenderingContext2D*>(result), args.GetIsolate());
     
    9393#endif
    9494    ASSERT_NOT_REACHED();
    95     return v8::Null();
     95    return v8::Null(args.GetIsolate());
    9696}
    9797
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r118071 r118133  
    188188{
    189189    if (!impl)
    190         return v8::Null();
     190        return v8::Null(isolate);
    191191    v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, isolate, forceNewObject);
    192192    if (wrapper.IsEmpty())
Note: See TracChangeset for help on using the changeset viewer.