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

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: fewer templates 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
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 1642 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

Powered by Google App Engine
This is Rietveld 408576698