OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |