• Victor Costan's avatar
    Use base::MakeRefCounted instead of new to alloc net::IOBuffer instances. · 8a7a19ab
    Victor Costan authored
    This CL only handles the files in //remoting. The files in //net were
    tackled in https://crrev.com/c/1188959. Parallel CLs will tackle other
    directories.
    
    net::IOBuffer is (thread-safe) ref-counted. Asides from improving the
    ability to reason about instance ownership locally, creating instances
    via base::MakeRefCounted makes it possible to use 1-based ref-counting
    in the future (see base/memory/ref_counted.h).
    
    This CL is mechanical, to avoid introducing any behavior changes. The
    difficult cases will be tackled by follow-up CLs. The following
    transformations were performed.
    
    * new IOBufferType(args) => base::MakeRefCounted<IOBufferType>(args)
    * new IOBufferType => base::MakeRefCounted<IOBufferType>()
    * scoped_refptr x(base::MakeRefCounted<IOBufferType>(args)) =>
      scoped_refptr x = base::MakeRefCounted<IOBufferType>(args)
    * scoped_refptr<IOBufferType>(base::MakeRefCounted<IOBufferType>(args)) =>
    
      base::MakeRefCounted<IOBufferType>(args)
    * In comments: creates a new IOBufferType => creates an IOBufferType
      (so it wouldn't trigger future searches for "new BufferType")
    * Instantiated static members in HttpResponseBodyDrainer,
      HttpNetworkTransaction, HttpProxyClientSocket, WritersTest,
      UDPSocketTest, TestDelegate, UDPSocketPerfTest
      (needed to fix linker errors)
    * arraysize -> base::size (where needed to pass presubmit checks)
    * git cl format
    
    Change-Id: I4feed626ef76c0da3934748ea063ce317ce2ce86
    Reviewed-on: https://chromium-review.googlesource.com/1200571Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
    Commit-Queue: Victor Costan <pwnall@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#590079}
    8a7a19ab
message_reader.cc 3.57 KB