Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: Source/bindings/v8/V8BindingMacros.h

Issue 304223007: Use auto-rethrowing v8::TryCatch variant (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tweak macro definitions Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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; \
60 TONATIVE_VOID_INTERNAL(var, value); \ 58 V8RethrowTryCatchScope rethrow(block); \
haraken 2014/05/30 11:58:25 In my understanding, V8RethrowTryCatchScope should
yhirano 2014/05/30 12:06:58 I would like to "overwrite" V8RethrowTryCatchScope
59 TONATIVE_VOID_INTERNAL(var, value); \
61 } 60 }
62 61
63 #define TONATIVE_DEFAULT(type, var, value, retVal) \ 62 #define TONATIVE_DEFAULT(type, var, value, retVal) \
64 type var; \ 63 type var; \
65 { \ 64 { \
66 v8::TryCatch block; \ 65 v8::TryCatch block; \
67 var = (value); \ 66 var = (value); \
68 if (UNLIKELY(block.HasCaught())) { \ 67 if (UNLIKELY(block.HasCaught())) { \
69 block.ReThrow(); \ 68 block.ReThrow(); \
70 return retVal; \ 69 return retVal; \
(...skipping 28 matching lines...) Expand all
99 // type is an instance of class template V8StringResource<>, 98 // type is an instance of class template V8StringResource<>,
100 // but Mode argument varies; using type (not Mode) for consistency 99 // but Mode argument varies; using type (not Mode) for consistency
101 // with other macros and ease of code generation 100 // with other macros and ease of code generation
102 #define TOSTRING_VOID(type, var, value) \ 101 #define TOSTRING_VOID(type, var, value) \
103 type var(value); \ 102 type var(value); \
104 if (UNLIKELY(!var.prepare())) \ 103 if (UNLIKELY(!var.prepare())) \
105 return; 104 return;
106 105
107 #define TOSTRING_VOID_INTERNAL(var, value) \ 106 #define TOSTRING_VOID_INTERNAL(var, value) \
108 var = (value); \ 107 var = (value); \
109 if (UNLIKELY(!var.prepare())) { \ 108 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; 109 return;
119 110
120 #define TOSTRING_DEFAULT(type, var, value, retVal) \ 111 #define TOSTRING_DEFAULT(type, var, value, retVal) \
121 type var(value); \ 112 type var(value); \
122 if (UNLIKELY(!var.prepare())) \ 113 if (UNLIKELY(!var.prepare())) \
123 return retVal; 114 return retVal;
124 115
125 } // namespace WebCore 116 } // namespace WebCore
126 117
127 #endif // V8BindingMacros_h 118 #endif // V8BindingMacros_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698