Use unique_ptr rather than shared_ptr in MockReadCallback.
authorKyle Nekritz <knekritz@fb.com>
Thu, 21 Sep 2017 20:28:03 +0000 (13:28 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 21 Sep 2017 20:35:26 +0000 (13:35 -0700)
Summary: This is more convenient to use (for example with an IOBufEqual matcher).

Reviewed By: yfeldblum

Differential Revision: D5882029

fbshipit-source-id: 6aa12f80479f40bcc2af64dc270fb0a9382983b5

folly/io/async/test/MockAsyncTransport.h

index 16bec39cdbc2bec21da4e9bcd5c55f8b392e0f2b..8690b1839e92dc5cb0f7720915b0e6722d882da2 100644 (file)
@@ -77,15 +77,15 @@ class MockReadCallback: public AsyncTransportWrapper::ReadCallback {
   GMOCK_METHOD1_(, noexcept, , readDataAvailable, void(size_t));
   GMOCK_METHOD0_(, noexcept, , isBufferMovable, bool());
   GMOCK_METHOD1_(, noexcept, ,
-      readBufferAvailableInternal, void(std::shared_ptr<folly::IOBuf>));
+      readBufferAvailableInternal,
+      void(std::unique_ptr<folly::IOBuf>&));
   GMOCK_METHOD0_(, noexcept, , readEOF, void());
   GMOCK_METHOD1_(, noexcept, , readErr,
                  void(const AsyncSocketException&));
 
   void readBufferAvailable(std::unique_ptr<folly::IOBuf> readBuf)
     noexcept override {
-    readBufferAvailableInternal(
-        folly::to_shared_ptr(std::move(readBuf)));
+    readBufferAvailableInternal(readBuf);
   }
 };