[webkit-reviews] review denied: [Bug 28054] use auxillary releaseRef function to get around winscw compiler issue regarding template argument. : [Attachment 34218] Fix the issue with a helper function.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Aug 6 12:32:42 PDT 2009
Darin Adler <darin at apple.com> has denied Yongjun Zhang
<yongjun.zhang at nokia.com>'s request for review:
Bug 28054: use auxillary releaseRef function to get around winscw compiler
issue regarding template argument.
https://bugs.webkit.org/show_bug.cgi?id=28054
Attachment 34218: Fix the issue with a helper function.
https://bugs.webkit.org/attachment.cgi?id=34218&action=review
------- Additional Comments from Darin Adler <darin at apple.com>
> +#if COMPILER(WINSCW)
> + template <typename T> void releaseRef(T*);
> +#endif
This doesn't need to be #ifdef'd compiler-specific. We can use this with the
other compilers too. But it needs to be an inline function. It will hurt
performance to not have it inlined. A good name for it would be derefIfNonNull
or safeDeref.
Since this is designed to be used only internally, we should give it a name
that won't tempt anyone to use it. And probably put it in a different
namespace, as is done with WTF::Internal in FastAllocBase.h.
releaseRef is not a good name for this -- it's already the name for an
unrelated member function.
> +#if COMPILER(WINSCW)
> + template <typename T> void releaseRef(T* ptr)
> + {
> + if (UNLIKELY(ptr != 0))
> + ptr->deref();
> + }
> +#endif
This should be marked inline and probably also should be defined before the
PassRefPtr template just in case order matters. For non-template code it can
sometimes be important to define inline functions before using them.
Otherwise looks quite good.
review- because of the comments above.
More information about the webkit-reviews
mailing list