Slap deprecation notices on Pass methods

There's no reason not to use std::move instead now that we can use the
C++11 standard library.

BUG=webrtc:5373

Review URL: https://codereview.webrtc.org/1531013003

Cr-Commit-Position: refs/heads/master@{#11225}
diff --git a/webrtc/base/buffer.h b/webrtc/base/buffer.h
index bf2e9f3..ff9bb73 100644
--- a/webrtc/base/buffer.h
+++ b/webrtc/base/buffer.h
@@ -15,6 +15,8 @@
 #include <cassert>
 #include <cstring>
 #include <utility>  // std::swap (C++11 and later)
+
+#include "webrtc/base/deprecation.h"
 #include "webrtc/base/scoped_ptr.h"
 
 namespace rtc {
@@ -170,7 +172,9 @@
   }
 
   // b.Pass() does the same thing as std::move(b).
-  Buffer&& Pass() {
+  // Deprecated; remove in March 2016 (bug 5373).
+  RTC_DEPRECATED Buffer&& Pass() { return DEPRECATED_Pass(); }
+  Buffer&& DEPRECATED_Pass() {
     assert(IsConsistent());
     return std::move(*this);
   }
diff --git a/webrtc/base/buffer_unittest.cc b/webrtc/base/buffer_unittest.cc
index f1ae6b8..0b93b9b 100644
--- a/webrtc/base/buffer_unittest.cc
+++ b/webrtc/base/buffer_unittest.cc
@@ -138,7 +138,7 @@
 TEST(BufferTest, TestMoveConstruct) {
   Buffer buf1(kTestData, 3, 40);
   const uint8_t* data = buf1.data();
-  Buffer buf2(buf1.Pass());
+  Buffer buf2(buf1.DEPRECATED_Pass());
   EXPECT_EQ(buf2.size(), 3u);
   EXPECT_EQ(buf2.capacity(), 40u);
   EXPECT_EQ(buf2.data(), data);
@@ -152,7 +152,7 @@
   Buffer buf1(kTestData, 3, 40);
   const uint8_t* data = buf1.data();
   Buffer buf2(kTestData);
-  buf2 = buf1.Pass();
+  buf2 = buf1.DEPRECATED_Pass();
   EXPECT_EQ(buf2.size(), 3u);
   EXPECT_EQ(buf2.capacity(), 40u);
   EXPECT_EQ(buf2.data(), data);
diff --git a/webrtc/base/scoped_ptr.h b/webrtc/base/scoped_ptr.h
index 3f1a87a..d6aedfc 100644
--- a/webrtc/base/scoped_ptr.h
+++ b/webrtc/base/scoped_ptr.h
@@ -90,6 +90,7 @@
 #include <cstddef>
 
 #include "webrtc/base/constructormagic.h"
+#include "webrtc/base/deprecation.h"
 #include "webrtc/base/template_util.h"
 #include "webrtc/typedefs.h"
 
@@ -374,7 +375,10 @@
   scoped_ptr& operator=(const scoped_ptr& other) = delete;
 
   // Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).)
-  scoped_ptr&& Pass() { return std::move(*this); }
+  // Deprecated; remove in March 2016 (bug 5373).
+  RTC_DEPRECATED scoped_ptr&& Pass() {
+    return std::move(*this);
+  }
 
   // Reset.  Deletes the currently owned object, if any.
   // Then takes ownership of a new object, if given.
@@ -507,7 +511,10 @@
   scoped_ptr& operator=(const scoped_ptr& other) = delete;
 
   // Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).)
-  scoped_ptr&& Pass() { return std::move(*this); }
+  // Deprecated; remove in March 2016 (bug 5373).
+  RTC_DEPRECATED scoped_ptr&& Pass() {
+    return std::move(*this);
+  }
 
   // Reset.  Deletes the currently owned array, if any.
   // Then takes ownership of a new object, if given.
diff --git a/webrtc/system_wrappers/include/scoped_vector.h b/webrtc/system_wrappers/include/scoped_vector.h
index 284f437..15c3380 100644
--- a/webrtc/system_wrappers/include/scoped_vector.h
+++ b/webrtc/system_wrappers/include/scoped_vector.h
@@ -16,6 +16,7 @@
 #include <vector>
 
 #include "webrtc/base/checks.h"
+#include "webrtc/base/deprecation.h"
 #include "webrtc/system_wrappers/include/stl_util.h"
 
 namespace webrtc {
@@ -56,7 +57,11 @@
   ScopedVector& operator=(const ScopedVector& other) = delete;
 
   // Get an rvalue reference. (sv.Pass() does the same thing as std::move(sv).)
-  ScopedVector&& Pass() { return std::move(*this); }
+  // Deprecated; remove in March 2016 (bug 5373).
+  RTC_DEPRECATED ScopedVector&& Pass() { return DEPRECATED_Pass(); }
+  ScopedVector&& DEPRECATED_Pass() {
+    return std::move(*this);
+  }
 
   reference operator[](size_t index) { return v_[index]; }
   const_reference operator[](size_t index) const { return v_[index]; }
diff --git a/webrtc/system_wrappers/source/scoped_vector_unittest.cc b/webrtc/system_wrappers/source/scoped_vector_unittest.cc
index b049e4a..6e38f01 100644
--- a/webrtc/system_wrappers/source/scoped_vector_unittest.cc
+++ b/webrtc/system_wrappers/source/scoped_vector_unittest.cc
@@ -221,7 +221,8 @@
     EXPECT_FALSE(scoped_vector.empty());
     EXPECT_TRUE(watcher.IsWatching(scoped_vector.back()));
 
-    ScopedVector<LifeCycleObject> scoped_vector_copy(scoped_vector.Pass());
+    ScopedVector<LifeCycleObject> scoped_vector_copy(
+        scoped_vector.DEPRECATED_Pass());
     EXPECT_TRUE(scoped_vector.empty());
     EXPECT_FALSE(scoped_vector_copy.empty());
     EXPECT_TRUE(watcher.IsWatching(scoped_vector_copy.back()));
@@ -241,7 +242,7 @@
     EXPECT_FALSE(scoped_vector.empty());
     EXPECT_TRUE(watcher.IsWatching(scoped_vector.back()));
 
-    scoped_vector_assign = scoped_vector.Pass();
+    scoped_vector_assign = scoped_vector.DEPRECATED_Pass();
     EXPECT_TRUE(scoped_vector.empty());
     EXPECT_FALSE(scoped_vector_assign.empty());
     EXPECT_TRUE(watcher.IsWatching(scoped_vector_assign.back()));
@@ -273,10 +274,11 @@
 template <typename T>
 class PassThru  {
  public:
-  explicit PassThru(ScopedVector<T> scoper) : scoper_(scoper.Pass()) {}
+  explicit PassThru(ScopedVector<T> scoper)
+      : scoper_(scoper.DEPRECATED_Pass()) {}
 
   ScopedVector<T> Run() {
-    return scoper_.Pass();
+    return scoper_.DEPRECATED_Pass();
   }
 
  private:
@@ -288,7 +290,7 @@
   ScopedVector<DeleteCounter> deleter_vector;
   deleter_vector.push_back(new DeleteCounter(&deletes));
   EXPECT_EQ(0, deletes);
-  PassThru<DeleteCounter> pass_thru(deleter_vector.Pass());
+  PassThru<DeleteCounter> pass_thru(deleter_vector.DEPRECATED_Pass());
   EXPECT_EQ(0, deletes);
   ScopedVector<DeleteCounter> result = pass_thru.Run();
   EXPECT_EQ(0, deletes);