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 |
486 protected: | 491 protected: |
487 v8::Isolate* isolate() const { return m_scriptState->isolate(); } | 492 v8::Isolate* isolate() const { return m_scriptState->isolate(); } |
488 v8::Local<v8::Context> context() const { return m_scriptState->context(); } | 493 v8::Local<v8::Context> context() const { return m_scriptState->context(); } |
489 unsigned length() const { return m_length; } | |
490 unsigned position() const { return m_position; } | 494 unsigned position() const { return m_position; } |
491 | 495 |
492 const uint8_t* allocate(uint32_t size) | 496 const uint8_t* allocate(uint32_t size) |
493 { | 497 { |
494 const uint8_t* allocated = m_buffer + m_position; | 498 const uint8_t* allocated = m_buffer + m_position; |
495 m_position += size; | 499 m_position += size; |
496 return allocated; | 500 return allocated; |
497 } | 501 } |
498 | 502 |
499 bool readWithTag(SerializationTag, v8::Local<v8::Value>*, ScriptValueDeseria
lizer&); | 503 bool readWithTag(SerializationTag, v8::Local<v8::Value>*, ScriptValueDeseria
lizer&); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 ArrayBufferContentsArray* m_arrayBufferContents; | 624 ArrayBufferContentsArray* m_arrayBufferContents; |
621 ImageBitmapContentsArray* m_imageBitmapContents; | 625 ImageBitmapContentsArray* m_imageBitmapContents; |
622 Vector<v8::Local<v8::Value>> m_arrayBuffers; | 626 Vector<v8::Local<v8::Value>> m_arrayBuffers; |
623 Vector<v8::Local<v8::Value>> m_imageBitmaps; | 627 Vector<v8::Local<v8::Value>> m_imageBitmaps; |
624 uint32_t m_version; | 628 uint32_t m_version; |
625 }; | 629 }; |
626 | 630 |
627 } // namespace blink | 631 } // namespace blink |
628 | 632 |
629 #endif // ScriptValueSerializer_h | 633 #endif // ScriptValueSerializer_h |
OLD | NEW |