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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h

Issue 1423513005: Reland of: Make Imagebitmap Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
index 060b2afd7f00bad792ac3e95e35d2401858f1b68..22e09c1f82e6d4ddb85210ee2e90ff9b6fa7f10c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h
@@ -9,6 +9,8 @@
#include "bindings/core/v8/SerializedScriptValue.h"
#include "bindings/core/v8/V8Binding.h"
#include "core/CoreExport.h"
+#include "core/frame/ImageBitmap.h"
sof 2015/11/09 12:25:54 This #include isn't needed any longer?
xidachen 2015/11/16 18:00:51 Done.
+#include "third_party/skia/include/core/SkImage.h"
#include "wtf/ArrayBufferContents.h"
#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
@@ -26,6 +28,7 @@ class File;
class FileList;
typedef Vector<WTF::ArrayBufferContents, 1> ArrayBufferContentsArray;
+typedef Vector<RefPtr<SkImage>, 1> ImageBitmapContentsArray;
// V8ObjectMap is a map from V8 objects to arbitrary values of type T.
// V8 objects (or handles to V8 objects) cannot be used as keys in ordinary wtf::HashMaps;
@@ -137,6 +140,7 @@ public:
void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags);
void writeTransferredMessagePort(uint32_t index);
void writeTransferredArrayBuffer(uint32_t index);
+ void writeTransferredImageBitmap(uint32_t index);
void writeTransferredSharedArrayBuffer(uint32_t index);
void writeObjectReference(uint32_t reference);
void writeObject(uint32_t numProperties);
@@ -202,7 +206,7 @@ public:
JSException
};
- ScriptValueSerializer(SerializedScriptValueWriter&, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*);
+ ScriptValueSerializer(SerializedScriptValueWriter&, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, WebBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*);
v8::Isolate* isolate() { return m_scriptState->isolate(); }
v8::Local<v8::Context> context() { return m_scriptState->context(); }
@@ -401,6 +405,7 @@ private:
StateBase* writeAndGreyArrayBufferView(v8::Local<v8::Object>, StateBase* next);
StateBase* writeArrayBuffer(v8::Local<v8::Value>, StateBase* next);
StateBase* writeTransferredArrayBuffer(v8::Local<v8::Value>, uint32_t index, StateBase* next);
+ StateBase* writeTransferredImageBitmap(v8::Local<v8::Value>, uint32_t index, StateBase* next);
StateBase* writeTransferredSharedArrayBuffer(v8::Local<v8::Value>, uint32_t index, StateBase* next);
static bool shouldSerializeDensely(uint32_t length, uint32_t propertyCount);
@@ -433,6 +438,7 @@ private:
ObjectPool m_objectPool;
ObjectPool m_transferredMessagePorts;
ObjectPool m_transferredArrayBuffers;
+ ObjectPool m_transferredImageBitmaps;
uint32_t m_nextObjectReference;
WebBlobInfoArray* m_blobInfo;
BlobDataHandleMap& m_blobDataHandles;
@@ -452,6 +458,7 @@ public:
virtual bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v8::Value>*) = 0;
virtual bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Value>*) = 0;
virtual bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Value>*) = 0;
+ virtual bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Value>*) = 0;
virtual bool tryGetTransferredSharedArrayBuffer(uint32_t index, v8::Local<v8::Value>*) = 0;
virtual bool newSparseArray(uint32_t length) = 0;
virtual bool newDenseArray(uint32_t length) = 0;
@@ -571,11 +578,13 @@ class CORE_EXPORT ScriptValueDeserializer : public ScriptValueCompositeCreator {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(ScriptValueDeserializer);
public:
- ScriptValueDeserializer(SerializedScriptValueReader& reader, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContents)
+ ScriptValueDeserializer(SerializedScriptValueReader& reader, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContents, ImageBitmapContentsArray* imageBitmapContents)
: m_reader(reader)
, m_transferredMessagePorts(messagePorts)
, m_arrayBufferContents(arrayBufferContents)
+ , m_imageBitmapContents(imageBitmapContents)
, m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0)
+ , m_imageBitmaps(imageBitmapContents ? imageBitmapContents->size() : 0)
, m_version(0)
{
}
@@ -595,6 +604,7 @@ public:
void pushObjectReference(const v8::Local<v8::Value>&) override;
bool tryGetTransferredMessagePort(uint32_t index, v8::Local<v8::Value>*) override;
bool tryGetTransferredArrayBuffer(uint32_t index, v8::Local<v8::Value>*) override;
+ bool tryGetTransferredImageBitmap(uint32_t index, v8::Local<v8::Value>*) override;
bool tryGetTransferredSharedArrayBuffer(uint32_t index, v8::Local<v8::Value>*) override;
bool tryGetObjectFromObjectReference(uint32_t reference, v8::Local<v8::Value>*) override;
uint32_t objectReferenceCount() override;
@@ -624,7 +634,9 @@ private:
Vector<uint32_t> m_openCompositeReferenceStack;
MessagePortArray* m_transferredMessagePorts;
ArrayBufferContentsArray* m_arrayBufferContents;
+ ImageBitmapContentsArray* m_imageBitmapContents;
Vector<v8::Local<v8::Value>> m_arrayBuffers;
+ Vector<v8::Local<v8::Value>> m_imageBitmaps;
uint32_t m_version;
};

Powered by Google App Engine
This is Rietveld 408576698