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

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: 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
Index: Source/bindings/core/v8/SerializedScriptValue.h
diff --git a/Source/bindings/core/v8/SerializedScriptValue.h b/Source/bindings/core/v8/SerializedScriptValue.h
index 9bd2c5dc918721af1d33cec9190935c90a718eb9..c0dc8aab6e750cc5da65122e496df80761cd5c96 100644
--- a/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/Source/bindings/core/v8/SerializedScriptValue.h
@@ -56,7 +56,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.
@@ -67,27 +67,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();
@@ -97,7 +81,7 @@ public:
// Deserializes the value (in the current context). Returns a null value in
// case of failure.
v8::Handle<v8::Value> deserialize(MessagePortArray* = 0);
- v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0, const WebBlobInfoArray* = 0);
+ virtual v8::Handle<v8::Value> deserialize(v8::Isolate*, MessagePortArray* = 0, const WebBlobInfoArray* = 0);
// Helper function which pulls the values out of a JS sequence and into a MessagePortArray.
// Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3
@@ -111,7 +95,7 @@ public:
// The memory registration is revoked automatically in destructor.
void registerMemoryAllocatedWithCurrentScriptContext();
-private:
+protected:
enum StringDataMode {
StringValue,
WireData
@@ -122,12 +106,21 @@ private:
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(); }
+
+private:
+ static PassOwnPtr<ArrayBufferContentsArray> createArrayBuffers(v8::Isolate*, ArrayBufferArray&, ExceptionState&);
String m_data;
OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
BlobDataHandleMap m_blobDataHandles;
intptr_t m_externallyAllocatedMemory;
+
+ friend class SerializedScriptValueFactory;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698