RESOLVED FIXED Bug 59656
Fix OwnPtr issues in IndexedDB
https://bugs.webkit.org/show_bug.cgi?id=59656
Summary Fix OwnPtr issues in IndexedDB
Adam Barth
Reported 2011-04-27 16:40:49 PDT
Fix OwnPtr issues in IndexedDB
Attachments
Patch (15.09 KB, patch)
2011-04-27 16:42 PDT, Adam Barth
no flags
Patch (1.39 KB, patch)
2011-04-27 23:49 PDT, Adam Barth
mjs: review+
Adam Barth
Comment 1 2011-04-27 16:42:20 PDT
David Levin
Comment 2 2011-04-27 16:46:13 PDT
Comment on attachment 91378 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=91378&action=review > Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:102 > + OwnPtr<LevelDBDatabase> result = adoptPtr(new LevelDBDatabase()); Not required (cq+ is ok with me) but might want to remove the ().
Eric Seidel (no email)
Comment 3 2011-04-27 16:47:16 PDT
Comment on attachment 91378 [details] Patch Yay! I'm kinda surprised it got landed as it was.
Eric Seidel (no email)
Comment 4 2011-04-27 16:52:05 PDT
In fareness to Steve, I think Darin's document is due for a refresh: http://www.webkit.org/coding/RefPtr.html. Some of what seemed "obviously" wrong in the previous commit, it not actually that obvious of patterns of WebCore. But we do need to be careful to get our memory management (and header includes) correct.
Adam Barth
Comment 5 2011-04-27 16:52:14 PDT
WebKit Review Bot
Comment 6 2011-04-27 17:30:49 PDT
http://trac.webkit.org/changeset/85122 might have broken SnowLeopard Intel Release (Tests)
David Grogan
Comment 7 2011-04-27 20:05:47 PDT
This busticated the clang build: http://build.chromium.org/p/chromium.webkit/builders/Mac%20Clang%20Builder%20%28dbg%29/builds/6490/steps/compile/logs/stdio In file included from /b/build/slave/Mac_Clang_Builder__dbg_/build/src/third_party/WebKit/Source/WebCore/WebCore.gyp/../platform/leveldb/LevelDBDatabase.cpp:27: In file included from ../platform/leveldb/LevelDBDatabase.h:31: ../../JavaScriptCore/wtf/OwnPtr.h:57:9: error: function 'WTF::OwnPtr<WebCore::<anonymous>::ComparatorAdapter>::OwnPtr' has internal linkage but is not defined [-Werror] OwnPtr(const OwnPtr<ValueType>&); ^ /b/build/slave/Mac_Clang_Builder__dbg_/build/src/third_party/WebKit/Source/WebCore/WebCore.gyp/../platform/leveldb/LevelDBDatabase.cpp:100:31: note: used here OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter(comparator)); ^ 1 error generated.
Adam Barth
Comment 8 2011-04-27 22:58:20 PDT
> This busticated the clang build: I have no idea what that error means. That line of code is one of the most common patterns in WebKit. Maybe it's a compiler bug?
Adam Barth
Comment 9 2011-04-27 23:47:59 PDT
Maciej has a theory for how to fix this error.
Adam Barth
Comment 10 2011-04-27 23:49:56 PDT
Maciej Stachowiak
Comment 11 2011-04-27 23:51:36 PDT
Comment on attachment 91436 [details] Patch r=me
Adam Barth
Comment 12 2011-04-27 23:53:30 PDT
> r=me Thanks!
Adam Barth
Comment 13 2011-04-27 23:56:42 PDT
Steve Block
Comment 14 2011-04-28 02:59:50 PDT
Thanks for fixing this and apologies for missing the include problems in the original patch. I wasn't aware that we should always use (Pass)OwnPtr every time ownership of an object is being transferred. What exactly is the policy? It would be great if the document could be updated for future reference.
Adam Barth
Comment 15 2011-04-28 11:26:29 PDT
> I wasn't aware that we should always use (Pass)OwnPtr every time ownership of an object is being transferred. What exactly is the policy? It would be great if the document could be updated for future reference. The policy is that we should try to avoid ever having a "naked new," which means every call to new should be immediately followed by either adoptRef (for ref-counted objects) or adoptPtr (for objects with a single owner). Everything else follows from the C++ type system. Turning on strict mode tightens the type system to better enforce this style. Once we've got that all working, we'll probably add a check-webkit-style nag about "naked new" so that these problems can be flagged automagically. (There's already an ASSERT that enforces this behavior for ref-counted objects.)
Note You need to log in before you can comment on or make changes to this bug.