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 29 matching lines...) Expand all Loading... | |
40 #define TONATIVE_EXCEPTION(type, var, value) \ | 40 #define TONATIVE_EXCEPTION(type, var, value) \ |
41 type var; \ | 41 type var; \ |
42 { \ | 42 { \ |
43 v8::TryCatch block; \ | 43 v8::TryCatch block; \ |
44 var = (value); \ | 44 var = (value); \ |
45 if (UNLIKELY(block.HasCaught())) \ | 45 if (UNLIKELY(block.HasCaught())) \ |
46 return block.ReThrow(); \ | 46 return block.ReThrow(); \ |
47 } | 47 } |
48 | 48 |
49 #define TONATIVE_VOID_INTERNAL(var, value) \ | 49 #define TONATIVE_VOID_INTERNAL(var, value) \ |
50 var = (value); \ | 50 var = (value); \ |
51 if (UNLIKELY(block.HasCaught())) { \ | 51 if (UNLIKELY(block.HasCaught())) \ |
52 block.ReThrow(); \ | 52 return; |
53 return; \ | |
54 } | |
55 | 53 |
56 #define TONATIVE_VOID(type, var, value) \ | 54 #define TONATIVE_VOID(type, var, value) \ |
57 type var; \ | 55 type var; \ |
58 { \ | 56 { \ |
59 v8::TryCatch block; \ | 57 v8::TryCatch block; \ |
yhirano
2014/05/30 09:33:21
You can use V8RethrowTryCatchScope and reuse TONAT
Jens Widell
2014/05/30 09:46:39
Done.
| |
60 TONATIVE_VOID_INTERNAL(var, value); \ | 58 var = (value); \ |
59 if (UNLIKELY(block.HasCaught())) { \ | |
60 block.ReThrow(); \ | |
61 return; \ | |
62 } \ | |
61 } | 63 } |
62 | 64 |
63 #define TONATIVE_DEFAULT(type, var, value, retVal) \ | 65 #define TONATIVE_DEFAULT(type, var, value, retVal) \ |
64 type var; \ | 66 type var; \ |
65 { \ | 67 { \ |
66 v8::TryCatch block; \ | 68 v8::TryCatch block; \ |
67 var = (value); \ | 69 var = (value); \ |
68 if (UNLIKELY(block.HasCaught())) { \ | 70 if (UNLIKELY(block.HasCaught())) { \ |
69 block.ReThrow(); \ | 71 block.ReThrow(); \ |
70 return retVal; \ | 72 return retVal; \ |
(...skipping 28 matching lines...) Expand all Loading... | |
99 // type is an instance of class template V8StringResource<>, | 101 // type is an instance of class template V8StringResource<>, |
100 // but Mode argument varies; using type (not Mode) for consistency | 102 // but Mode argument varies; using type (not Mode) for consistency |
101 // with other macros and ease of code generation | 103 // with other macros and ease of code generation |
102 #define TOSTRING_VOID(type, var, value) \ | 104 #define TOSTRING_VOID(type, var, value) \ |
103 type var(value); \ | 105 type var(value); \ |
104 if (UNLIKELY(!var.prepare())) \ | 106 if (UNLIKELY(!var.prepare())) \ |
105 return; | 107 return; |
106 | 108 |
107 #define TOSTRING_VOID_INTERNAL(var, value) \ | 109 #define TOSTRING_VOID_INTERNAL(var, value) \ |
108 var = (value); \ | 110 var = (value); \ |
109 if (UNLIKELY(!var.prepare())) { \ | 111 if (UNLIKELY(!var.prepare())) \ |
110 block.ReThrow(); \ | |
111 return; \ | |
112 } | |
113 | |
114 // There are no v8::TryCatch declared outside. | |
115 #define TOSTRING_VOID_INTERNAL_NOTRYCATCH(var, value) \ | |
116 var = (value); \ | |
117 if (UNLIKELY(!var.prepare())) \ | |
118 return; | 112 return; |
119 | 113 |
120 #define TOSTRING_DEFAULT(type, var, value, retVal) \ | 114 #define TOSTRING_DEFAULT(type, var, value, retVal) \ |
121 type var(value); \ | 115 type var(value); \ |
122 if (UNLIKELY(!var.prepare())) \ | 116 if (UNLIKELY(!var.prepare())) \ |
123 return retVal; | 117 return retVal; |
124 | 118 |
125 } // namespace WebCore | 119 } // namespace WebCore |
126 | 120 |
127 #endif // V8BindingMacros_h | 121 #endif // V8BindingMacros_h |
OLD | NEW |