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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 #define V8TRYCATCH(type, var, value) \ | 36 #define V8TRYCATCH(type, var, value) \ |
37 type var; \ | 37 type var; \ |
38 { \ | 38 { \ |
39 v8::TryCatch block; \ | 39 v8::TryCatch block; \ |
40 var = (value); \ | 40 var = (value); \ |
41 if (block.HasCaught()) \ | 41 if (block.HasCaught()) \ |
42 return block.ReThrow(); \ | 42 return block.ReThrow(); \ |
43 } | 43 } |
44 | 44 |
| 45 #define V8TRYCATCH_RETURN(type, var, value, retVal) \ |
| 46 type var; \ |
| 47 { \ |
| 48 v8::TryCatch block; \ |
| 49 var = (value); \ |
| 50 if (block.HasCaught()) { \ |
| 51 block.ReThrow(); \ |
| 52 return retVal; \ |
| 53 } \ |
| 54 } |
| 55 |
45 #define V8TRYCATCH_VOID(type, var, value) \ | 56 #define V8TRYCATCH_VOID(type, var, value) \ |
46 type var; \ | 57 type var; \ |
47 { \ | 58 { \ |
48 v8::TryCatch block; \ | 59 v8::TryCatch block; \ |
49 var = (value); \ | 60 var = (value); \ |
50 if (block.HasCaught()) { \ | 61 if (block.HasCaught()) { \ |
51 block.ReThrow(); \ | 62 block.ReThrow(); \ |
52 return; \ | 63 return; \ |
53 } \ | 64 } \ |
54 } | 65 } |
(...skipping 22 matching lines...) Expand all Loading... |
77 return retVal; | 88 return retVal; |
78 | 89 |
79 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ | 90 #define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ |
80 type var(value); \ | 91 type var(value); \ |
81 if (!var.prepare()) \ | 92 if (!var.prepare()) \ |
82 return; | 93 return; |
83 | 94 |
84 } // namespace WebCore | 95 } // namespace WebCore |
85 | 96 |
86 #endif // V8BindingMacros_h | 97 #endif // V8BindingMacros_h |
OLD | NEW |