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

Side by Side Diff: runtime/vm/object.h

Issue 558853004: Preserve the contents of Dart strings with unmatched surrogate halfs by avoiding a UTF16 -> UTF8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync and build Created 6 years, 3 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 | « runtime/vm/json_test.cc ('k') | runtime/vm/object.cc » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 5574 matching lines...) Expand 10 before | Expand all | Expand 10 after
5585 } 5585 }
5586 5586
5587 bool IsExternal() const { 5587 bool IsExternal() const {
5588 return RawObject::IsExternalStringClassId(raw()->GetClassId()); 5588 return RawObject::IsExternalStringClassId(raw()->GetClassId());
5589 } 5589 }
5590 5590
5591 void* GetPeer() const; 5591 void* GetPeer() const;
5592 5592
5593 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; 5593 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const;
5594 5594
5595 // Creates a UTF-8, NUL-terminated string in the current zone. The size of the
5596 // created string in UTF-8 code units (bytes) is answered in 'length'; this
5597 // can be longer than strlen of the result when the string has internal NULs.
5598 // For the truncating version, 'max_length' is in UTF-16 code units, and will
5599 // be rounded down if necessary to prevent splitting a surrogate pair.
5600 const char* ToCString(intptr_t *length) const;
5601 const char* ToCStringTruncated(intptr_t max_len,
5602 bool* did_truncate,
5603 intptr_t *length) const;
5604
5605 // Copies the string characters into the provided external array 5595 // Copies the string characters into the provided external array
5606 // and morphs the string object into an external string object. 5596 // and morphs the string object into an external string object.
5607 // The remaining unused part of the original string object is marked as 5597 // The remaining unused part of the original string object is marked as
5608 // an Array object or a regular Object so that it can be traversed during 5598 // an Array object or a regular Object so that it can be traversed during
5609 // garbage collection. 5599 // garbage collection.
5610 RawString* MakeExternal(void* array, 5600 RawString* MakeExternal(void* array,
5611 intptr_t length, 5601 intptr_t length,
5612 void* peer, 5602 void* peer,
5613 Dart_PeerFinalizer cback) const; 5603 Dart_PeerFinalizer cback) const;
5614 5604
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
7461 7451
7462 7452
7463 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7453 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7464 intptr_t index) { 7454 intptr_t index) {
7465 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7455 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7466 } 7456 }
7467 7457
7468 } // namespace dart 7458 } // namespace dart
7469 7459
7470 #endif // VM_OBJECT_H_ 7460 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/json_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698