Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: Source/bindings/core/v8/SerializedScriptValue.h

Issue 718383003: bindings: fixed incorrect dependency of SerializedScriptValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added fast/js/structured-clone.html Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/SerializationTag.h ('k') | Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/SerializedScriptValue.h
diff --git a/Source/bindings/core/v8/SerializedScriptValue.h b/Source/bindings/core/v8/SerializedScriptValue.h
index b18bec9bf526d60f399bfa68bf6723ff49d5ed06..28683e13e8855bca1b265920a11c9489a2ee52b8 100644
--- a/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/Source/bindings/core/v8/SerializedScriptValue.h
@@ -55,7 +55,7 @@ typedef Vector<RefPtr<DOMArrayBuffer>, 1> ArrayBufferArray;
typedef HashMap<String, RefPtr<BlobDataHandle> > BlobDataHandleMap;
typedef Vector<blink::WebBlobInfo> WebBlobInfoArray;
-class SerializedScriptValue final : public ThreadSafeRefCounted<SerializedScriptValue> {
+class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> {
public:
// Increment this for each incompatible change to the wire format.
// Version 2: Added StringUCharTag for UChar v8 strings.
@@ -66,27 +66,11 @@ public:
// Version 7: Extended File serialization with user visibility.
static const uint32_t wireFormatVersion = 7;
- ~SerializedScriptValue();
-
// VarInt encoding constants.
static const int varIntShift = 7;
static const int varIntMask = (1 << varIntShift) - 1;
- // If a serialization error occurs (e.g., cyclic input value) this
- // function returns an empty representation, schedules a V8 exception to
- // be thrown using v8::ThrowException(), and sets |didThrow|. In this case
- // the caller must not invoke any V8 operations until control returns to
- // V8. When serialization is successful, |didThrow| is false.
- static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferArray*, ExceptionState&, v8::Isolate*);
- static PassRefPtr<SerializedScriptValue> createFromWire(const String&);
- static PassRefPtr<SerializedScriptValue> createFromWireBytes(const Vector<uint8_t>&);
- static PassRefPtr<SerializedScriptValue> create(const String&);
- static PassRefPtr<SerializedScriptValue> create(const String&, v8::Isolate*);
- static PassRefPtr<SerializedScriptValue> create();
- static PassRefPtr<SerializedScriptValue> create(const ScriptValue&, WebBlobInfoArray*, ExceptionState&, v8::Isolate*);
-
- // Never throws exceptions.
- static PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v8::Handle<v8::Value>);
+ virtual ~SerializedScriptValue();
static PassRefPtr<SerializedScriptValue> nullValue();
@@ -111,6 +95,7 @@ public:
void registerMemoryAllocatedWithCurrentScriptContext();
private:
+ // The followings are private, but used by SerializedScriptValueFactory.
enum StringDataMode {
StringValue,
WireData
@@ -118,15 +103,23 @@ private:
typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray;
SerializedScriptValue();
- SerializedScriptValue(v8::Handle<v8::Value>, MessagePortArray*, ArrayBufferArray*, WebBlobInfoArray*, ExceptionState&, v8::Isolate*);
explicit SerializedScriptValue(const String& wireData);
- static PassOwnPtr<ArrayBufferContentsArray> transferArrayBuffers(v8::Isolate*, ArrayBufferArray&, ExceptionState&);
+ BlobDataHandleMap& blobDataHandles() { return m_blobDataHandles; }
+ String& data() { return m_data; }
+ void setData(const String& data) { m_data = data; }
+ void transferArrayBuffers(v8::Isolate*, ArrayBufferArray&, ExceptionState&);
+ ArrayBufferContentsArray* arrayBufferContentsArray() { return m_arrayBufferContentsArray.get(); }
+
+ static PassOwnPtr<ArrayBufferContentsArray> createArrayBuffers(v8::Isolate*, ArrayBufferArray&, ExceptionState&);
+private:
String m_data;
OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
BlobDataHandleMap m_blobDataHandles;
intptr_t m_externallyAllocatedMemory;
+
+ friend class SerializedScriptValueFactory;
};
} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/SerializationTag.h ('k') | Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698