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

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

Issue 243973002: - Add a minimal implementation of Capability. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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_impl.cc ('k') | runtime/vm/dart_entry.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 (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/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/dart_api_message.h" 6 #include "vm/dart_api_message.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/snapshot_ids.h" 8 #include "vm/snapshot_ids.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/unicode.h" 10 #include "vm/unicode.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 object->value.as_typed_data.length = 309 object->value.as_typed_data.length =
310 object->internal.as_view.length * 310 object->internal.as_view.length *
311 GetTypedDataSizeInBytes(type); 311 GetTypedDataSizeInBytes(type);
312 object->value.as_typed_data.values = 312 object->value.as_typed_data.values =
313 buffer->value.as_typed_data.values + 313 buffer->value.as_typed_data.values +
314 object->internal.as_view.offset_in_bytes; 314 object->internal.as_view.offset_in_bytes;
315 } else { 315 } else {
316 // TODO(sgjesse): Handle other instances. Currently this will 316 // TODO(sgjesse): Handle other instances. Currently this will
317 // skew the reading as the fields of the instance is not read. 317 // skew the reading as the fields of the instance is not read.
318 } 318 }
319 } else if (strcmp("dart:isolate", library_uri) == 0 &&
320 strncmp("_SendPortImpl@", class_name, 14) == 0) {
321 Dart_CObject_Internal* cls =
322 reinterpret_cast<Dart_CObject_Internal*>(ReadObjectImpl());
323 ASSERT(cls == object->cls);
324 // Read the port id.
325 Dart_CObject* port = ReadObjectImpl();
326 if (port->type == Dart_CObject_kInt32) {
327 object->type = Dart_CObject_kSendPort;
328 object->value.as_send_port = port->value.as_int32;
329 } else if (port->type == Dart_CObject_kInt64) {
330 object->type = Dart_CObject_kSendPort;
331 object->value.as_send_port = port->value.as_int64;
332 }
333 } else { 319 } else {
334 // TODO(sgjesse): Handle other instances. Currently this will 320 // TODO(sgjesse): Handle other instances. Currently this will
335 // skew the reading as the fields of the instance is not read. 321 // skew the reading as the fields of the instance is not read.
336 } 322 }
337 return object; 323 return object;
338 } 324 }
339 325
340 ASSERT((class_header & kSmiTagMask) != 0); 326 ASSERT((class_header & kSmiTagMask) != 0);
341 class_id = LookupInternalClass(class_header); 327 class_id = LookupInternalClass(class_header);
342 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) { 328 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 char* p = object->value.as_string; 580 char* p = object->value.as_string;
595 i = 0; 581 i = 0;
596 while (i < len) { 582 while (i < len) {
597 p += Utf8::Encode(Utf16::Next(utf16, &i, len), p); 583 p += Utf8::Encode(Utf16::Next(utf16, &i, len), p);
598 } 584 }
599 *p = '\0'; 585 *p = '\0';
600 ASSERT(p == (object->value.as_string + utf8_len)); 586 ASSERT(p == (object->value.as_string + utf8_len));
601 ::free(utf16); 587 ::free(utf16);
602 return object; 588 return object;
603 } 589 }
590 case kSendPortCid: {
591 int64_t value64 = Read<int64_t>();
592 Dart_CObject* object = AllocateDartCObject(Dart_CObject_kSendPort);
593 object->value.as_send_port = value64;
594 AddBackRef(object_id, object, kIsDeserialized);
595 return object;
596 }
604 597
605 #define READ_TYPED_DATA_HEADER(type) \ 598 #define READ_TYPED_DATA_HEADER(type) \
606 intptr_t len = ReadSmiValue(); \ 599 intptr_t len = ReadSmiValue(); \
607 Dart_CObject* object = \ 600 Dart_CObject* object = \
608 AllocateDartCObjectTypedData(Dart_TypedData_k##type, len); \ 601 AllocateDartCObjectTypedData(Dart_TypedData_k##type, len); \
609 AddBackRef(object_id, object, kIsDeserialized); \ 602 AddBackRef(object_id, object, kIsDeserialized); \
610 603
611 604
612 #define READ_TYPED_DATA(type, ctype) \ 605 #define READ_TYPED_DATA(type, ctype) \
613 { \ 606 { \
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 if (!success) { 1181 if (!success) {
1189 UnmarkAllCObjects(object); 1182 UnmarkAllCObjects(object);
1190 return false; 1183 return false;
1191 } 1184 }
1192 } 1185 }
1193 UnmarkAllCObjects(object); 1186 UnmarkAllCObjects(object);
1194 return true; 1187 return true;
1195 } 1188 }
1196 1189
1197 } // namespace dart 1190 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698