Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef V8BindingMacros_h | 31 #ifndef V8BindingMacros_h |
| 32 #define V8BindingMacros_h | 32 #define V8BindingMacros_h |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 #define TONATIVE_CONVERT(expression, bailout) \ | |
| 37 if (!(expression)) \ | |
| 38 bailout; \ | |
| 39 | |
| 40 #define TONATIVE_DECLARE(type, var, expression, bailout) \ | |
|
yhirano
2015/02/24 03:51:24
[optional] This is not a strong opinion, but I don
Jens Widell
2015/02/24 07:31:43
Essentially, I don't see a strong benefit to eithe
| |
| 41 type var; \ | |
| 42 TONATIVE_CONVERT(expression, bailout) | |
| 43 | |
| 36 // Naming scheme: | 44 // Naming scheme: |
| 37 // TO*_RETURNTYPE[_ARGTYPE]... | 45 // TO*_RETURNTYPE[_ARGTYPE]... |
| 38 // ...using _DEFAULT instead of _ANY..._ANY when returing a default value. | 46 // ...using _DEFAULT instead of _ANY..._ANY when returing a default value. |
| 39 | 47 |
| 40 #define TONATIVE_EXCEPTION(type, var, value) \ | 48 #define TONATIVE_EXCEPTION(type, var, value) \ |
| 41 type var; \ | 49 type var; \ |
| 42 { \ | 50 { \ |
| 43 v8::TryCatch block; \ | 51 v8::TryCatch block; \ |
| 44 var = (value); \ | 52 var = (value); \ |
| 45 if (UNLIKELY(block.HasCaught())) \ | 53 if (UNLIKELY(block.HasCaught())) \ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 #define TOSTRING_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(var, value, exceptionState , info, scriptState) \ | 158 #define TOSTRING_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(var, value, exceptionState , info, scriptState) \ |
| 151 var = (value); \ | 159 var = (value); \ |
| 152 if (UNLIKELY(!var.prepare(exceptionState))) { \ | 160 if (UNLIKELY(!var.prepare(exceptionState))) { \ |
| 153 v8SetReturnValue(info, exceptionState.reject(scriptState).v8Value()); \ | 161 v8SetReturnValue(info, exceptionState.reject(scriptState).v8Value()); \ |
| 154 return; \ | 162 return; \ |
| 155 } | 163 } |
| 156 | 164 |
| 157 } // namespace blink | 165 } // namespace blink |
| 158 | 166 |
| 159 #endif // V8BindingMacros_h | 167 #endif // V8BindingMacros_h |
| OLD | NEW |