[webkit-reviews] review granted: [Bug 137243] Generalize is<>() / downcast<>() support to all types : [Attachment 238923] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 30 12:33:56 PDT 2014


Benjamin Poulain <benjamin at webkit.org> has granted Chris Dumez
<cdumez at apple.com>'s request for review:
Bug 137243: Generalize is<>() / downcast<>() support to all types
https://bugs.webkit.org/show_bug.cgi?id=137243

Attachment 238923: Patch
https://bugs.webkit.org/attachment.cgi?id=238923&action=review

------- Additional Comments from Benjamin Poulain <benjamin at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=238923&action=review


> Source/WebCore/bindings/js/JSEventListener.cpp:136
> -	   if (scriptExecutionContext->isWorkerGlobalScope()) {
> +	   if (is<WorkerGlobalScope>(scriptExecutionContext)) {
>	       bool terminatorCausedException = (exec->hadException() &&
isTerminatedExecutionException(exec->exception()));
>	       if (terminatorCausedException || (vm.watchdog &&
vm.watchdog->didFire()))

I wonder why those conditions are in that order, looks a bit backward to me.

> Source/WebCore/dom/Element.h:789
> +namespace WTF {
> +template <>
> +struct TypeCastTraits<const WebCore::Element, const WebCore::Node> {
> +    static bool isOfType(const WebCore::Node& node) { return
node.isElementNode(); }
> +};
> +}

Would SPECIALIZE_TYPE_TRAITS_BEGIN work here?

> Source/WebCore/dom/ScriptExecutionContext.h:-240
> -#define SCRIPT_EXECUTION_CONTEXT_TYPE_CASTS(ToValueTypeName) \
> -    template<typename T> inline ToValueTypeName* to##ToValueTypeName(const
RefPtr<T>& context) { return to##ToValueTypeName(context.get()); } \
> -    TYPE_CASTS_BASE(ToValueTypeName, ScriptExecutionContext, context,
context->is##ToValueTypeName(), context.is##ToValueTypeName())
> -

Die preprocessor, die!


More information about the webkit-reviews mailing list