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

Side by Side Diff: src/api.h

Issue 130933003: Various ApiCheck-related cleanups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | src/api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 V(Message, JSObject) \ 189 V(Message, JSObject) \
190 V(Context, Context) \ 190 V(Context, Context) \
191 V(External, Foreign) \ 191 V(External, Foreign) \
192 V(StackTrace, JSArray) \ 192 V(StackTrace, JSArray) \
193 V(StackFrame, JSObject) \ 193 V(StackFrame, JSObject) \
194 V(DeclaredAccessorDescriptor, DeclaredAccessorDescriptor) 194 V(DeclaredAccessorDescriptor, DeclaredAccessorDescriptor)
195 195
196 196
197 class Utils { 197 class Utils {
198 public: 198 public:
199 static bool ReportApiFailure(const char* location, const char* message); 199 static inline bool ApiCheck(bool condition,
200 const char* location,
201 const char* message) {
202 if (!condition) Utils::ReportApiFailure(location, message);
203 return condition;
204 }
200 205
201 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj); 206 static Local<FunctionTemplate> ToFunctionTemplate(NeanderObject obj);
202 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj); 207 static Local<ObjectTemplate> ToObjectTemplate(NeanderObject obj);
203 208
204 static inline Local<Context> ToLocal( 209 static inline Local<Context> ToLocal(
205 v8::internal::Handle<v8::internal::Context> obj); 210 v8::internal::Handle<v8::internal::Context> obj);
206 static inline Local<Value> ToLocal( 211 static inline Local<Value> ToLocal(
207 v8::internal::Handle<v8::internal::Object> obj); 212 v8::internal::Handle<v8::internal::Object> obj);
208 static inline Local<Function> ToLocal( 213 static inline Local<Function> ToLocal(
209 v8::internal::Handle<v8::internal::JSFunction> obj); 214 v8::internal::Handle<v8::internal::JSFunction> obj);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 template <class T> 301 template <class T>
297 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( 302 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
298 v8::Persistent<T>* persistent) { 303 v8::Persistent<T>* persistent) {
299 return OpenPersistent(*persistent); 304 return OpenPersistent(*persistent);
300 } 305 }
301 306
302 template <class From, class To> 307 template <class From, class To>
303 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) { 308 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) {
304 return OpenHandle(*handle); 309 return OpenHandle(*handle);
305 } 310 }
311
312 private:
313 static void ReportApiFailure(const char* location, const char* message);
306 }; 314 };
307 315
308 316
309 template <class T> 317 template <class T>
310 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( 318 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom(
311 v8::EscapableHandleScope* scope) { 319 v8::EscapableHandleScope* scope) {
312 v8::internal::Handle<T> handle; 320 v8::internal::Handle<T> handle;
313 if (!is_null()) { 321 if (!is_null()) {
314 handle = *this; 322 handle = *this;
315 } 323 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 stress_type_ = stress_type; 715 stress_type_ = stress_type;
708 } 716 }
709 717
710 private: 718 private:
711 static v8::Testing::StressType stress_type_; 719 static v8::Testing::StressType stress_type_;
712 }; 720 };
713 721
714 } } // namespace v8::internal 722 } } // namespace v8::internal
715 723
716 #endif // V8_API_H_ 724 #endif // V8_API_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698