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

Side by Side Diff: runtime/vm/dart_api_message.cc

Issue 11368138: Add some support for the code-point code-unit distinction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implemented feedback from patch set 2. Created 8 years, 1 month 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
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 #include "vm/dart_api_message.h" 5 #include "vm/dart_api_message.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/snapshot_ids.h" 7 #include "vm/snapshot_ids.h"
8 #include "vm/symbols.h" 8 #include "vm/symbols.h"
9 #include "vm/unicode.h" 9 #include "vm/unicode.h"
10 10
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 break; 760 break;
761 case Dart_CObject::kString: { 761 case Dart_CObject::kString: {
762 const uint8_t* utf8_str = 762 const uint8_t* utf8_str =
763 reinterpret_cast<const uint8_t*>(object->value.as_string); 763 reinterpret_cast<const uint8_t*>(object->value.as_string);
764 intptr_t utf8_len = strlen(object->value.as_string); 764 intptr_t utf8_len = strlen(object->value.as_string);
765 if (!Utf8::IsValid(utf8_str, utf8_len)) { 765 if (!Utf8::IsValid(utf8_str, utf8_len)) {
766 return false; 766 return false;
767 } 767 }
768 768
769 Utf8::Type type; 769 Utf8::Type type;
770 intptr_t len = Utf8::CodePointCount(utf8_str, utf8_len, &type); 770 intptr_t len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type);
771 771
772 // Write out the serialization header value for this object. 772 // Write out the serialization header value for this object.
773 WriteInlinedHeader(object); 773 WriteInlinedHeader(object);
774 // Write out the class and tags information. 774 // Write out the class and tags information.
775 WriteIndexedObject(type == Utf8::kAscii ? kOneByteStringCid 775 WriteIndexedObject(type == Utf8::kAscii ? kOneByteStringCid
776 : kTwoByteStringCid); 776 : kTwoByteStringCid);
777 WriteIntptrValue(0); 777 WriteIntptrValue(0);
778 // Write string length, hash and content 778 // Write string length, hash and content
779 WriteSmi(len); 779 WriteSmi(len);
780 WriteSmi(0); // TODO(sgjesse): Hash - not written. 780 WriteSmi(0); // TODO(sgjesse): Hash - not written.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 if (!success) { 852 if (!success) {
853 UnmarkAllCObjects(object); 853 UnmarkAllCObjects(object);
854 return false; 854 return false;
855 } 855 }
856 } 856 }
857 UnmarkAllCObjects(object); 857 UnmarkAllCObjects(object);
858 return true; 858 return true;
859 } 859 }
860 860
861 } // namespace dart 861 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698