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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 type var; \ | 79 type var; \ |
80 { \ | 80 { \ |
81 v8::TryCatch block; \ | 81 v8::TryCatch block; \ |
82 var = (value); \ | 82 var = (value); \ |
83 if (UNLIKELY(block.HasCaught())) \ | 83 if (UNLIKELY(block.HasCaught())) \ |
84 exceptionState.rethrowV8Exception(block.Exception()); \ | 84 exceptionState.rethrowV8Exception(block.Exception()); \ |
85 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 85 if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
86 return; \ | 86 return; \ |
87 } | 87 } |
88 | 88 |
| 89 #define V8TRYCATCH_VOID_PROMISE(type, var, value, info)
\ |
| 90 type var;
\ |
| 91 {
\ |
| 92 v8::TryCatch block;
\ |
| 93 var = (value);
\ |
| 94 if (UNLIKELY(block.HasCaught())) {
\ |
| 95 v8::Isolate* isolate = info.GetIsolate();
\ |
| 96 ScriptPromise promise = ScriptPromise::reject(block.Exception(), iso
late); \ |
| 97 v8SetReturnValue(info, promise.v8Value());
\ |
| 98 return;
\ |
| 99 }
\ |
| 100 } |
| 101 |
| 102 #define V8TRYCATCH_EXCEPTION_VOID_PROMISE(type, var, value, info, exceptionState
) \ |
| 103 type var;
\ |
| 104 {
\ |
| 105 v8::TryCatch block;
\ |
| 106 var = (value);
\ |
| 107 v8::Isolate* isolate = info.GetIsolate();
\ |
| 108 if (UNLIKELY(block.HasCaught()))
\ |
| 109 exceptionState.rethrowV8Exception(block.Exception());
\ |
| 110 if (UNLIKELY(exceptionState.hadException())) {
\ |
| 111 v8SetReturnValue(info, exceptionState.rejectedPromise().v8Value());
\ |
| 112 return;
\ |
| 113 }
\ |
| 114 } |
| 115 |
89 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \ | 116 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \ |
90 type var(value); \ | 117 type var(value); \ |
91 if (UNLIKELY(!var.prepare())) \ | 118 if (UNLIKELY(!var.prepare())) \ |
92 return retVal; | 119 return retVal; |
93 | 120 |
94 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ | 121 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ |
95 type var(value); \ | 122 type var(value); \ |
96 if (UNLIKELY(!var.prepare())) \ | 123 if (UNLIKELY(!var.prepare())) \ |
97 return; | 124 return; |
98 | 125 |
| 126 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID_PROMISE(type, var, value, info)
\ |
| 127 type var(value);
\ |
| 128 {
\ |
| 129 v8::TryCatch block;
\ |
| 130 var.prepare();
\ |
| 131 if (UNLIKELY(block.HasCaught())) {
\ |
| 132 v8::Isolate* isolate = info.GetIsolate();
\ |
| 133 ScriptPromise promise = ScriptPromise::reject(block.Exception(), iso
late); \ |
| 134 v8SetReturnValue(info, promise.v8Value());
\ |
| 135 return;
\ |
| 136 }
\ |
| 137 } |
| 138 |
99 } // namespace WebCore | 139 } // namespace WebCore |
100 | 140 |
101 #endif // V8BindingMacros_h | 141 #endif // V8BindingMacros_h |
OLD | NEW |