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

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, 3 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 b959ae158b51d29edeedf8e603ebadd52f3c2bd4..0d4f046f684fbae7fc2ea926b4cd7e7024077ea4 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,10 +46,12 @@ 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:
@@ -93,7 +96,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.
@@ -120,7 +125,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