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

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

Issue 2305703002: Move V8-based serialization into dedicated classes and add support for ArrayBuffer transfer. (Closed)
Patch Set: reviewer comments Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 477
478 bool isEof() const { return m_position >= m_length; } 478 bool isEof() const { return m_position >= m_length; }
479 479
480 ScriptState* getScriptState() const { return m_scriptState.get(); } 480 ScriptState* getScriptState() const { return m_scriptState.get(); }
481 481
482 virtual bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&); 482 virtual bool read(v8::Local<v8::Value>*, ScriptValueDeserializer&);
483 bool readVersion(uint32_t& version); 483 bool readVersion(uint32_t& version);
484 void setVersion(uint32_t); 484 void setVersion(uint32_t);
485 485
486 // Used to extract the underlying buffer, in order to bypass
487 // SerializedScriptValueReader.
488 const uint8_t* buffer() const { return m_buffer; }
489 unsigned length() const { return m_length; }
490
491 protected: 486 protected:
492 v8::Isolate* isolate() const { return m_scriptState->isolate(); } 487 v8::Isolate* isolate() const { return m_scriptState->isolate(); }
493 v8::Local<v8::Context> context() const { return m_scriptState->context(); } 488 v8::Local<v8::Context> context() const { return m_scriptState->context(); }
489 unsigned length() const { return m_length; }
494 unsigned position() const { return m_position; } 490 unsigned position() const { return m_position; }
495 491
496 const uint8_t* allocate(uint32_t size) 492 const uint8_t* allocate(uint32_t size)
497 { 493 {
498 const uint8_t* allocated = m_buffer + m_position; 494 const uint8_t* allocated = m_buffer + m_position;
499 m_position += size; 495 m_position += size;
500 return allocated; 496 return allocated;
501 } 497 }
502 498
503 bool readWithTag(SerializationTag, v8::Local<v8::Value>*, ScriptValueDeseria lizer&); 499 bool readWithTag(SerializationTag, v8::Local<v8::Value>*, ScriptValueDeseria lizer&);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 ArrayBufferContentsArray* m_arrayBufferContents; 620 ArrayBufferContentsArray* m_arrayBufferContents;
625 ImageBitmapContentsArray* m_imageBitmapContents; 621 ImageBitmapContentsArray* m_imageBitmapContents;
626 Vector<v8::Local<v8::Value>> m_arrayBuffers; 622 Vector<v8::Local<v8::Value>> m_arrayBuffers;
627 Vector<v8::Local<v8::Value>> m_imageBitmaps; 623 Vector<v8::Local<v8::Value>> m_imageBitmaps;
628 uint32_t m_version; 624 uint32_t m_version;
629 }; 625 };
630 626
631 } // namespace blink 627 } // namespace blink
632 628
633 #endif // ScriptValueSerializer_h 629 #endif // ScriptValueSerializer_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698