X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fbindings%2Fv8%2FV8BindingMacros.h;h=e5841c9beda84810daf9ed7ea80f01cb7aca48cd;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=f5ab5832bef8783b2b6e8890d6f03dce09915a27;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/bindings/v8/V8BindingMacros.h b/src/third_party/WebKit/Source/bindings/v8/V8BindingMacros.h index f5ab583..e5841c9 100644 --- a/src/third_party/WebKit/Source/bindings/v8/V8BindingMacros.h +++ b/src/third_party/WebKit/Source/bindings/v8/V8BindingMacros.h @@ -33,38 +33,20 @@ namespace WebCore { -#define V8TRYCATCH(type, var, value) \ - type var; \ - { \ - v8::TryCatch block; \ - var = (value); \ - if (UNLIKELY(block.HasCaught())) \ - return block.ReThrow(); \ - } +// Naming scheme: +// TO*_RETURNTYPE[_ARGTYPE]... +// ...using _DEFAULT instead of _ANY..._ANY when returing a default value. -#define V8TRYCATCH_RETURN(type, var, value, retVal) \ - type var; \ - { \ - v8::TryCatch block; \ - var = (value); \ - if (UNLIKELY(block.HasCaught())) { \ - block.ReThrow(); \ - return retVal; \ - } \ +#define TONATIVE_EXCEPTION(type, var, value) \ + type var; \ + { \ + v8::TryCatch block; \ + var = (value); \ + if (UNLIKELY(block.HasCaught())) \ + return block.ReThrow(); \ } -#define V8TRYCATCH_EXCEPTION_RETURN(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; \ - } - -#define V8TRYCATCH_VOID(type, var, value) \ +#define TONATIVE_VOID(type, var, value) \ type var; \ { \ v8::TryCatch block; \ @@ -75,27 +57,52 @@ namespace WebCore { } \ } -#define V8TRYCATCH_EXCEPTION_VOID(type, var, value, exceptionState) \ - type var; \ - { \ - v8::TryCatch block; \ - var = (value); \ - if (UNLIKELY(block.HasCaught())) \ - exceptionState.rethrowV8Exception(block.Exception()); \ - if (UNLIKELY(exceptionState.throwIfNeeded())) \ - return; \ +#define TONATIVE_DEFAULT(type, var, value, retVal) \ + type var; \ + { \ + v8::TryCatch block; \ + var = (value); \ + if (UNLIKELY(block.HasCaught())) { \ + block.ReThrow(); \ + return retVal; \ + } \ } -#define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \ - type var(value); \ - if (UNLIKELY(!var.prepare())) \ - return retVal; +#define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ + type var; \ + { \ + v8::TryCatch block; \ + var = (value); \ + if (UNLIKELY(block.HasCaught())) \ + exceptionState.rethrowV8Exception(block.Exception()); \ + if (UNLIKELY(exceptionState.throwIfNeeded())) \ + return; \ + } -#define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ - type var(value); \ - if (UNLIKELY(!var.prepare())) \ +#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 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_DEFAULT(type, var, value, retVal) \ + type var(value); \ + if (UNLIKELY(!var.prepare())) \ + return retVal; + } // namespace WebCore #endif // V8BindingMacros_h