[Chromium] Add an ASSERT macro to the Chromium WebKit API
Created attachment 51522 [details] Patch
Comment on attachment 51522 [details] Patch > +++ b/WebKit/chromium/public/WebCommon.h ... > } // namespace WebKit > > +// ----------------------------------------------------------------------------- > +// Assertions > + > +namespace WebKit { > + > +void failedAssertion(const char* file, int line, const char* function, const char* assertion); > + > +} // namespace WebKit Why close and then re-open the WebKit namespace? Please annotate WebKit API entry points with WEBKIT_API. > +// Only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks. Otherwise use WTF's ASSERT. There is actually no problem using this outside of WEBKIT_IMPLEMENTATION blocks. > +#if defined(NDEBUG) > +#define WEBKIT_ASSERT(assertion) ((void)0) > +#else > +#define WEBKIT_ASSERT(assertion) do \ > + if (!(assertion)) { \ > + WebKit::failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ > + } \ ^^^ nit: webkit style says no brackets around single line statements.
> > +// Only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks. Otherwise use WTF's ASSERT. > > There is actually no problem using this outside of WEBKIT_IMPLEMENTATION > blocks. I know, but the WebCore asserts are more robust and have extra logic for turning them on/off. Just seemed like a good idea to point people in that direction primarily. > > +#if defined(NDEBUG) > > +#define WEBKIT_ASSERT(assertion) ((void)0) > > +#else > > +#define WEBKIT_ASSERT(assertion) do \ > > + if (!(assertion)) { \ > > + WebKit::failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ > > + } \ > > ^^^ nit: webkit style says no brackets around single line statements. Just copied what was in Assertions (and then removed a line). I suppose brackets should be around the do/while tho.
Created attachment 51618 [details] fix issues
Comment on attachment 51618 [details] fix issues Clearing flags on attachment: 51618 Committed r56579: <http://trac.webkit.org/changeset/56579>
All reviewed patches have been landed. Closing bug.