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

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

Issue 1893983002: Simplify handling of Transferable objects while (de)serializing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove Transferable.cpp, not needed after all. Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ScriptValueSerializer_h 5 #ifndef ScriptValueSerializer_h
6 #define ScriptValueSerializer_h 6 #define ScriptValueSerializer_h
7 7
8 #include "bindings/core/v8/SerializationTag.h" 8 #include "bindings/core/v8/SerializationTag.h"
9 #include "bindings/core/v8/SerializedScriptValue.h" 9 #include "bindings/core/v8/SerializedScriptValue.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 protected: 201 protected:
202 class StateBase; 202 class StateBase;
203 public: 203 public:
204 enum Status { 204 enum Status {
205 Success, 205 Success,
206 InputError, 206 InputError,
207 DataCloneError, 207 DataCloneError,
208 JSException 208 JSException
209 }; 209 };
210 210
211 ScriptValueSerializer(SerializedScriptValueWriter&, TransferableArray*, WebB lobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState*); 211 ScriptValueSerializer(SerializedScriptValueWriter&, const Transferables*, We bBlobInfoArray*, BlobDataHandleMap& blobDataHandles, v8::TryCatch&, ScriptState* );
212 v8::Isolate* isolate() { return m_scriptState->isolate(); } 212 v8::Isolate* isolate() { return m_scriptState->isolate(); }
213 v8::Local<v8::Context> context() { return m_scriptState->context(); } 213 v8::Local<v8::Context> context() { return m_scriptState->context(); }
214 214
215 Status serialize(v8::Local<v8::Value>); 215 Status serialize(v8::Local<v8::Value>);
216 String errorMessage() { return m_errorMessage; } 216 String errorMessage() { return m_errorMessage; }
217 217
218 protected: 218 protected:
219 class StateBase { 219 class StateBase {
220 USING_FAST_MALLOC(StateBase); 220 USING_FAST_MALLOC(StateBase);
221 WTF_MAKE_NONCOPYABLE(StateBase); 221 WTF_MAKE_NONCOPYABLE(StateBase);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // Marks object as having been visited by the serializer and assigns it a un ique object reference ID. 424 // Marks object as having been visited by the serializer and assigns it a un ique object reference ID.
425 // An object may only be greyed once. 425 // An object may only be greyed once.
426 void greyObject(const v8::Local<v8::Object>&); 426 void greyObject(const v8::Local<v8::Object>&);
427 427
428 StateBase* handleError(Status errorStatus, const String& message, StateBase* ); 428 StateBase* handleError(Status errorStatus, const String& message, StateBase* );
429 429
430 SerializedScriptValueWriter& writer() { return m_writer; } 430 SerializedScriptValueWriter& writer() { return m_writer; }
431 uint32_t nextObjectReference() const { return m_nextObjectReference; } 431 uint32_t nextObjectReference() const { return m_nextObjectReference; }
432 432
433 private: 433 private:
434
435 void copyTransferables(const Transferables&);
436
434 RefPtr<ScriptState> m_scriptState; 437 RefPtr<ScriptState> m_scriptState;
435 SerializedScriptValueWriter& m_writer; 438 SerializedScriptValueWriter& m_writer;
436 v8::TryCatch& m_tryCatch; 439 v8::TryCatch& m_tryCatch;
437 int m_depth; 440 int m_depth;
438 Status m_status; 441 Status m_status;
439 String m_errorMessage; 442 String m_errorMessage;
440 typedef V8ObjectMap<v8::Object, uint32_t> ObjectPool; 443 typedef V8ObjectMap<v8::Object, uint32_t> ObjectPool;
441 ObjectPool m_objectPool; 444 ObjectPool m_objectPool;
442 ObjectPool m_transferredMessagePorts; 445 ObjectPool m_transferredMessagePorts;
443 ObjectPool m_transferredArrayBuffers; 446 ObjectPool m_transferredArrayBuffers;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 ArrayBufferContentsArray* m_arrayBufferContents; 644 ArrayBufferContentsArray* m_arrayBufferContents;
642 ImageBitmapContentsArray* m_imageBitmapContents; 645 ImageBitmapContentsArray* m_imageBitmapContents;
643 Vector<v8::Local<v8::Value>> m_arrayBuffers; 646 Vector<v8::Local<v8::Value>> m_arrayBuffers;
644 Vector<v8::Local<v8::Value>> m_imageBitmaps; 647 Vector<v8::Local<v8::Value>> m_imageBitmaps;
645 uint32_t m_version; 648 uint32_t m_version;
646 }; 649 };
647 650
648 } // namespace blink 651 } // namespace blink
649 652
650 #endif // ScriptValueSerializer_h 653 #endif // ScriptValueSerializer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698