Changeset 51256 in webkit


Ignore:
Timestamp:
Nov 20, 2009 1:32:03 PM (14 years ago)
Author:
oliver@apple.com
Message:

<rdar://7409188> WebKit needs to be able to serialize and deserialize objects.

Reviewed by Dave Hyatt.

Expose WebCore object serialization to WebKit.

Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51255 r51256  
     12009-11-20  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        <rdar://7409188> WebKit needs to be able to serialize and deserialize objects.
     6
     7        Expose WebCore object serialization to WebKit.
     8
     9        * WebCore.base.exp:
     10        * bindings/js/SerializedScriptValue.cpp:
     11        (WebCore::SerializedScriptValue::~SerializedScriptValue):
     12        (WebCore::SerializedScriptValue::create):
     13        (WebCore::SerializedScriptValue::deserialize):
     14        * bindings/js/SerializedScriptValue.h:
     15
    1162009-11-20  Brian Weinstein  <bweinstein@apple.com>
    217
  • trunk/WebCore/WebCore.base.exp

    r51191 r51256  
    417417__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
    418418__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
     419__ZN7WebCore21SerializedScriptValue11deserializeEPK15OpaqueJSContextPPK13OpaqueJSValue
     420__ZN7WebCore21SerializedScriptValue6createEPK15OpaqueJSContextPK13OpaqueJSValuePS6_
     421__ZN7WebCore21SerializedScriptValueD1Ev
    419422__ZN7WebCore21WindowsLatin1EncodingEv
    420423__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
  • trunk/WebCore/bindings/js/SerializedScriptValue.cpp

    r49216 r51256  
    2828#include "SerializedScriptValue.h"
    2929
     30#include <JavaScriptCore/APICast.h>
    3031#include <runtime/DateInstance.h>
    3132#include <runtime/ExceptionHelpers.h>
     
    837838}
    838839
    839 }
     840SerializedScriptValue::~SerializedScriptValue()
     841{
     842}
     843
     844PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue, JSValueRef* exception)
     845{
     846    ExecState* exec = toJS(originContext);
     847    JSValue value = toJS(exec, apiValue);
     848    PassRefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(exec, value);
     849    if (exec->hadException()) {
     850        if (exception)
     851            *exception = toRef(exec, exec->exception());
     852        exec->clearException();
     853        return 0;
     854    }
     855   
     856    return serializedValue;
     857}
     858
     859JSValueRef SerializedScriptValue::deserialize(JSContextRef destinationContext, JSValueRef* exception)
     860{
     861    ExecState* exec = toJS(destinationContext);
     862    JSValue value = deserialize(exec);
     863    if (exec->hadException()) {
     864        if (exception)
     865            *exception = toRef(exec, exec->exception());
     866        exec->clearException();
     867        return 0;
     868    }
     869    return toRef(exec, value);
     870}
     871
     872}
  • trunk/WebCore/bindings/js/SerializedScriptValue.h

    r49216 r51256  
    3030#include "ScriptValue.h"
    3131
     32typedef const struct OpaqueJSContext* JSContextRef;
     33typedef const struct OpaqueJSValue* JSValueRef;
     34
    3235namespace WebCore {
    3336    class SerializedObject;
     
    151154        }
    152155
     156        static PassRefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef value, JSValueRef* exception);
     157
    153158        static PassRefPtr<SerializedScriptValue> create(String string)
    154159        {
     
    183188        }
    184189
    185         ~SerializedScriptValue() {}
     190        JSValueRef deserialize(JSContextRef, JSValueRef* exception);
     191        ~SerializedScriptValue();
    186192
    187193    private:
Note: See TracChangeset for help on using the changeset viewer.