[webkit-dev] Strict OwnPtr now (partially) enabled

Adam Barth abarth at webkit.org
Sat Apr 30 22:45:53 PDT 2011


Update: Strict mode for OwnPtr is now turned on for Mac, Chromium, Qt,
and GTK (thanks Ossy and mrobinson!).

http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/OwnPtr.h#L32

I'd like to turn this on for all ports early this week.  I don't have
a good way of not breaking the build in platform-specific files that I
can't build personally.

If you're interested in a port that's not on the list, please consider
turning it on for your port (e.g., by creating a bug blocking
https://bugs.webkit.org/show_bug.cgi?id=59428 and uploading a patch).
Generally, there shouldn't be too much work to do anymore because most
files in the project are covered already.

At some point next week, I'm going to enable strict mode everywhere
and do battle with the bots.

Thanks!
Adam


On Wed, Apr 27, 2011 at 3:31 PM, Adam Barth <abarth at webkit.org> wrote:
> Thanks to a bunch of hard work at the WebKit meeting (both as part of
> the OwnPtr hack-a-thon and "after hours"), we've now enabled strict
> OwnPtr semantics on PLATFORM(MAC).  Other platforms should follow
> shortly as we work through the platform-specific files.
>
> The strict semantics mean you'll no longer be able to store a raw
> pointer in an OwnPtr without first calling adoptPtr.  Ideally, you
> should call adoptPtr immediately after calling new:
>
> adoptPtr(new AwesomeClass(42))
>
> OwnPtr will ensure that the allocated memory is freed exactly once,
> avoiding memory leaks and double-frees.  There's still some more work
> to enable strict mode for PassOwnPtr, but hopefully we'll be able to
> turn that on soon as well.
>
> Thanks for all your help everyone, and happy memory management!
>
> Adam
>


More information about the webkit-dev mailing list