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 exceptionState.rethrowV8Exception(block.Exception()); \ |
Jens Widell
2014/06/16 11:56:39
Given current usage of this macro and the one belo
yhirano
2014/06/17 11:10:02
Done.
| |
77 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 77 return; \ |
78 } \ | |
79 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | |
78 return; | 80 return; |
79 | 81 |
80 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ | 82 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ |
81 type var; \ | 83 type var; \ |
82 { \ | 84 { \ |
83 v8::TryCatch block; \ | 85 v8::TryCatch block; \ |
86 V8RethrowTryCatchScope rethrow(block); \ | |
84 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \ | 87 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \ |
85 } | 88 } |
86 | 89 |
87 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \ | 90 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \ |
88 type var; \ | 91 type var; \ |
89 { \ | 92 { \ |
90 v8::TryCatch block; \ | 93 v8::TryCatch block; \ |
91 var = (value); \ | 94 V8RethrowTryCatchScope rethrow(block); \ |
92 if (UNLIKELY(block.HasCaught())) \ | 95 var = (value); \ |
93 exceptionState.rethrowV8Exception(block.Exception()); \ | 96 if (UNLIKELY(block.HasCaught())) { \ |
94 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | 97 exceptionState.rethrowV8Exception(block.Exception()); \ |
95 return retVal; \ | 98 return retVal; \ |
99 } \ | |
100 if (UNLIKELY(exceptionState.throwIfNeeded())) \ | |
101 return retVal; \ | |
96 } | 102 } |
97 | 103 |
98 // type is an instance of class template V8StringResource<>, | 104 // type is an instance of class template V8StringResource<>, |
99 // but Mode argument varies; using type (not Mode) for consistency | 105 // but Mode argument varies; using type (not Mode) for consistency |
100 // with other macros and ease of code generation | 106 // with other macros and ease of code generation |
101 #define TOSTRING_VOID(type, var, value) \ | 107 #define TOSTRING_VOID(type, var, value) \ |
102 type var(value); \ | 108 type var(value); \ |
103 if (UNLIKELY(!var.prepare())) \ | 109 if (UNLIKELY(!var.prepare())) \ |
104 return; | 110 return; |
105 | 111 |
106 #define TOSTRING_VOID_INTERNAL(var, value) \ | 112 #define TOSTRING_VOID_INTERNAL(var, value) \ |
107 var = (value); \ | 113 var = (value); \ |
108 if (UNLIKELY(!var.prepare())) \ | 114 if (UNLIKELY(!var.prepare())) \ |
109 return; | 115 return; |
110 | 116 |
111 #define TOSTRING_DEFAULT(type, var, value, retVal) \ | 117 #define TOSTRING_DEFAULT(type, var, value, retVal) \ |
112 type var(value); \ | 118 type var(value); \ |
113 if (UNLIKELY(!var.prepare())) \ | 119 if (UNLIKELY(!var.prepare())) \ |
114 return retVal; | 120 return retVal; |
115 | 121 |
116 } // namespace WebCore | 122 } // namespace WebCore |
117 | 123 |
118 #endif // V8BindingMacros_h | 124 #endif // V8BindingMacros_h |
OLD | NEW |