diff --git a/base/memory/ptr_util.h b/base/memory/ptr_util.h index 2c8db5e11893b7..04f2c0258929e7 100644 --- a/base/memory/ptr_util.h +++ b/base/memory/ptr_util.h @@ -7,31 +7,6 @@ #include -// A function to convert T* into scoped_ptr -// Doing e.g. make_scoped_ptr(new FooBarBaz(arg)) is a shorter notation -// for scoped_ptr>(new FooBarBaz(arg)) -// -// Why doesn't this just return a scoped_ptr? -// -// make_scoped_ptr is currently being migrated out of scoped_ptr.h, so we can -// globally rename make_scoped_ptr to WrapUnique without breaking the build. -// Doing so without breaking intermediate builds involves several steps: -// -// 1. Move make_scoped_ptr into ptr_util.h and include ptr_util.h from -// scoped_ptr.h. -// 2. Add an #include for ptr_util.h to every file that references -// make_scoped_ptr. -// 3. Remove ptr_util.h include from scoped_ptr.h. -// 4. Global rewrite everything. -// -// Unfortunately, step 1 introduces an awkward cycle of dependencies between -// ptr_util.h and scoped_ptr.h To break that cycle, we exploit the fact that -// scoped_ptr is really just a type alias for std::unique_ptr. -template -std::unique_ptr make_scoped_ptr(T* ptr) { - return std::unique_ptr(ptr); -} - namespace base { // Helper to transfer ownership of a raw pointer to a std::unique_ptr. diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h index 37a980232bef96..e63887483840e3 100644 --- a/base/memory/scoped_ptr.h +++ b/base/memory/scoped_ptr.h @@ -11,10 +11,15 @@ #include -// TODO(dcheng): Temporary, to facilitate transition off scoped_ptr. -#include "base/memory/ptr_util.h" - template > using scoped_ptr = std::unique_ptr; +// A function to convert T* into scoped_ptr +// Doing e.g. make_scoped_ptr(new FooBarBaz(arg)) is a shorter notation +// for scoped_ptr >(new FooBarBaz(arg)) +template +scoped_ptr make_scoped_ptr(T* ptr) { + return scoped_ptr(ptr); +} + #endif // BASE_MEMORY_SCOPED_PTR_H_