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

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

Issue 8528018: Start checking inputs to dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl.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 #ifndef VM_DART_API_IMPL_H_ 5 #ifndef VM_DART_API_IMPL_H_
6 #define VM_DART_API_IMPL_H_ 6 #define VM_DART_API_IMPL_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/object.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 class ApiState; 13 class ApiState;
13 class LocalHandle; 14 class LocalHandle;
14 class Object;
15 class PersistentHandle; 15 class PersistentHandle;
16 class RawObject;
17
18 16
19 #define DARTSCOPE(isolate) \ 17 #define DARTSCOPE(isolate) \
20 ASSERT(isolate != NULL); \ 18 ASSERT(isolate != NULL); \
21 Zone zone(isolate); \ 19 Zone zone(isolate); \
22 HANDLESCOPE(isolate); \ 20 HANDLESCOPE(isolate); \
23 21
24 class Api : AllStatic { 22 class Api : AllStatic {
25 public: 23 public:
26 // Creates a new local handle. 24 // Creates a new local handle.
27 static Dart_Handle NewLocalHandle(const Object& object); 25 static Dart_Handle NewLocalHandle(const Object& object);
28 26
29 // Unwraps the raw object from the handle. 27 // Unwraps the raw object from the handle.
30 static RawObject* UnwrapHandle(Dart_Handle object); 28 static RawObject* UnwrapHandle(Dart_Handle object);
31 29
30 // Unwraps a raw Type from the handle. The handle will be null if
31 // the object was not of the requested Type.
32 #define DECLARE_UNWRAP(Type) \
33 static const Type& Unwrap##Type##Handle(Dart_Handle object);
34 CLASS_LIST_NO_OBJECT(DECLARE_UNWRAP)
35 #undef DECLARE_UNWRAP
36
32 // Validates and converts the passed in handle as a local handle. 37 // Validates and converts the passed in handle as a local handle.
33 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, 38 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state,
34 Dart_Handle object); 39 Dart_Handle object);
35 40
36 // Validates and converts the passed in handle as a persistent handle. 41 // Validates and converts the passed in handle as a persistent handle.
37 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, 42 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state,
38 Dart_Handle object); 43 Dart_Handle object);
39 44
40 // Gets the handle used to designate successful return. 45 // Gets the handle used to designate successful return.
41 static Dart_Handle Success(); 46 static Dart_Handle Success();
(...skipping 16 matching lines...) Expand all
58 // Allocates space in the local zone. 63 // Allocates space in the local zone.
59 static uword Allocate(intptr_t size); 64 static uword Allocate(intptr_t size);
60 65
61 // Reallocates space in the local zone. 66 // Reallocates space in the local zone.
62 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); 67 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size);
63 }; 68 };
64 69
65 } // namespace dart. 70 } // namespace dart.
66 71
67 #endif // VM_DART_API_IMPL_H_ 72 #endif // VM_DART_API_IMPL_H_
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698