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

Side by Side Diff: Source/bindings/core/v8/ScriptValueSerializer.cpp

Issue 1027593003: bindings: Use Maybe version of v8::String::NewFromUtf8() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | Source/bindings/core/v8/V8Binding.h » ('J')
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 #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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 return true; 1266 return true;
1267 } 1267 }
1268 1268
1269 bool SerializedScriptValueReader::readString(v8::Local<v8::Value>* value) 1269 bool SerializedScriptValueReader::readString(v8::Local<v8::Value>* value)
1270 { 1270 {
1271 uint32_t length; 1271 uint32_t length;
1272 if (!doReadUint32(&length)) 1272 if (!doReadUint32(&length))
1273 return false; 1273 return false;
1274 if (m_position + length > m_length) 1274 if (m_position + length > m_length)
1275 return false; 1275 return false;
1276 *value = v8::String::NewFromUtf8(isolate(), reinterpret_cast<const char*>(m_ buffer + m_position), v8::String::kNormalString, length); 1276 *value = v8AtomicString(isolate(), reinterpret_cast<const char*>(m_buffer + m_position), length);
1277 m_position += length; 1277 m_position += length;
1278 return true; 1278 return true;
1279 } 1279 }
1280 1280
1281 bool SerializedScriptValueReader::readUCharString(v8::Local<v8::Value>* value) 1281 bool SerializedScriptValueReader::readUCharString(v8::Local<v8::Value>* value)
1282 { 1282 {
1283 uint32_t length; 1283 uint32_t length;
1284 if (!doReadUint32(&length) || (length & 1)) 1284 if (!doReadUint32(&length) || (length & 1))
1285 return false; 1285 return false;
1286 if (m_position + length > m_length) 1286 if (m_position + length > m_length)
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 return false; 1881 return false;
1882 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; 1882 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1];
1883 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); 1883 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1);
1884 if (objectReference >= m_objectPool.size()) 1884 if (objectReference >= m_objectPool.size())
1885 return false; 1885 return false;
1886 *object = m_objectPool[objectReference]; 1886 *object = m_objectPool[objectReference];
1887 return true; 1887 return true;
1888 } 1888 }
1889 1889
1890 } // namespace blink 1890 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | Source/bindings/core/v8/V8Binding.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698