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

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

Issue 9348019: Add support for byte arrays to native messages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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/dart_api_state.h ('k') | runtime/vm/snapshot_test.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 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 WriteObjectHeader(ObjectStore::kArrayClass, 0); 569 WriteObjectHeader(ObjectStore::kArrayClass, 0);
570 WriteSmi(object->value.as_array.length); 570 WriteSmi(object->value.as_array.length);
571 // Write out the type arguments. 571 // Write out the type arguments.
572 WriteIndexedObject(Object::kNullObject); 572 WriteIndexedObject(Object::kNullObject);
573 // Write out array elements. 573 // Write out array elements.
574 for (int i = 0; i < object->value.as_array.length; i++) { 574 for (int i = 0; i < object->value.as_array.length; i++) {
575 WriteCObject(object->value.as_array.values[i]); 575 WriteCObject(object->value.as_array.values[i]);
576 } 576 }
577 break; 577 break;
578 } 578 }
579 case Dart_CObject::kByteArray: {
580 // Write out the serialization header value for this object.
581 WriteInlinedHeader(object);
582 // Write out the class and tags information.
583 WriteObjectHeader(ObjectStore::kInternalByteArrayClass, 0);
584 uint8_t* bytes = object->value.as_byte_array.values;
585 intptr_t len = object->value.as_byte_array.length;
586 WriteSmi(len);
587 for (intptr_t i = 0; i < len; i++) {
588 Write<uint8_t>(bytes[i]);
589 }
590 break;
591 }
579 default: 592 default:
580 UNREACHABLE(); 593 UNREACHABLE();
581 } 594 }
582 } 595 }
583 596
584 597
585 void MessageWriter::WriteCMessage(Dart_CObject* object) { 598 void MessageWriter::WriteCMessage(Dart_CObject* object) {
586 WriteCObject(object); 599 WriteCObject(object);
587 UnmarkAllCObjects(object); 600 UnmarkAllCObjects(object);
588 FinalizeBuffer(); 601 FinalizeBuffer();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 805
793 806
794 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { 807 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
795 for (RawObject** current = first; current <= last; current++) { 808 for (RawObject** current = first; current <= last; current++) {
796 RawObject* raw_obj = *current; 809 RawObject* raw_obj = *current;
797 writer_->WriteObject(raw_obj); 810 writer_->WriteObject(raw_obj);
798 } 811 }
799 } 812 }
800 813
801 } // namespace dart 814 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_state.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698