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 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/ScriptValueSerializer.h" | 6 #include "bindings/core/v8/ScriptValueSerializer.h" |
7 | 7 |
8 #include "bindings/core/v8/V8ArrayBuffer.h" | 8 #include "bindings/core/v8/V8ArrayBuffer.h" |
9 #include "bindings/core/v8/V8ArrayBufferView.h" | 9 #include "bindings/core/v8/V8ArrayBufferView.h" |
10 #include "bindings/core/v8/V8Blob.h" | 10 #include "bindings/core/v8/V8Blob.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 { | 353 { |
354 append(DenseArrayTag); | 354 append(DenseArrayTag); |
355 doWriteUint32(numProperties); | 355 doWriteUint32(numProperties); |
356 doWriteUint32(length); | 356 doWriteUint32(length); |
357 } | 357 } |
358 | 358 |
359 String SerializedScriptValueWriter::takeWireString() | 359 String SerializedScriptValueWriter::takeWireString() |
360 { | 360 { |
361 static_assert(sizeof(BufferValueType) == 2, "BufferValueType should be 2 byt
es"); | 361 static_assert(sizeof(BufferValueType) == 2, "BufferValueType should be 2 byt
es"); |
362 fillHole(); | 362 fillHole(); |
363 String data = String(m_buffer.data(), m_buffer.size()); | 363 ASSERT((m_position + 1) / sizeof(BufferValueType) <= m_buffer.size()); |
364 data.impl()->truncateAssumingIsolated((m_position + 1) / sizeof(BufferValueT
ype)); | 364 return String(m_buffer.data(), (m_position + 1) / sizeof(BufferValueType)); |
365 return data; | |
366 } | 365 } |
367 | 366 |
368 void SerializedScriptValueWriter::writeReferenceCount(uint32_t numberOfReference
s) | 367 void SerializedScriptValueWriter::writeReferenceCount(uint32_t numberOfReference
s) |
369 { | 368 { |
370 append(ReferenceCountTag); | 369 append(ReferenceCountTag); |
371 doWriteUint32(numberOfReferences); | 370 doWriteUint32(numberOfReferences); |
372 } | 371 } |
373 | 372 |
374 void SerializedScriptValueWriter::writeGenerateFreshObject() | 373 void SerializedScriptValueWriter::writeGenerateFreshObject() |
375 { | 374 { |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 return false; | 2157 return false; |
2159 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 2158 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
2160 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 2159 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
2161 if (objectReference >= m_objectPool.size()) | 2160 if (objectReference >= m_objectPool.size()) |
2162 return false; | 2161 return false; |
2163 *object = m_objectPool[objectReference]; | 2162 *object = m_objectPool[objectReference]; |
2164 return true; | 2163 return true; |
2165 } | 2164 } |
2166 | 2165 |
2167 } // namespace blink | 2166 } // namespace blink |
OLD | NEW |