Chromium Code Reviews| 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 String data = String(m_buffer.data(), (m_position + 1) / sizeof(BufferValueT ype)); |
|
haraken
2015/10/13 07:40:29
return String(...)
hajimehoshi
2015/10/13 07:51:17
Done.
| |
| 365 return data; | 365 return data; |
| 366 } | 366 } |
| 367 | 367 |
| 368 void SerializedScriptValueWriter::writeReferenceCount(uint32_t numberOfReference s) | 368 void SerializedScriptValueWriter::writeReferenceCount(uint32_t numberOfReference s) |
| 369 { | 369 { |
| 370 append(ReferenceCountTag); | 370 append(ReferenceCountTag); |
| 371 doWriteUint32(numberOfReferences); | 371 doWriteUint32(numberOfReferences); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void SerializedScriptValueWriter::writeGenerateFreshObject() | 374 void SerializedScriptValueWriter::writeGenerateFreshObject() |
| (...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2158 return false; | 2158 return false; |
| 2159 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; | 2159 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; |
| 2160 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); | 2160 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); |
| 2161 if (objectReference >= m_objectPool.size()) | 2161 if (objectReference >= m_objectPool.size()) |
| 2162 return false; | 2162 return false; |
| 2163 *object = m_objectPool[objectReference]; | 2163 *object = m_objectPool[objectReference]; |
| 2164 return true; | 2164 return true; |
| 2165 } | 2165 } |
| 2166 | 2166 |
| 2167 } // namespace blink | 2167 } // namespace blink |
| OLD | NEW |