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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/dart.cc ('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 RUNTIME_VM_DART_API_IMPL_H_ 5 #ifndef RUNTIME_VM_DART_API_IMPL_H_
6 #define RUNTIME_VM_DART_API_IMPL_H_ 6 #define RUNTIME_VM_DART_API_IMPL_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/native_arguments.h" 9 #include "vm/native_arguments.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 CURRENT_FUNC); \ 60 CURRENT_FUNC); \
61 } \ 61 } \
62 } while (0); 62 } while (0);
63 63
64 #define DARTSCOPE(thread) \ 64 #define DARTSCOPE(thread) \
65 Thread* T = (thread); \ 65 Thread* T = (thread); \
66 CHECK_API_SCOPE(T); \ 66 CHECK_API_SCOPE(T); \
67 TransitionNativeToVM transition(T); \ 67 TransitionNativeToVM transition(T); \
68 HANDLESCOPE(T); 68 HANDLESCOPE(T);
69 69
70
71 #define RETURN_TYPE_ERROR(zone, dart_handle, type) \ 70 #define RETURN_TYPE_ERROR(zone, dart_handle, type) \
72 do { \ 71 do { \
73 const Object& tmp = \ 72 const Object& tmp = \
74 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \ 73 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \
75 if (tmp.IsNull()) { \ 74 if (tmp.IsNull()) { \
76 return Api::NewError("%s expects argument '%s' to be non-null.", \ 75 return Api::NewError("%s expects argument '%s' to be non-null.", \
77 CURRENT_FUNC, #dart_handle); \ 76 CURRENT_FUNC, #dart_handle); \
78 } else if (tmp.IsError()) { \ 77 } else if (tmp.IsError()) { \
79 return dart_handle; \ 78 return dart_handle; \
80 } \ 79 } \
81 return Api::NewError("%s expects argument '%s' to be of type %s.", \ 80 return Api::NewError("%s expects argument '%s' to be of type %s.", \
82 CURRENT_FUNC, #dart_handle, #type); \ 81 CURRENT_FUNC, #dart_handle, #type); \
83 } while (0) 82 } while (0)
84 83
85
86 #define RETURN_NULL_ERROR(parameter) \ 84 #define RETURN_NULL_ERROR(parameter) \
87 return Api::NewError("%s expects argument '%s' to be non-null.", \ 85 return Api::NewError("%s expects argument '%s' to be non-null.", \
88 CURRENT_FUNC, #parameter) 86 CURRENT_FUNC, #parameter)
89 87
90 #define CHECK_NULL(parameter) \ 88 #define CHECK_NULL(parameter) \
91 if (parameter == NULL) { \ 89 if (parameter == NULL) { \
92 RETURN_NULL_ERROR(parameter); \ 90 RETURN_NULL_ERROR(parameter); \
93 } 91 }
94 92
95 #define CHECK_LENGTH(length, max_elements) \ 93 #define CHECK_LENGTH(length, max_elements) \
96 do { \ 94 do { \
97 intptr_t len = (length); \ 95 intptr_t len = (length); \
98 intptr_t max = (max_elements); \ 96 intptr_t max = (max_elements); \
99 if (len < 0 || len > max) { \ 97 if (len < 0 || len > max) { \
100 return Api::NewError( \ 98 return Api::NewError( \
101 "%s expects argument '%s' to be in the range [0..%" Pd "].", \ 99 "%s expects argument '%s' to be in the range [0..%" Pd "].", \
102 CURRENT_FUNC, #length, max); \ 100 CURRENT_FUNC, #length, max); \
103 } \ 101 } \
104 } while (0) 102 } while (0)
105 103
106
107 class Api : AllStatic { 104 class Api : AllStatic {
108 public: 105 public:
109 // Create on the stack to provide a new throw-safe api scope. 106 // Create on the stack to provide a new throw-safe api scope.
110 class Scope : public StackResource { 107 class Scope : public StackResource {
111 public: 108 public:
112 explicit Scope(Thread* thread) : StackResource(thread) { 109 explicit Scope(Thread* thread) : StackResource(thread) {
113 Dart_EnterScope(); 110 Dart_EnterScope();
114 } 111 }
115 ~Scope() { Dart_ExitScope(); } 112 ~Scope() { Dart_ExitScope(); }
116 113
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return Api::NewError("%s: Cannot load after Dart_Precompile", \ 297 return Api::NewError("%s: Cannot load after Dart_Precompile", \
301 CURRENT_FUNC); \ 298 CURRENT_FUNC); \
302 } 299 }
303 300
304 #define ASSERT_CALLBACK_STATE(thread) \ 301 #define ASSERT_CALLBACK_STATE(thread) \
305 ASSERT(thread->no_callback_scope_depth() == 0) 302 ASSERT(thread->no_callback_scope_depth() == 0)
306 303
307 } // namespace dart. 304 } // namespace dart.
308 305
309 #endif // RUNTIME_VM_DART_API_IMPL_H_ 306 #endif // RUNTIME_VM_DART_API_IMPL_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698