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

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

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months 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/v8/SerializedScriptValue.h
diff --git a/Source/bindings/v8/SerializedScriptValue.h b/Source/bindings/v8/SerializedScriptValue.h
index 3de5644db34c36e6d87db3b4f13012adb9908a60..2d94ec9edd50eaf4faf0652c0d4c6537f38c45bd 100644
--- a/Source/bindings/v8/SerializedScriptValue.h
+++ b/Source/bindings/v8/SerializedScriptValue.h
@@ -33,6 +33,7 @@
#include "bindings/v8/ScriptValue.h"
+#include "wtf/HashMap.h"
#include "wtf/ThreadSafeRefCounted.h"
#include <v8.h>
@@ -45,16 +46,19 @@ class ArrayBufferContents;
namespace WebCore {
+class BlobDataHandle;
class MessagePort;
typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray;
+typedef HashMap<String, RefPtr<BlobDataHandle> > BlobDataHandleMap;
class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> {
public:
// Increment this for each incompatible change to the wire format.
// Version 2: Added StringUCharTag for UChar v8 strings.
- static const uint32_t wireFormatVersion = 2;
+ // Version 3: Switched to using uuids as blob data identifiers.
+ static const uint32_t wireFormatVersion = 3;
virtual ~SerializedScriptValue();
@@ -95,7 +99,9 @@ public:
ScriptValue deserializeForInspector(ScriptState*);
- const Vector<String>& blobURLs() const { return m_blobURLs; }
+ // Only reflects the truth if the SSV was created by walking a v8 value, not reliable
+ // if the SSV was created createdFromWire(data).
+ bool containsBlobs() const { return !m_blobDataHandles.isEmpty(); }
// Informs the V8 about external memory allocated and owned by this object. Large values should contribute
// to GC counters to eventually trigger a GC, otherwise flood of postMessage() can cause OOM.
@@ -122,7 +128,7 @@ private:
String m_data;
OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
- Vector<String> m_blobURLs;
+ BlobDataHandleMap m_blobDataHandles;
intptr_t m_externallyAllocatedMemory;
};

Powered by Google App Engine
This is Rietveld 408576698