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

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

Issue 2142373002: Make v8AtomicString take a StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Woops, pass the length. Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »
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 "bindings/core/v8/ScriptValueSerializer.h" 5 #include "bindings/core/v8/ScriptValueSerializer.h"
6 6
7 #include "bindings/core/v8/Transferables.h" 7 #include "bindings/core/v8/Transferables.h"
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 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 return true; 1619 return true;
1620 } 1620 }
1621 1621
1622 bool SerializedScriptValueReader::readString(v8::Local<v8::Value>* value) 1622 bool SerializedScriptValueReader::readString(v8::Local<v8::Value>* value)
1623 { 1623 {
1624 uint32_t length; 1624 uint32_t length;
1625 if (!doReadUint32(&length)) 1625 if (!doReadUint32(&length))
1626 return false; 1626 return false;
1627 if (m_position + length > m_length) 1627 if (m_position + length > m_length)
1628 return false; 1628 return false;
1629 *value = v8AtomicString(isolate(), reinterpret_cast<const char*>(m_buffer + m_position), length); 1629 *value = v8StringFromUtf8(isolate(), reinterpret_cast<const char*>(m_buffer + m_position), length);
1630 m_position += length; 1630 m_position += length;
1631 return true; 1631 return true;
1632 } 1632 }
1633 1633
1634 bool SerializedScriptValueReader::readUCharString(v8::Local<v8::Value>* value) 1634 bool SerializedScriptValueReader::readUCharString(v8::Local<v8::Value>* value)
1635 { 1635 {
1636 uint32_t length; 1636 uint32_t length;
1637 if (!doReadUint32(&length) || (length & 1)) 1637 if (!doReadUint32(&length) || (length & 1))
1638 return false; 1638 return false;
1639 if (m_position + length > m_length) 1639 if (m_position + length > m_length)
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 return false; 2413 return false;
2414 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; 2414 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1];
2415 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); 2415 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1);
2416 if (objectReference >= m_objectPool.size()) 2416 if (objectReference >= m_objectPool.size())
2417 return false; 2417 return false;
2418 *object = m_objectPool[objectReference]; 2418 *object = m_objectPool[objectReference];
2419 return true; 2419 return true;
2420 } 2420 }
2421 2421
2422 } // namespace blink 2422 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698