Hi blink-devs,
It's now almost ready to land a
change to lock down copying of PassOwnPtrs. Unless I receive a significant objection, I will land it sometime tomorrow. This change is the first step of filling the functionality gap between OwnPtr and std::unique_ptr, to facilitate the migration of OwnPtr to std::unique_ptr.
After the change is landed, you will no longer be able to copy a PassOwnPtr to transfer the ownership; To transfer a PassOwnPtr variable's ownership, you need to explicitly use std::move().
I already fixed almost all the places of the existing code that would break with my change. No work is necessary for your existing code.
If you see a compile error in your new code, try either or both of the following:
1. Wrap a PassOwnPtr with std::move() to express the ownership transfer.
2. Wrap a PassOwnPtr argument passed to WTF::bind() with passed() (defined in wtf/Functional.h) to make it "auto-passed" to the function on the functor's first invocation.
These should be mostly sufficient to fix errors caused by my change. If you see an error that can't be fixed with these, feel free to ask me (or your near-by C++ guru).
Don't start the transition of the existing OwnPtrs to std::unique_ptrs yet. I'm planning to have another change in OwnPtr's functionality to make it much more closer to std::unique_ptr. I will announce when that is ready.
Feel free to send me questions, suggestions or anything else, as always.
Thanks!
Yuta