Chromium Code Reviews| Index: Source/bindings/v8/V8BindingMacros.h |
| diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h |
| index e5841c9beda84810daf9ed7ea80f01cb7aca48cd..0985221fc5cd8d83da4fc613d6ff86696c048e82 100644 |
| --- a/Source/bindings/v8/V8BindingMacros.h |
| +++ b/Source/bindings/v8/V8BindingMacros.h |
| @@ -80,28 +80,40 @@ namespace WebCore { |
| } |
| #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal) \ |
| - type var; \ |
| - { \ |
| - v8::TryCatch block; \ |
| - var = (value); \ |
| - if (UNLIKELY(block.HasCaught())) \ |
| - exceptionState.rethrowV8Exception(block.Exception()); \ |
| - if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| - return retVal; \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) \ |
| + exceptionState.rethrowV8Exception(block.Exception()); \ |
| + if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| + return retVal; \ |
| } |
| // type is an instance of class template V8StringResource<>, |
| // but Mode argument varies; using type (not Mode) for consistency |
| // with other macros and ease of code generation |
| -#define TOSTRING_VOID(type, var, value) \ |
| - type var(value); \ |
| - if (UNLIKELY(!var.prepare())) \ |
| - return; |
| +#define TOSTRING_VOID(type, var, value) \ |
| + type var(value); \ |
| + if (UNLIKELY(!var.setStringAsPrimitive())) { \ |
|
haraken
2014/04/21 03:57:02
Shall we rename as follows?
setStringAsPrimitive
yhirano
2014/04/21 04:08:06
Done.
|
| + v8::TryCatch block; \ |
| + var.setStringWithToString(); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + block.ReThrow(); \ |
| + return; \ |
| + } \ |
| + } |
| #define TOSTRING_DEFAULT(type, var, value, retVal) \ |
| type var(value); \ |
| - if (UNLIKELY(!var.prepare())) \ |
| - return retVal; |
| + if (UNLIKELY(!var.setStringAsPrimitive())) { \ |
| + v8::TryCatch block; \ |
| + var.setStringWithToString(); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + block.ReThrow(); \ |
| + return retVal; \ |
| + } \ |
| + } |
| } // namespace WebCore |