| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 BIN_DARTUTILS_H_ | 5 #ifndef BIN_DARTUTILS_H_ |
| 6 #define BIN_DARTUTILS_H_ | 6 #define BIN_DARTUTILS_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 /* Handles error handles returned from Dart API functions. If a value | 23 /* Handles error handles returned from Dart API functions. If a value |
| 24 * is an error, uses Dart_PropagateError to throw it to the enclosing | 24 * is an error, uses Dart_PropagateError to throw it to the enclosing |
| 25 * Dart activation. Otherwise, returns the original handle. | 25 * Dart activation. Otherwise, returns the original handle. |
| 26 * | 26 * |
| 27 * This function can be used to wrap most API functions, but API | 27 * This function can be used to wrap most API functions, but API |
| 28 * functions can also be nested without this error check, since all | 28 * functions can also be nested without this error check, since all |
| 29 * API functions return any error handles passed in as arguments, unchanged. | 29 * API functions return any error handles passed in as arguments, unchanged. |
| 30 */ | 30 */ |
| 31 static inline Dart_Handle ThrowIfError(Dart_Handle handle) { | 31 static inline Dart_Handle ThrowIfError(Dart_Handle handle) { |
| 32 if (Dart_IsError(handle)) Dart_PropagateError(handle); | 32 if (Dart_IsError(handle)) { |
| 33 Dart_PropagateError(handle); |
| 34 } |
| 33 return handle; | 35 return handle; |
| 34 } | 36 } |
| 35 | 37 |
| 36 class CommandLineOptions { | 38 class CommandLineOptions { |
| 37 public: | 39 public: |
| 38 explicit CommandLineOptions(int max_count) | 40 explicit CommandLineOptions(int max_count) |
| 39 : count_(0), max_count_(max_count), arguments_(NULL) { | 41 : count_(0), max_count_(max_count), arguments_(NULL) { |
| 40 static const int kWordSize = sizeof(intptr_t); | 42 static const int kWordSize = sizeof(intptr_t); |
| 41 arguments_ = reinterpret_cast<const char **>(malloc(max_count * kWordSize)); | 43 arguments_ = reinterpret_cast<const char **>(malloc(max_count * kWordSize)); |
| 42 if (arguments_ == NULL) { | 44 if (arguments_ == NULL) { |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 584 |
| 583 ~ScopedBlockingCall() { | 585 ~ScopedBlockingCall() { |
| 584 Dart_ThreadEnableProfiling(); | 586 Dart_ThreadEnableProfiling(); |
| 585 } | 587 } |
| 586 }; | 588 }; |
| 587 | 589 |
| 588 } // namespace bin | 590 } // namespace bin |
| 589 } // namespace dart | 591 } // namespace dart |
| 590 | 592 |
| 591 #endif // BIN_DARTUTILS_H_ | 593 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |