Changeset 150580 in webkit


Ignore:
Timestamp:
May 23, 2013 5:22:23 AM (11 years ago)
Author:
Christophe Dumez
Message:

Remove special case for MessagePortArray from bindings generator
https://bugs.webkit.org/show_bug.cgi?id=116653

Reviewed by Kentaro Hara.

Use MessagePort[] instead of MessagePortArray type in the IDL as MessagePortArray
is not defined on IDL side. This allows us to remove the special case for
MessagePortArray from the bindings generator.

No new tests, no behavior change.

  • bindings/js/JSMessageEventCustom.cpp:

(WebCore::JSMessageEvent::data):

  • bindings/scripts/CodeGeneratorJS.pm:

(NativeToJSValue): Remove special case for MessagePortArray.

  • bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp:
  • bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h:

(WebDOMTestSerializedScriptValueInterface):

  • bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp:

(webkit_dom_test_serialized_script_value_interface_get_property):
(webkit_dom_test_serialized_script_value_interface_class_init):

  • bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::jsTestSerializedScriptValueInterfacePorts):

  • bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h:
  • bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm:
  • bindings/scripts/test/TestSerializedScriptValueInterface.idl: Replace MessagePortArray

by MessagePort[].

  • dom/MessageEvent.h:

(WebCore::MessageEvent::ports): The method should return a Vector, not a Vector*
as the array on JavaScript side is not nullable.

  • dom/MessageEvent.idl: Replace MessagePortArray by MessagePort[].
Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150575 r150580  
     12013-05-23  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Remove special case for MessagePortArray from bindings generator
     4        https://bugs.webkit.org/show_bug.cgi?id=116653
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Use MessagePort[] instead of MessagePortArray type in the IDL as MessagePortArray
     9        is not defined on IDL side. This allows us to remove the special case for
     10        MessagePortArray from the bindings generator.
     11
     12        No new tests, no behavior change.
     13
     14        * bindings/js/JSMessageEventCustom.cpp:
     15        (WebCore::JSMessageEvent::data):
     16        * bindings/scripts/CodeGeneratorJS.pm:
     17        (NativeToJSValue): Remove special case for MessagePortArray.
     18        * bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp:
     19        * bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h:
     20        (WebDOMTestSerializedScriptValueInterface):
     21        * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp:
     22        (webkit_dom_test_serialized_script_value_interface_get_property):
     23        (webkit_dom_test_serialized_script_value_interface_class_init):
     24        * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h:
     25        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     26        (WebCore::jsTestSerializedScriptValueInterfacePorts):
     27        * bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h:
     28        * bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm:
     29        * bindings/scripts/test/TestSerializedScriptValueInterface.idl: Replace MessagePortArray
     30        by MessagePort[].
     31        * dom/MessageEvent.h:
     32        (WebCore::MessageEvent::ports): The method should return a Vector, not a Vector*
     33        as the array on JavaScript side is not nullable.
     34        * dom/MessageEvent.idl: Replace MessagePortArray by MessagePort[].
     35
    1362013-05-23  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
    237
  • trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp

    r150249 r150580  
    6464    case MessageEvent::DataTypeSerializedScriptValue:
    6565        if (RefPtr<SerializedScriptValue> serializedValue = event->dataAsSerializedScriptValue()) {
    66             MessagePortArray* ports = static_cast<MessageEvent*>(impl())->ports();
    67             result = serializedValue->deserialize(exec, globalObject(), ports, NonThrowing);
     66            MessagePortArray ports = static_cast<MessageEvent*>(impl())->ports();
     67            result = serializedValue->deserialize(exec, globalObject(), &ports, NonThrowing);
    6868        }
    6969        else
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r150292 r150580  
    35863586        }
    35873587        AddToImplIncludes("<runtime/JSArray.h>", $conditional);
     3588
    35883589        return "jsArray(exec, $thisValue->globalObject(), $value)";
    35893590    }
     
    36033604        AddToImplIncludes("SerializedScriptValue.h", $conditional);
    36043605        return "$value ? $value->deserialize(exec, castedThis->globalObject(), 0) : jsNull()";
    3605     } elsif ($type eq "MessagePortArray") {
    3606         AddToImplIncludes("MessagePort.h", $conditional);
    3607         AddToImplIncludes("JSMessagePort.h", $conditional);
    3608         AddToImplIncludes("<runtime/JSArray.h>", $conditional);
    3609         return "$value ? jsArray(exec, $globalObject, *$value) : constructEmptyArray(exec, 0, castedThis->globalObject())";
    36103606    } else {
    36113607        # Default, include header with same name.
  • trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp

    r149935 r150580  
    2525#include "WebDOMTestSerializedScriptValueInterface.h"
    2626
    27 #include "MessagePortArray.h"
    2827#include "SerializedScriptValue.h"
    2928#include "TestSerializedScriptValueInterface.h"
    30 #include "WebDOMMessagePortArray.h"
    3129#include "WebExceptionHandler.h"
    3230#include <wtf/GetPtr.h>
     
    118116}
    119117
    120 WebDOMMessagePortArray WebDOMTestSerializedScriptValueInterface::ports() const
    121 {
    122     if (!impl())
    123         return WebDOMMessagePortArray();
    124 
    125     return toWebKit(WTF::getPtr(impl()->ports()));
    126 }
    127 
    128118WebDOMString WebDOMTestSerializedScriptValueInterface::cachedReadonlyValue() const
    129119{
  • trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h

    r149729 r150580  
    3333};
    3434
    35 class WebDOMMessagePortArray;
    3635class WebDOMString;
    3736
     
    4948    WebDOMString cachedValue() const;
    5049    void setCachedValue(const WebDOMString&);
    51     WebDOMMessagePortArray ports() const;
    5250    WebDOMString cachedReadonlyValue() const;
    5351
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp

    r149729 r150580  
    2626#include "ExceptionCode.h"
    2727#include "JSMainThreadExecState.h"
    28 #include "WebKitDOMMessagePortArrayPrivate.h"
    2928#include "WebKitDOMPrivate.h"
    3029#include "WebKitDOMSerializedScriptValuePrivate.h"
     
    7978    PROP_READONLY_VALUE,
    8079    PROP_CACHED_VALUE,
    81     PROP_PORTS,
    8280    PROP_CACHED_READONLY_VALUE,
    8381};
     
    124122#if ENABLE(Condition1) || ENABLE(Condition2)
    125123        RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->cachedValue();
    126         g_value_set_object(value, WebKit::kit(ptr.get()));
    127 #else
    128         WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    129         WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    130 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */
    131         break;
    132     }
    133     case PROP_PORTS: {
    134 #if ENABLE(Condition1) || ENABLE(Condition2)
    135         RefPtr<WebCore::MessagePortArray> ptr = coreSelf->ports();
    136124        g_value_set_object(value, WebKit::kit(ptr.get()));
    137125#else
     
    198186                                                           WEBKIT_PARAM_READWRITE));
    199187    g_object_class_install_property(gobjectClass,
    200                                     PROP_PORTS,
    201                                     g_param_spec_object("ports", /* name */
    202                                                            "test_serialized_script_value_interface_ports", /* short description */
    203                                                            "read-only  WebKitDOMMessagePortArray* TestSerializedScriptValueInterface.ports", /* longer - could do with some extra doc stuff here */
    204                                                            WEBKIT_TYPE_DOM_MESSAGE_PORT_ARRAY, /* gobject type */
    205                                                            WEBKIT_PARAM_READABLE));
    206     g_object_class_install_property(gobjectClass,
    207188                                    PROP_CACHED_READONLY_VALUE,
    208189                                    g_param_spec_object("cached-readonly-value", /* name */
     
    299280}
    300281
    301 WebKitDOMMessagePortArray*
    302 webkit_dom_test_serialized_script_value_interface_get_ports(WebKitDOMTestSerializedScriptValueInterface* self)
    303 {
    304 #if ENABLE(Condition1) || ENABLE(Condition2)
    305     WebCore::JSMainThreadNullState state;
    306     g_return_val_if_fail(WEBKIT_DOM_IS_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(self), 0);
    307     WebCore::TestSerializedScriptValueInterface* item = WebKit::core(self);
    308     RefPtr<WebCore::MessagePortArray> gobjectResult = WTF::getPtr(item->ports());
    309     return WebKit::kit(gobjectResult.get());
    310 #else
    311     WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    312     WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    313     return 0;
    314 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */
    315 }
    316 
    317282WebKitDOMSerializedScriptValue*
    318283webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value(WebKitDOMTestSerializedScriptValueInterface* self)
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h

    r149729 r150580  
    103103
    104104/**
    105  * webkit_dom_test_serialized_script_value_interface_get_ports:
    106  * @self: A #WebKitDOMTestSerializedScriptValueInterface
    107  *
    108  * Returns: (transfer none):
    109  *
    110 **/
    111 WEBKIT_API WebKitDOMMessagePortArray*
    112 webkit_dom_test_serialized_script_value_interface_get_ports(WebKitDOMTestSerializedScriptValueInterface* self);
    113 
    114 /**
    115105 * webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value:
    116106 * @self: A #WebKitDOMTestSerializedScriptValueInterface
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r150249 r150580  
    180180    UNUSED_PARAM(exec);
    181181    TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
    182     JSValue result = impl->ports() ? jsArray(exec, castedThis->globalObject(), *impl->ports()) : constructEmptyArray(exec, 0, castedThis->globalObject());
     182    JSValue result = jsArray(exec, castedThis->globalObject(), impl->ports());
    183183    return result;
    184184}
  • trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h

    r149729 r150580  
    2929#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST
    3030
    31 @class DOMMessagePortArray;
    3231@class NSString;
    3332
     
    3635@property(readonly, retain) NSString *readonlyValue;
    3736@property(retain) NSString *cachedValue;
    38 @property(readonly, retain) DOMMessagePortArray *ports;
    3937@property(readonly, retain) NSString *cachedReadonlyValue;
    4038@end
  • trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm

    r149729 r150580  
    3737#import "DOMCSSValueInternal.h"
    3838#import "DOMEventInternal.h"
    39 #import "DOMMessagePortArrayInternal.h"
    4039#import "DOMNodeInternal.h"
    4140#import "DOMStyleSheetInternal.h"
     
    4342#import "ExceptionHandlers.h"
    4443#import "JSMainThreadExecState.h"
    45 #import "MessagePortArray.h"
    4644#import "SerializedScriptValue.h"
    4745#import "TestSerializedScriptValueInterface.h"
     
    106104}
    107105
    108 - (DOMMessagePortArray *)ports
    109 {
    110     WebCore::JSMainThreadNullState state;
    111     return kit(WTF::getPtr(IMPL->ports()));
    112 }
    113 
    114106- (NSString *)cachedReadonlyValue
    115107{
  • trunk/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl

    r149729 r150580  
    3232    readonly attribute SerializedScriptValue readonlyValue;
    3333    [CachedAttribute] attribute SerializedScriptValue cachedValue;
    34     readonly attribute MessagePortArray ports;
     34    readonly attribute MessagePort[] ports;
    3535    [CachedAttribute] readonly attribute SerializedScriptValue cachedReadonlyValue;
    3636};
  • trunk/Source/WebCore/dom/MessageEvent.h

    r145930 r150580  
    8989    const String& lastEventId() const { return m_lastEventId; }
    9090    DOMWindow* source() const { return m_source.get(); }
    91     MessagePortArray* ports() const { return m_ports.get(); }
     91    MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
    9292
    9393    // FIXME: Remove this when we have custom ObjC binding support.
  • trunk/Source/WebCore/dom/MessageEvent.idl

    r150249 r150580  
    3535#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
    3636    [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any data;
    37     [InitializedByEventConstructor] readonly attribute MessagePortArray ports;
     37    [InitializedByEventConstructor] readonly attribute MessagePort[] ports;
    3838
    3939    [Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg,
Note: See TracChangeset for help on using the changeset viewer.