Remove the (previosly deprecated) Pass methods
Everyone should be using std::move instead. BUG=webrtc:5373 Review URL: https://codereview.webrtc.org/1778243006 Cr-Commit-Position: refs/heads/master@{#11962}
This commit is contained in:
@ -18,7 +18,6 @@
|
||||
#include "webrtc/base/array_view.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/deprecation.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
@ -229,15 +228,6 @@ class Buffer {
|
||||
RTC_DCHECK(IsConsistent());
|
||||
}
|
||||
|
||||
// b.Pass() does the same thing as std::move(b).
|
||||
// Deprecated; remove in March 2016 (bug 5373).
|
||||
RTC_DEPRECATED Buffer&& Pass() { return DEPRECATED_Pass(); }
|
||||
|
||||
Buffer&& DEPRECATED_Pass() {
|
||||
RTC_DCHECK(IsConsistent());
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
// Resets the buffer to zero size without altering capacity. Works even if the
|
||||
// buffer has been moved from.
|
||||
void Clear() {
|
||||
|
||||
@ -138,7 +138,7 @@ TEST(BufferTest, TestEnsureCapacityLarger) {
|
||||
TEST(BufferTest, TestMoveConstruct) {
|
||||
Buffer buf1(kTestData, 3, 40);
|
||||
const uint8_t* data = buf1.data();
|
||||
Buffer buf2(buf1.DEPRECATED_Pass());
|
||||
Buffer buf2(std::move(buf1));
|
||||
EXPECT_EQ(buf2.size(), 3u);
|
||||
EXPECT_EQ(buf2.capacity(), 40u);
|
||||
EXPECT_EQ(buf2.data(), data);
|
||||
@ -152,7 +152,7 @@ TEST(BufferTest, TestMoveAssign) {
|
||||
Buffer buf1(kTestData, 3, 40);
|
||||
const uint8_t* data = buf1.data();
|
||||
Buffer buf2(kTestData);
|
||||
buf2 = buf1.DEPRECATED_Pass();
|
||||
buf2 = std::move(buf1);
|
||||
EXPECT_EQ(buf2.size(), 3u);
|
||||
EXPECT_EQ(buf2.capacity(), 40u);
|
||||
EXPECT_EQ(buf2.data(), data);
|
||||
|
||||
@ -91,7 +91,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/deprecation.h"
|
||||
#include "webrtc/base/template_util.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
@ -375,12 +374,6 @@ class scoped_ptr {
|
||||
scoped_ptr(const scoped_ptr& other) = delete;
|
||||
scoped_ptr& operator=(const scoped_ptr& other) = delete;
|
||||
|
||||
// Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).)
|
||||
// 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.
|
||||
void reset(element_type* p = nullptr) { impl_.reset(p); }
|
||||
@ -511,12 +504,6 @@ class scoped_ptr<T[], D> {
|
||||
scoped_ptr(const scoped_ptr& other) = delete;
|
||||
scoped_ptr& operator=(const scoped_ptr& other) = delete;
|
||||
|
||||
// Get an rvalue reference. (sp.Pass() does the same thing as std::move(sp).)
|
||||
// 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.
|
||||
void reset(element_type* array = nullptr) { impl_.reset(array); }
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/deprecation.h"
|
||||
#include "webrtc/system_wrappers/include/stl_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -56,13 +55,6 @@ class ScopedVector {
|
||||
ScopedVector(const ScopedVector& other) = delete;
|
||||
ScopedVector& operator=(const ScopedVector& other) = delete;
|
||||
|
||||
// Get an rvalue reference. (sv.Pass() does the same thing as std::move(sv).)
|
||||
// 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]; }
|
||||
|
||||
|
||||
@ -221,8 +221,7 @@ TEST(ScopedVectorTest, MoveConstruct) {
|
||||
EXPECT_FALSE(scoped_vector.empty());
|
||||
EXPECT_TRUE(watcher.IsWatching(scoped_vector.back()));
|
||||
|
||||
ScopedVector<LifeCycleObject> scoped_vector_copy(
|
||||
scoped_vector.DEPRECATED_Pass());
|
||||
ScopedVector<LifeCycleObject> scoped_vector_copy(std::move(scoped_vector));
|
||||
EXPECT_TRUE(scoped_vector.empty());
|
||||
EXPECT_FALSE(scoped_vector_copy.empty());
|
||||
EXPECT_TRUE(watcher.IsWatching(scoped_vector_copy.back()));
|
||||
@ -242,7 +241,7 @@ TEST(ScopedVectorTest, MoveAssign) {
|
||||
EXPECT_FALSE(scoped_vector.empty());
|
||||
EXPECT_TRUE(watcher.IsWatching(scoped_vector.back()));
|
||||
|
||||
scoped_vector_assign = scoped_vector.DEPRECATED_Pass();
|
||||
scoped_vector_assign = std::move(scoped_vector);
|
||||
EXPECT_TRUE(scoped_vector.empty());
|
||||
EXPECT_FALSE(scoped_vector_assign.empty());
|
||||
EXPECT_TRUE(watcher.IsWatching(scoped_vector_assign.back()));
|
||||
@ -274,12 +273,8 @@ class DeleteCounter {
|
||||
template <typename T>
|
||||
class PassThru {
|
||||
public:
|
||||
explicit PassThru(ScopedVector<T> scoper)
|
||||
: scoper_(scoper.DEPRECATED_Pass()) {}
|
||||
|
||||
ScopedVector<T> Run() {
|
||||
return scoper_.DEPRECATED_Pass();
|
||||
}
|
||||
explicit PassThru(ScopedVector<T> scoper) : scoper_(std::move(scoper)) {}
|
||||
ScopedVector<T> Run() { return std::move(scoper_); }
|
||||
|
||||
private:
|
||||
ScopedVector<T> scoper_;
|
||||
@ -290,7 +285,7 @@ TEST(ScopedVectorTest, Passed) {
|
||||
ScopedVector<DeleteCounter> deleter_vector;
|
||||
deleter_vector.push_back(new DeleteCounter(&deletes));
|
||||
EXPECT_EQ(0, deletes);
|
||||
PassThru<DeleteCounter> pass_thru(deleter_vector.DEPRECATED_Pass());
|
||||
PassThru<DeleteCounter> pass_thru(std::move(deleter_vector));
|
||||
EXPECT_EQ(0, deletes);
|
||||
ScopedVector<DeleteCounter> result = pass_thru.Run();
|
||||
EXPECT_EQ(0, deletes);
|
||||
|
||||
Reference in New Issue
Block a user