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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 { \ | 64 { \ |
65 v8::TryCatch block; \ | 65 v8::TryCatch block; \ |
66 var = (value); \ | 66 var = (value); \ |
67 if (UNLIKELY(block.HasCaught())) { \ | 67 if (UNLIKELY(block.HasCaught())) { \ |
68 block.ReThrow(); \ | 68 block.ReThrow(); \ |
69 return retVal; \ | 69 return retVal; \ |
70 } \ | 70 } \ |
71 } | 71 } |
72 | 72 |
73 #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \ | 73 #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \ |
74 var = (value); \ | 74 var = (value); \ |
75 if (UNLIKELY(block.HasCaught())) \ | 75 if (UNLIKELY(block.HasCaught())) \ |
76 exceptionState.rethrowV8Exception(block.Exception()); \ | 76 return; \ |
77 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 77 if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
78 return; | 78 return; |
79 | 79 |
80 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ | 80 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ |
81 type var; \ | 81 type var; \ |
82 { \ | 82 { \ |
83 v8::TryCatch block; \ | 83 v8::TryCatch block; \ |
| 84 V8RethrowTryCatchScope rethrow(block); \ |
84 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \ | 85 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \ |
85 } | 86 } |
86 | 87 |
87 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal
) \ | 88 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal
) \ |
88 type var; \ | 89 type var;
\ |
89 { \ | 90 {
\ |
90 v8::TryCatch block; \ | 91 v8::TryCatch block;
\ |
91 var = (value); \ | 92 V8RethrowTryCatchScope rethrow(block);
\ |
92 if (UNLIKELY(block.HasCaught())) \ | 93 var = (value);
\ |
93 exceptionState.rethrowV8Exception(block.Exception()); \ | 94 if (UNLIKELY(block.HasCaught()))
\ |
94 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 95 return retVal;
\ |
95 return retVal; \ | 96 if (UNLIKELY(exceptionState.throwIfNeeded()))
\ |
| 97 return retVal;
\ |
96 } | 98 } |
97 | 99 |
98 // type is an instance of class template V8StringResource<>, | 100 // type is an instance of class template V8StringResource<>, |
99 // but Mode argument varies; using type (not Mode) for consistency | 101 // but Mode argument varies; using type (not Mode) for consistency |
100 // with other macros and ease of code generation | 102 // with other macros and ease of code generation |
101 #define TOSTRING_VOID(type, var, value) \ | 103 #define TOSTRING_VOID(type, var, value) \ |
102 type var(value); \ | 104 type var(value); \ |
103 if (UNLIKELY(!var.prepare())) \ | 105 if (UNLIKELY(!var.prepare())) \ |
104 return; | 106 return; |
105 | 107 |
106 #define TOSTRING_VOID_INTERNAL(var, value) \ | 108 #define TOSTRING_VOID_INTERNAL(var, value) \ |
107 var = (value); \ | 109 var = (value); \ |
108 if (UNLIKELY(!var.prepare())) \ | 110 if (UNLIKELY(!var.prepare())) \ |
109 return; | 111 return; |
110 | 112 |
111 #define TOSTRING_DEFAULT(type, var, value, retVal) \ | 113 #define TOSTRING_DEFAULT(type, var, value, retVal) \ |
112 type var(value); \ | 114 type var(value); \ |
113 if (UNLIKELY(!var.prepare())) \ | 115 if (UNLIKELY(!var.prepare())) \ |
114 return retVal; | 116 return retVal; |
115 | 117 |
116 } // namespace WebCore | 118 } // namespace WebCore |
117 | 119 |
118 #endif // V8BindingMacros_h | 120 #endif // V8BindingMacros_h |
OLD | NEW |