commit | 8f9d7d395985a1e6baee59c75d5078413d1e32e0 | [log] [tgz] |
---|---|---|
author | Bence Béky <[email protected]> | Mon Oct 09 19:58:04 2017 |
committer | Commit Bot <[email protected]> | Mon Oct 09 19:58:04 2017 |
tree | 3e5d801d3e04382ca4c58035ed19cbdb31a0defc | |
parent | e3bc6302c6fe2005c321e69775b45a9a103f702d [diff] |
Avoid WrapUnique(new) in //net. I structured this cleanup CL into multiple patch sets hoping that that would make it easier to review. (They are kinda too small for individual CLs.) There is no bug for most of this CL, except for the Patch set 5 part of it. Patch set 1: Except for befriended factory methods that need to call new directly, and except for shared code, use make_unique instead of WrapUnique: * base::WrapUnique(new T) => std::make_unique<T>() * base::WrapUnique(new T()) => std::make_unique<T>() * base::WrapUnique(new T(args...)) => std::make_unique<T>(args...) because WrapUnique(new) is just silly, see https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/iQgMedVA8-k. Patch set 2: Change NULL to nullptr in constructor arguments passed to make_unique at two places, because otherwise the compiler refuses to compile on the basis that it cannot convert long to T*. (Funny that new does not have this issue.) Patch set 3: Change one WrapUnique(uniqueptr.release()) pattern to std::move(). (Patch set 4: edit commit message.) Patch set 5: Change base::MakeUnique to std::make_unique at six occurrences, see https://crrev.com/c/616016. Patch set 6: Include "ptr_util.h" (for WrapUnique) and <memory> (for make_unique) exactly where necessary. (Patch set 7: edit commit message.) Patch set 8: Revert WrapUnique(new) to make_unique change in one more friend class because of private constructor. (Patch set 9: edit commit message.) Change-Id: I77e1f1b2cc0889090e486bf592f0d95f76d543bf Bug: 755727 Change-Id: I77e1f1b2cc0889090e486bf592f0d95f76d543bf Reviewed-on: https://chromium-review.googlesource.com/697784 Commit-Queue: Bence Béky <[email protected]> Reviewed-by: Ryan Hamilton <[email protected]> Cr-Commit-Position: refs/heads/master@{#507458}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .