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

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

Issue 9195031: Add ByteArray interface and provide internal and external implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address remaining review comments Created 8 years, 11 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/class_finalizer.cc ('k') | runtime/vm/dart_api_impl_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 } else { 1397 } else {
1398 result = Api::NewError("Length of List object is not an integer"); 1398 result = Api::NewError("Length of List object is not an integer");
1399 } 1399 }
1400 } else { 1400 } else {
1401 SetupErrorResult(&result); 1401 SetupErrorResult(&result);
1402 } 1402 }
1403 isolate->set_long_jump_base(base); 1403 isolate->set_long_jump_base(base);
1404 return result; 1404 return result;
1405 } 1405 }
1406 } 1406 }
1407 return Api::NewError("Object does not implement the list inteface"); 1407 return Api::NewError("Object does not implement the 'List' inteface");
1408 } 1408 }
1409 1409
1410 1410
1411 static RawObject* GetListAt(Isolate* isolate, 1411 static RawObject* GetListAt(Isolate* isolate,
1412 const Instance& instance, 1412 const Instance& instance,
1413 const Integer& index, 1413 const Integer& index,
1414 const Function& function, 1414 const Function& function,
1415 Dart_Handle* result) { 1415 Dart_Handle* result) {
1416 ASSERT(isolate != NULL); 1416 ASSERT(isolate != NULL);
1417 ASSERT(result != NULL); 1417 ASSERT(result != NULL);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 return result; // Error condition. 1653 return result; // Error condition.
1654 } 1654 }
1655 } 1655 }
1656 return Api::Success(); 1656 return Api::Success();
1657 } 1657 }
1658 } 1658 }
1659 return Api::NewError("Object does not implement the 'List' interface"); 1659 return Api::NewError("Object does not implement the 'List' interface");
1660 } 1660 }
1661 1661
1662 1662
1663 // --- Byte Arrays ---
1664
1665
1666 DART_EXPORT bool Dart_IsByteArray(Dart_Handle object) {
1667 DARTSCOPE(Isolate::Current());
1668 const Object& obj = Object::Handle(Api::UnwrapHandle(object));
1669 return obj.IsByteArray();
1670 }
1671
1672
1673 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) {
1674 DARTSCOPE(Isolate::Current());
1675 const InternalByteArray& obj =
1676 InternalByteArray::Handle(InternalByteArray::New(length));
1677 return Api::NewLocalHandle(obj);
1678 }
1679
1680
1663 // --- Closures --- 1681 // --- Closures ---
1664 1682
1665 1683
1666 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) { 1684 DART_EXPORT bool Dart_IsClosure(Dart_Handle object) {
1667 DARTSCOPE(Isolate::Current()); 1685 DARTSCOPE(Isolate::Current());
1668 const Object& obj = Object::Handle(Api::UnwrapHandle(object)); 1686 const Object& obj = Object::Handle(Api::UnwrapHandle(object));
1669 return obj.IsClosure(); 1687 return obj.IsClosure();
1670 } 1688 }
1671 1689
1672 1690
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 } 2483 }
2466 delete debug_region; 2484 delete debug_region;
2467 } else { 2485 } else {
2468 *buffer = NULL; 2486 *buffer = NULL;
2469 *buffer_size = 0; 2487 *buffer_size = 0;
2470 } 2488 }
2471 } 2489 }
2472 2490
2473 2491
2474 } // namespace dart 2492 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698