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

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

Issue 542363003: Don't double-escape in strings in the VM Service, and don't use \u0000 to determine the string lengt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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_stream.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 5568 matching lines...) Expand 10 before | Expand all | Expand 10 after
5579 } 5579 }
5580 5580
5581 bool IsExternal() const { 5581 bool IsExternal() const {
5582 return RawObject::IsExternalStringClassId(raw()->GetClassId()); 5582 return RawObject::IsExternalStringClassId(raw()->GetClassId());
5583 } 5583 }
5584 5584
5585 void* GetPeer() const; 5585 void* GetPeer() const;
5586 5586
5587 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; 5587 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const;
5588 5588
5589 // Produces a quoted, escaped, (possibly) truncated string. 5589 // Creates a UTF-8, NUL-terminated string in the current zone. The size of the
5590 const char* ToUserCString(intptr_t max_len) const; 5590 // created string in UTF-8 code units (bytes) is answered in 'length'; this
5591 // can be longer than strlen of the result when the string has internal NULs.
5592 // For the truncating version, 'max_length' is in UTF-16 code units, and will
5593 // be rounded down if necessary to prevent splitting a surrogate pair.
5594 const char* ToCString(intptr_t *length) const;
5595 const char* ToCStringTruncated(intptr_t max_len,
5596 bool* did_truncate,
5597 intptr_t *length) const;
5591 5598
5592 // Copies the string characters into the provided external array 5599 // Copies the string characters into the provided external array
5593 // and morphs the string object into an external string object. 5600 // and morphs the string object into an external string object.
5594 // The remaining unused part of the original string object is marked as 5601 // The remaining unused part of the original string object is marked as
5595 // an Array object or a regular Object so that it can be traversed during 5602 // an Array object or a regular Object so that it can be traversed during
5596 // garbage collection. 5603 // garbage collection.
5597 RawString* MakeExternal(void* array, 5604 RawString* MakeExternal(void* array,
5598 intptr_t length, 5605 intptr_t length,
5599 void* peer, 5606 void* peer,
5600 Dart_PeerFinalizer cback) const; 5607 Dart_PeerFinalizer cback) const;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
5726 } 5733 }
5727 5734
5728 template<typename HandleType, typename ElementType, typename CallbackType> 5735 template<typename HandleType, typename ElementType, typename CallbackType>
5729 static void ReadFromImpl(SnapshotReader* reader, 5736 static void ReadFromImpl(SnapshotReader* reader,
5730 String* str_obj, 5737 String* str_obj,
5731 intptr_t len, 5738 intptr_t len,
5732 intptr_t tags, 5739 intptr_t tags,
5733 CallbackType new_symbol, 5740 CallbackType new_symbol,
5734 Snapshot::Kind kind); 5741 Snapshot::Kind kind);
5735 5742
5736 intptr_t EscapedString(char* buffer, int max_len) const;
5737 intptr_t EscapedStringLen(intptr_t tooLong) const;
5738
5739 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); 5743 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance);
5740 5744
5741 friend class Class; 5745 friend class Class;
5742 friend class Symbols; 5746 friend class Symbols;
5743 friend class StringSlice; // SetHash 5747 friend class StringSlice; // SetHash
5744 template<typename CharType> friend class CharArray; // SetHash 5748 template<typename CharType> friend class CharArray; // SetHash
5745 friend class ConcatString; // SetHash 5749 friend class ConcatString; // SetHash
5746 friend class OneByteString; 5750 friend class OneByteString;
5747 friend class TwoByteString; 5751 friend class TwoByteString;
5748 friend class ExternalOneByteString; 5752 friend class ExternalOneByteString;
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
7449 7453
7450 7454
7451 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7455 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7452 intptr_t index) { 7456 intptr_t index) {
7453 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7457 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7454 } 7458 }
7455 7459
7456 } // namespace dart 7460 } // namespace dart
7457 7461
7458 #endif // VM_OBJECT_H_ 7462 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698