• ricea's avatar
    Re-write many calls to WrapUnique() with MakeUnique() · 68860bd0
    ricea authored
    A mostly-automated change to convert instances of WrapUnique(new Foo(...)) to
    MakeUnique<Foo>(...). See the thread at
    https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/iQgMedVA8-k
    for background.
    
    To avoid requiring too many manual fixups, the change skips some cases that are
    frequently problematic. In particular, in methods named Foo::Method() it will
    not try to change WrapUnique(new Foo()) to MakeUnique<Foo>(). This is because
    Foo::Method() may be accessing an internal constructor of Foo.
    
    Cases where MakeUnique<NestedClass>(...) is called within a method of
    OuterClass are common but hard to detect automatically, so have been fixed-up
    manually.
    
    The only types of manual fix ups applied are:
    1) Revert MakeUnique back to WrapUnique
    2) Change NULL to nullptr in argument list (MakeUnique cannot forward NULL
       correctly)
    3) Add base:: namespace qualifier where missing.
    
    WrapUnique(new Foo) has not been converted to MakeUnique<Foo>() as this might
    change behaviour if Foo does not have a user-defined constructor. For example,
    WrapUnique(new int) creates an unitialised integer, but MakeUnique<int>()
    creates an integer initialised to 0.
    
    git cl format has been been run over the CL. Spot-checking has uncovered no
    cases of mis-formatting.
    
      BUG=637812
    
    Review-Url: https://codereview.chromium.org/2253233004
    Cr-Commit-Position: refs/heads/master@{#413390}
    68860bd0
chromium_port_allocator_factory.cc 966 Bytes