Don't call the Pass methods of rtc::Buffer, rtc::scoped_ptr, and rtc::ScopedVector
We can now use std::move instead! This CL leaves the Pass methods in place; a follow-up CL will add deprecation annotations to them. Review URL: https://codereview.webrtc.org/1460043002 Cr-Commit-Position: refs/heads/master@{#11064}
This commit is contained in:
parent
e376f0f2df
commit
0eb15ed7b8
@ -27,6 +27,8 @@
|
||||
|
||||
#include "talk/app/webrtc/dtlsidentitystore.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/webrtcsessiondescriptionfactory.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
|
||||
@ -72,7 +74,7 @@ class DtlsIdentityStoreImpl::WorkerTask : public sigslot::has_slots<>,
|
||||
// Posting to |this| avoids touching |store_| on threads other than
|
||||
// |signaling_thread_| and thus avoids having to use locks.
|
||||
IdentityResultMessageData* msg = new IdentityResultMessageData(
|
||||
new IdentityResult(key_type_, identity.Pass()));
|
||||
new IdentityResult(key_type_, std::move(identity)));
|
||||
signaling_thread_->Post(this, MSG_GENERATE_IDENTITY_RESULT, msg);
|
||||
}
|
||||
|
||||
@ -93,7 +95,7 @@ class DtlsIdentityStoreImpl::WorkerTask : public sigslot::has_slots<>,
|
||||
static_cast<IdentityResultMessageData*>(msg->pdata));
|
||||
if (store_) {
|
||||
store_->OnIdentityGenerated(pdata->data()->key_type_,
|
||||
pdata->data()->identity_.Pass());
|
||||
std::move(pdata->data()->identity_));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -152,7 +154,7 @@ void DtlsIdentityStoreImpl::OnMessage(rtc::Message* msg) {
|
||||
rtc::scoped_ptr<IdentityResultMessageData> pdata(
|
||||
static_cast<IdentityResultMessageData*>(msg->pdata));
|
||||
OnIdentityGenerated(pdata->data()->key_type_,
|
||||
pdata->data()->identity_.Pass());
|
||||
std::move(pdata->data()->identity_));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -178,9 +180,9 @@ void DtlsIdentityStoreImpl::GenerateIdentity(
|
||||
// Return identity async - post even though we are on |signaling_thread_|.
|
||||
LOG(LS_VERBOSE) << "Using a free DTLS identity.";
|
||||
++request_info_[key_type].gen_in_progress_counts_;
|
||||
IdentityResultMessageData* msg = new IdentityResultMessageData(
|
||||
new IdentityResult(key_type,
|
||||
request_info_[key_type].free_identity_.Pass()));
|
||||
IdentityResultMessageData* msg =
|
||||
new IdentityResultMessageData(new IdentityResult(
|
||||
key_type, std::move(request_info_[key_type].free_identity_)));
|
||||
signaling_thread_->Post(this, MSG_GENERATE_IDENTITY_RESULT, msg);
|
||||
return;
|
||||
}
|
||||
@ -228,7 +230,7 @@ void DtlsIdentityStoreImpl::OnIdentityGenerated(
|
||||
// Return the result to the observer.
|
||||
if (identity.get()) {
|
||||
LOG(LS_VERBOSE) << "A DTLS identity is returned to an observer.";
|
||||
observer->OnSuccess(identity.Pass());
|
||||
observer->OnSuccess(std::move(identity));
|
||||
} else {
|
||||
LOG(LS_WARNING) << "Failed to generate DTLS identity.";
|
||||
observer->OnFailure(0);
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/messagehandler.h"
|
||||
#include "webrtc/base/messagequeue.h"
|
||||
@ -129,7 +130,7 @@ class DtlsIdentityStoreImpl : public DtlsIdentityStoreInterface,
|
||||
struct IdentityResult {
|
||||
IdentityResult(rtc::KeyType key_type,
|
||||
rtc::scoped_ptr<rtc::SSLIdentity> identity)
|
||||
: key_type_(key_type), identity_(identity.Pass()) {}
|
||||
: key_type_(key_type), identity_(std::move(identity)) {}
|
||||
|
||||
rtc::KeyType key_type_;
|
||||
rtc::scoped_ptr<rtc::SSLIdentity> identity_;
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
#define JNIEXPORT __attribute__((visibility("default")))
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/java/jni/classreferenceholder.h"
|
||||
#include "talk/app/webrtc/java/jni/jni_helpers.h"
|
||||
@ -1631,7 +1632,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
|
||||
rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
|
||||
if (ssl_identity.get()) {
|
||||
rtc_config.certificates.push_back(
|
||||
rtc::RTCCertificate::Create(ssl_identity.Pass()));
|
||||
rtc::RTCCertificate::Create(std::move(ssl_identity)));
|
||||
LOG(LS_INFO) << "ECDSA certificate created.";
|
||||
} else {
|
||||
// Failing to create certificate should not abort peer connection
|
||||
|
||||
@ -28,8 +28,9 @@
|
||||
#include "talk/app/webrtc/peerconnection.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <cctype> // for isdigit
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/audiotrack.h"
|
||||
#include "talk/app/webrtc/dtmfsender.h"
|
||||
@ -632,8 +633,8 @@ bool PeerConnection::Initialize(
|
||||
}
|
||||
rtc::scoped_ptr<cricket::PortAllocator> allocator(
|
||||
allocator_factory->CreatePortAllocator(stun_config, turn_config));
|
||||
return Initialize(configuration, constraints, allocator.Pass(),
|
||||
dtls_identity_store.Pass(), observer);
|
||||
return Initialize(configuration, constraints, std::move(allocator),
|
||||
std::move(dtls_identity_store), observer);
|
||||
}
|
||||
|
||||
bool PeerConnection::Initialize(
|
||||
@ -649,7 +650,7 @@ bool PeerConnection::Initialize(
|
||||
}
|
||||
observer_ = observer;
|
||||
|
||||
port_allocator_ = allocator.Pass();
|
||||
port_allocator_ = std::move(allocator);
|
||||
|
||||
std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config;
|
||||
std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config;
|
||||
@ -701,7 +702,7 @@ bool PeerConnection::Initialize(
|
||||
|
||||
// Initialize the WebRtcSession. It creates transport channels etc.
|
||||
if (!session_->Initialize(factory_->options(), constraints,
|
||||
dtls_identity_store.Pass(), configuration)) {
|
||||
std::move(dtls_identity_store), configuration)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/dtmfsender.h"
|
||||
@ -151,7 +152,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
||||
const PeerConnectionFactory::Options* options,
|
||||
rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
|
||||
PeerConnectionTestClient* client(new PeerConnectionTestClient(id));
|
||||
if (!client->Init(constraints, options, dtls_identity_store.Pass())) {
|
||||
if (!client->Init(constraints, options, std::move(dtls_identity_store))) {
|
||||
delete client;
|
||||
return nullptr;
|
||||
}
|
||||
@ -167,7 +168,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
||||
: nullptr);
|
||||
|
||||
return CreateClientWithDtlsIdentityStore(id, constraints, options,
|
||||
dtls_identity_store.Pass());
|
||||
std::move(dtls_identity_store));
|
||||
}
|
||||
|
||||
~PeerConnectionTestClient() {
|
||||
@ -761,7 +762,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
||||
peer_connection_factory_->SetOptions(*options);
|
||||
}
|
||||
peer_connection_ = CreatePeerConnection(
|
||||
allocator_factory_.get(), constraints, dtls_identity_store.Pass());
|
||||
allocator_factory_.get(), constraints, std::move(dtls_identity_store));
|
||||
return peer_connection_.get() != nullptr;
|
||||
}
|
||||
|
||||
@ -776,7 +777,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
||||
ice_servers.push_back(ice_server);
|
||||
|
||||
return peer_connection_factory_->CreatePeerConnection(
|
||||
ice_servers, constraints, factory, dtls_identity_store.Pass(), this);
|
||||
ice_servers, constraints, factory, std::move(dtls_identity_store),
|
||||
this);
|
||||
}
|
||||
|
||||
void HandleIncomingOffer(const std::string& msg) {
|
||||
@ -1129,7 +1131,8 @@ class P2PTestConductor : public testing::Test {
|
||||
|
||||
// Make sure the new client is using a different certificate.
|
||||
return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore(
|
||||
"New Peer: ", &setup_constraints, nullptr, dtls_identity_store.Pass());
|
||||
"New Peer: ", &setup_constraints, nullptr,
|
||||
std::move(dtls_identity_store));
|
||||
}
|
||||
|
||||
void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) {
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
|
||||
#include "talk/app/webrtc/peerconnectionfactory.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/audiotrack.h"
|
||||
#include "talk/app/webrtc/localaudiosource.h"
|
||||
#include "talk/app/webrtc/mediastream.h"
|
||||
@ -274,12 +276,8 @@ PeerConnectionFactory::CreatePeerConnection(
|
||||
|
||||
rtc::scoped_refptr<PeerConnection> pc(
|
||||
new rtc::RefCountedObject<PeerConnection>(this));
|
||||
if (!pc->Initialize(
|
||||
configuration,
|
||||
constraints,
|
||||
chosen_allocator_factory,
|
||||
dtls_identity_store.Pass(),
|
||||
observer)) {
|
||||
if (!pc->Initialize(configuration, constraints, chosen_allocator_factory,
|
||||
std::move(dtls_identity_store), observer)) {
|
||||
return NULL;
|
||||
}
|
||||
return PeerConnectionProxy::Create(signaling_thread(), pc);
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/fakeportallocatorfactory.h"
|
||||
#include "talk/app/webrtc/mediastreaminterface.h"
|
||||
@ -158,9 +159,8 @@ TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) {
|
||||
|
||||
rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory->CreatePeerConnection(
|
||||
servers, nullptr, nullptr, dtls_identity_store.Pass(), &observer));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection(
|
||||
servers, nullptr, nullptr, std::move(dtls_identity_store), &observer));
|
||||
|
||||
EXPECT_TRUE(pc.get() != nullptr);
|
||||
}
|
||||
@ -180,11 +180,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
StunConfigurations stun_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::StunConfiguration stun1(
|
||||
@ -213,11 +211,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
StunConfigurations stun_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::StunConfiguration stun1(
|
||||
@ -251,11 +247,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersOldSignature) {
|
||||
ice_servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(ice_servers, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
ice_servers, nullptr, allocator_factory_.get(),
|
||||
std::move(dtls_identity_store), &observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
StunConfigurations stun_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::StunConfiguration stun1(
|
||||
@ -283,11 +277,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
TurnConfigurations turn_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::TurnConfiguration turn(
|
||||
@ -306,11 +298,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
TurnConfigurations turn_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::TurnConfiguration turn(
|
||||
@ -333,11 +323,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
TurnConfigurations turn_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::TurnConfiguration turn1(
|
||||
@ -370,11 +358,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
|
||||
config.servers.push_back(ice_server);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
|
||||
new FakeDtlsIdentityStore());
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||
factory_->CreatePeerConnection(config, nullptr,
|
||||
allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_));
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
||||
config, nullptr, allocator_factory_.get(), std::move(dtls_identity_store),
|
||||
&observer_));
|
||||
EXPECT_TRUE(pc.get() != NULL);
|
||||
StunConfigurations stun_configs;
|
||||
webrtc::PortAllocatorFactoryInterface::StunConfiguration stun1(
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#define TALK_APP_WEBRTC_PEERCONNECTIONFACTORYPROXY_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/peerconnectioninterface.h"
|
||||
#include "talk/app/webrtc/proxy.h"
|
||||
@ -38,7 +39,7 @@ namespace webrtc {
|
||||
|
||||
BEGIN_PROXY_MAP(PeerConnectionFactory)
|
||||
PROXY_METHOD1(void, SetOptions, const Options&)
|
||||
// Can't use PROXY_METHOD5 because scoped_ptr must be Pass()ed.
|
||||
// Can't use PROXY_METHOD5 because scoped_ptr must be moved.
|
||||
// TODO(tommi,hbos): Use of templates to support scoped_ptr?
|
||||
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
||||
const PeerConnectionInterface::RTCConfiguration& a1,
|
||||
@ -84,7 +85,7 @@ BEGIN_PROXY_MAP(PeerConnectionFactory)
|
||||
DtlsIdentityStoreInterface* a4,
|
||||
PeerConnectionObserver* a5) {
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
|
||||
return c_->CreatePeerConnection(a1, a2, a3, ptr_a4.Pass(), a5);
|
||||
return c_->CreatePeerConnection(a1, a2, a3, std::move(ptr_a4), a5);
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot2(
|
||||
@ -95,7 +96,8 @@ BEGIN_PROXY_MAP(PeerConnectionFactory)
|
||||
PeerConnectionObserver* a5) {
|
||||
rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3);
|
||||
rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
|
||||
return c_->CreatePeerConnection(a1, a2, ptr_a3.Pass(), ptr_a4.Pass(), a5);
|
||||
return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3),
|
||||
std::move(ptr_a4), a5);
|
||||
}
|
||||
END_PROXY()
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@
|
||||
#define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/datachannelinterface.h"
|
||||
@ -604,7 +605,7 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
|
||||
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||
rtc_config.servers = servers;
|
||||
return CreatePeerConnection(rtc_config, constraints, allocator_factory,
|
||||
dtls_identity_store.Pass(), observer);
|
||||
std::move(dtls_identity_store), observer);
|
||||
}
|
||||
|
||||
virtual rtc::scoped_refptr<MediaStreamInterface>
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/audiotrack.h"
|
||||
#include "talk/app/webrtc/fakeportallocatorfactory.h"
|
||||
@ -562,10 +563,9 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
||||
nullptr) && dtls) {
|
||||
dtls_identity_store.reset(new FakeDtlsIdentityStore());
|
||||
}
|
||||
pc_ = pc_factory_->CreatePeerConnection(servers, constraints,
|
||||
port_allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
&observer_);
|
||||
pc_ = pc_factory_->CreatePeerConnection(
|
||||
servers, constraints, port_allocator_factory_.get(),
|
||||
std::move(dtls_identity_store), &observer_);
|
||||
ASSERT_TRUE(pc_.get() != NULL);
|
||||
observer_.SetPeerConnectionInterface(pc_.get());
|
||||
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
|
||||
@ -582,7 +582,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
|
||||
scoped_refptr<PeerConnectionInterface> pc;
|
||||
pc = pc_factory_->CreatePeerConnection(
|
||||
servers, nullptr, port_allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(), &observer_);
|
||||
std::move(dtls_identity_store), &observer_);
|
||||
ASSERT_EQ(nullptr, pc);
|
||||
}
|
||||
|
||||
|
||||
@ -696,8 +696,7 @@ class StatsCollectorTest : public testing::Test {
|
||||
// Fake certificate to report
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate(
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::FakeSSLIdentity>(
|
||||
new rtc::FakeSSLIdentity(local_cert))
|
||||
.Pass()));
|
||||
new rtc::FakeSSLIdentity(local_cert))));
|
||||
|
||||
// Configure MockWebRtcSession
|
||||
EXPECT_CALL(session_,
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#define TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/dtlsidentitystore.h"
|
||||
#include "talk/app/webrtc/peerconnectioninterface.h"
|
||||
@ -141,7 +142,7 @@ class FakeDtlsIdentityStore : public webrtc::DtlsIdentityStoreInterface,
|
||||
rtc::scoped_ptr<rtc::SSLIdentity> identity(
|
||||
rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert));
|
||||
|
||||
return rtc::RTCCertificate::Create(identity.Pass());
|
||||
return rtc::RTCCertificate::Create(std::move(identity));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/fakeportallocatorfactory.h"
|
||||
#include "talk/app/webrtc/test/fakedtlsidentitystore.h"
|
||||
#include "talk/app/webrtc/test/fakeperiodicvideocapturer.h"
|
||||
@ -97,7 +99,7 @@ bool PeerConnectionTestWrapper::CreatePc(
|
||||
new FakeDtlsIdentityStore() : nullptr);
|
||||
peer_connection_ = peer_connection_factory_->CreatePeerConnection(
|
||||
ice_servers, constraints, allocator_factory_.get(),
|
||||
dtls_identity_store.Pass(), this);
|
||||
std::move(dtls_identity_store), this);
|
||||
|
||||
return peer_connection_.get() != NULL;
|
||||
}
|
||||
|
||||
@ -724,7 +724,7 @@ bool WebRtcSession::Initialize(
|
||||
// Use the |dtls_identity_store| to generate a certificate.
|
||||
RTC_DCHECK(dtls_identity_store);
|
||||
webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory(
|
||||
signaling_thread(), channel_manager_, dtls_identity_store.Pass(),
|
||||
signaling_thread(), channel_manager_, std::move(dtls_identity_store),
|
||||
this, id()));
|
||||
} else {
|
||||
// Use the already generated certificate.
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/audiotrack.h"
|
||||
@ -425,7 +426,7 @@ class WebRtcSessionTest
|
||||
observer_.ice_gathering_state_);
|
||||
|
||||
EXPECT_TRUE(session_->Initialize(options_, constraints_.get(),
|
||||
dtls_identity_store.Pass(),
|
||||
std::move(dtls_identity_store),
|
||||
rtc_configuration));
|
||||
session_->set_metrics_observer(metrics_observer_);
|
||||
}
|
||||
@ -476,7 +477,7 @@ class WebRtcSessionTest
|
||||
} else {
|
||||
RTC_CHECK(false);
|
||||
}
|
||||
Init(dtls_identity_store.Pass(), configuration);
|
||||
Init(std::move(dtls_identity_store), configuration);
|
||||
}
|
||||
|
||||
// Init with DTLS with a store that will fail to generate a certificate.
|
||||
@ -485,7 +486,7 @@ class WebRtcSessionTest
|
||||
new FakeDtlsIdentityStore());
|
||||
dtls_identity_store->set_should_fail(true);
|
||||
PeerConnectionInterface::RTCConfiguration configuration;
|
||||
Init(dtls_identity_store.Pass(), configuration);
|
||||
Init(std::move(dtls_identity_store), configuration);
|
||||
}
|
||||
|
||||
void InitWithDtmfCodec() {
|
||||
@ -723,9 +724,9 @@ class WebRtcSessionTest
|
||||
std::string identity_name = "WebRTC" +
|
||||
rtc::ToString(rtc::CreateRandomId());
|
||||
// Confirmed to work with KT_RSA and KT_ECDSA.
|
||||
tdesc_factory_->set_certificate(rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate(
|
||||
identity_name, rtc::KT_DEFAULT)).Pass()));
|
||||
tdesc_factory_->set_certificate(
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate(identity_name, rtc::KT_DEFAULT))));
|
||||
tdesc_factory_->set_secure(cricket::SEC_REQUIRED);
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
|
||||
#include "talk/app/webrtc/webrtcsessiondescriptionfactory.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/dtlsidentitystore.h"
|
||||
#include "talk/app/webrtc/jsep.h"
|
||||
#include "talk/app/webrtc/jsepsessiondescription.h"
|
||||
@ -99,12 +101,12 @@ void WebRtcIdentityRequestObserver::OnSuccess(
|
||||
der_private_key.length());
|
||||
rtc::scoped_ptr<rtc::SSLIdentity> identity(
|
||||
rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert));
|
||||
SignalCertificateReady(rtc::RTCCertificate::Create(identity.Pass()));
|
||||
SignalCertificateReady(rtc::RTCCertificate::Create(std::move(identity)));
|
||||
}
|
||||
|
||||
void WebRtcIdentityRequestObserver::OnSuccess(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity> identity) {
|
||||
SignalCertificateReady(rtc::RTCCertificate::Create(identity.Pass()));
|
||||
SignalCertificateReady(rtc::RTCCertificate::Create(std::move(identity)));
|
||||
}
|
||||
|
||||
// static
|
||||
@ -143,7 +145,7 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
|
||||
// to just use a random number as session id and start version from
|
||||
// |kInitSessionVersion|.
|
||||
session_version_(kInitSessionVersion),
|
||||
dtls_identity_store_(dtls_identity_store.Pass()),
|
||||
dtls_identity_store_(std::move(dtls_identity_store)),
|
||||
identity_request_observer_(identity_request_observer),
|
||||
session_(session),
|
||||
session_id_(session_id),
|
||||
@ -177,7 +179,7 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
|
||||
: WebRtcSessionDescriptionFactory(
|
||||
signaling_thread,
|
||||
channel_manager,
|
||||
dtls_identity_store.Pass(),
|
||||
std::move(dtls_identity_store),
|
||||
new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(),
|
||||
session,
|
||||
session_id,
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "talk/session/media/channel.h"
|
||||
|
||||
#include "talk/media/base/constants.h"
|
||||
@ -555,7 +557,7 @@ bool BaseChannel::SendPacket(bool rtcp,
|
||||
// Avoid a copy by transferring the ownership of the packet data.
|
||||
int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET;
|
||||
PacketMessageData* data = new PacketMessageData;
|
||||
data->packet = packet->Pass();
|
||||
data->packet = std::move(*packet);
|
||||
data->options = options;
|
||||
worker_thread_->Post(this, message_id, data);
|
||||
return true;
|
||||
|
||||
@ -175,17 +175,15 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
|
||||
if (flags1 & DTLS) {
|
||||
// Confirmed to work with KT_RSA and KT_ECDSA.
|
||||
transport_controller1_.SetLocalCertificate(rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT))
|
||||
.Pass()));
|
||||
transport_controller1_.SetLocalCertificate(
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT))));
|
||||
}
|
||||
if (flags2 & DTLS) {
|
||||
// Confirmed to work with KT_RSA and KT_ECDSA.
|
||||
transport_controller2_.SetLocalCertificate(rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT))
|
||||
.Pass()));
|
||||
transport_controller2_.SetLocalCertificate(
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT))));
|
||||
}
|
||||
|
||||
// Add stream information (SSRC) to the local content but not to the remote
|
||||
|
||||
@ -238,11 +238,9 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
f2_.set_video_codecs(MAKE_VECTOR(kVideoCodecs2));
|
||||
f2_.set_data_codecs(MAKE_VECTOR(kDataCodecs2));
|
||||
tdf1_.set_certificate(rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
new rtc::FakeSSLIdentity("id1")).Pass()));
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id1"))));
|
||||
tdf2_.set_certificate(rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
new rtc::FakeSSLIdentity("id2")).Pass()));
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("id2"))));
|
||||
}
|
||||
|
||||
// Create a video StreamParamsVec object with:
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "webrtc/base/buffer.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
namespace rtc {
|
||||
|
||||
@ -22,7 +23,9 @@ Buffer::Buffer(const Buffer& buf) : Buffer(buf.data(), buf.size()) {
|
||||
}
|
||||
|
||||
Buffer::Buffer(Buffer&& buf)
|
||||
: size_(buf.size()), capacity_(buf.capacity()), data_(buf.data_.Pass()) {
|
||||
: size_(buf.size()),
|
||||
capacity_(buf.capacity()),
|
||||
data_(std::move(buf.data_)) {
|
||||
assert(IsConsistent());
|
||||
buf.OnMovedFrom();
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class Buffer {
|
||||
assert(buf.IsConsistent());
|
||||
size_ = buf.size_;
|
||||
capacity_ = buf.capacity_;
|
||||
data_ = buf.data_.Pass();
|
||||
data_ = std::move(buf.data_);
|
||||
buf.OnMovedFrom();
|
||||
return *this;
|
||||
}
|
||||
@ -164,12 +164,12 @@ class Buffer {
|
||||
return;
|
||||
scoped_ptr<uint8_t[]> new_data(new uint8_t[capacity]);
|
||||
std::memcpy(new_data.get(), data_.get(), size_);
|
||||
data_ = new_data.Pass();
|
||||
data_ = std::move(new_data);
|
||||
capacity_ = capacity;
|
||||
assert(IsConsistent());
|
||||
}
|
||||
|
||||
// We can't call std::move(b), so call b.Pass() instead to do the same job.
|
||||
// b.Pass() does the same thing as std::move(b).
|
||||
Buffer&& Pass() {
|
||||
assert(IsConsistent());
|
||||
return static_cast<Buffer&&>(*this);
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_BASE_MESSAGEHANDLER_H_
|
||||
#define WEBRTC_BASE_MESSAGEHANDLER_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
@ -54,8 +56,8 @@ class FunctorMessageHandler<class rtc::scoped_ptr<ReturnT>, FunctorT>
|
||||
: public MessageHandler {
|
||||
public:
|
||||
explicit FunctorMessageHandler(const FunctorT& functor) : functor_(functor) {}
|
||||
virtual void OnMessage(Message* msg) { result_ = functor_().Pass(); }
|
||||
rtc::scoped_ptr<ReturnT> result() { return result_.Pass(); }
|
||||
virtual void OnMessage(Message* msg) { result_ = std::move(functor_()); }
|
||||
rtc::scoped_ptr<ReturnT> result() { return std::move(result_); }
|
||||
|
||||
private:
|
||||
FunctorT functor_;
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/fakesslidentity.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
@ -76,7 +78,7 @@ class RTCCertificateTest : public testing::Test {
|
||||
params.key_params = KeyParams::ECDSA();
|
||||
|
||||
scoped_ptr<SSLIdentity> identity(SSLIdentity::GenerateForTest(params));
|
||||
return RTCCertificate::Create(identity.Pass());
|
||||
return RTCCertificate::Create(std::move(identity));
|
||||
}
|
||||
};
|
||||
|
||||
@ -86,7 +88,7 @@ TEST_F(RTCCertificateTest, NewCertificateNotExpired) {
|
||||
scoped_ptr<SSLIdentity> identity(
|
||||
SSLIdentity::Generate(kTestCertCommonName, KeyParams::ECDSA()));
|
||||
scoped_refptr<RTCCertificate> certificate =
|
||||
RTCCertificate::Create(identity.Pass());
|
||||
RTCCertificate::Create(std::move(identity));
|
||||
|
||||
uint64_t now = NowSeconds();
|
||||
EXPECT_FALSE(HasExpiredSeconds(certificate, now));
|
||||
|
||||
@ -42,55 +42,39 @@
|
||||
// }
|
||||
//
|
||||
// These scopers also implement part of the functionality of C++11 unique_ptr
|
||||
// in that they are "movable but not copyable." You can use the scopers in
|
||||
// the parameter and return types of functions to signify ownership transfer
|
||||
// in to and out of a function. When calling a function that has a scoper
|
||||
// as the argument type, it must be called with the result of an analogous
|
||||
// scoper's Pass() function or another function that generates a temporary;
|
||||
// passing by copy will NOT work. Here is an example using scoped_ptr:
|
||||
// in that they are "movable but not copyable." You can use the scopers in the
|
||||
// parameter and return types of functions to signify ownership transfer in to
|
||||
// and out of a function. When calling a function that has a scoper as the
|
||||
// argument type, it must be called with the result of calling std::move on an
|
||||
// analogous scoper, or another function that generates a temporary; passing by
|
||||
// copy will NOT work. Here is an example using scoped_ptr:
|
||||
//
|
||||
// void TakesOwnership(scoped_ptr<Foo> arg) {
|
||||
// // Do something with arg
|
||||
// }
|
||||
// scoped_ptr<Foo> CreateFoo() {
|
||||
// // No need for calling Pass() because we are constructing a temporary
|
||||
// // No need for calling std::move because we are constructing a temporary
|
||||
// // for the return value.
|
||||
// return scoped_ptr<Foo>(new Foo("new"));
|
||||
// }
|
||||
// scoped_ptr<Foo> PassThru(scoped_ptr<Foo> arg) {
|
||||
// return arg.Pass();
|
||||
// return std::move(arg);
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// scoped_ptr<Foo> ptr(new Foo("yay")); // ptr manages Foo("yay").
|
||||
// TakesOwnership(ptr.Pass()); // ptr no longer owns Foo("yay").
|
||||
// TakesOwnership(std::move(ptr)); // ptr no longer owns Foo("yay").
|
||||
// scoped_ptr<Foo> ptr2 = CreateFoo(); // ptr2 owns the return Foo.
|
||||
// scoped_ptr<Foo> ptr3 = // ptr3 now owns what was in ptr2.
|
||||
// PassThru(ptr2.Pass()); // ptr2 is correspondingly nullptr.
|
||||
// PassThru(std::move(ptr2)); // ptr2 is correspondingly nullptr.
|
||||
// }
|
||||
//
|
||||
// Notice that if you do not call Pass() when returning from PassThru(), or
|
||||
// Notice that if you do not call std::move when returning from PassThru(), or
|
||||
// when invoking TakesOwnership(), the code will not compile because scopers
|
||||
// are not copyable; they only implement move semantics which require calling
|
||||
// the Pass() function to signify a destructive transfer of state. CreateFoo()
|
||||
// is different though because we are constructing a temporary on the return
|
||||
// line and thus can avoid needing to call Pass().
|
||||
//
|
||||
// Pass() properly handles upcast in initialization, i.e. you can use a
|
||||
// scoped_ptr<Child> to initialize a scoped_ptr<Parent>:
|
||||
//
|
||||
// scoped_ptr<Foo> foo(new Foo());
|
||||
// scoped_ptr<FooParent> parent(foo.Pass());
|
||||
//
|
||||
// PassAs<>() should be used to upcast return value in return statement:
|
||||
//
|
||||
// scoped_ptr<Foo> CreateFoo() {
|
||||
// scoped_ptr<FooChild> result(new FooChild());
|
||||
// return result.PassAs<Foo>();
|
||||
// }
|
||||
//
|
||||
// Note that PassAs<>() is implemented only for scoped_ptr<T>, but not for
|
||||
// scoped_ptr<T[]>. This is because casting array pointers may not be safe.
|
||||
// std::move to signify a destructive transfer of state. CreateFoo() is
|
||||
// different though because we are constructing a temporary on the return line
|
||||
// and thus can avoid needing to call std::move.
|
||||
|
||||
#ifndef WEBRTC_BASE_SCOPED_PTR_H__
|
||||
#define WEBRTC_BASE_SCOPED_PTR_H__
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "webrtc/common_audio/audio_converter.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/safe_conversions.h"
|
||||
@ -105,7 +106,7 @@ class ResampleConverter : public AudioConverter {
|
||||
class CompositionConverter : public AudioConverter {
|
||||
public:
|
||||
CompositionConverter(ScopedVector<AudioConverter> converters)
|
||||
: converters_(converters.Pass()) {
|
||||
: converters_(std::move(converters)) {
|
||||
RTC_CHECK_GE(converters_.size(), 2u);
|
||||
// We need an intermediate buffer after every converter.
|
||||
for (auto it = converters_.begin(); it != converters_.end() - 1; ++it)
|
||||
@ -147,7 +148,7 @@ rtc::scoped_ptr<AudioConverter> AudioConverter::Create(int src_channels,
|
||||
dst_channels, src_frames));
|
||||
converters.push_back(new ResampleConverter(dst_channels, src_frames,
|
||||
dst_channels, dst_frames));
|
||||
sp.reset(new CompositionConverter(converters.Pass()));
|
||||
sp.reset(new CompositionConverter(std::move(converters)));
|
||||
} else {
|
||||
sp.reset(new DownmixConverter(src_channels, src_frames, dst_channels,
|
||||
dst_frames));
|
||||
@ -159,7 +160,7 @@ rtc::scoped_ptr<AudioConverter> AudioConverter::Create(int src_channels,
|
||||
src_channels, dst_frames));
|
||||
converters.push_back(new UpmixConverter(src_channels, dst_frames,
|
||||
dst_channels, dst_frames));
|
||||
sp.reset(new CompositionConverter(converters.Pass()));
|
||||
sp.reset(new CompositionConverter(std::move(converters)));
|
||||
} else {
|
||||
sp.reset(new UpmixConverter(src_channels, src_frames, dst_channels,
|
||||
dst_frames));
|
||||
@ -172,7 +173,7 @@ rtc::scoped_ptr<AudioConverter> AudioConverter::Create(int src_channels,
|
||||
dst_frames));
|
||||
}
|
||||
|
||||
return sp.Pass();
|
||||
return sp;
|
||||
}
|
||||
|
||||
// For CompositionConverter.
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
|
||||
@ -235,7 +237,7 @@ AudioEncoder* RentACodec::RentEncoder(const CodecInst& codec_inst) {
|
||||
CreateEncoder(codec_inst, &isac_bandwidth_info_);
|
||||
if (!enc)
|
||||
return nullptr;
|
||||
speech_encoder_ = enc.Pass();
|
||||
speech_encoder_ = std::move(enc);
|
||||
return speech_encoder_.get();
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/audio_device/android/audio_manager.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "webrtc/base/arraysize.h"
|
||||
@ -29,15 +31,16 @@ namespace webrtc {
|
||||
|
||||
// AudioManager::JavaAudioManager implementation
|
||||
AudioManager::JavaAudioManager::JavaAudioManager(
|
||||
NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_manager)
|
||||
: audio_manager_(audio_manager.Pass()),
|
||||
NativeRegistration* native_reg,
|
||||
rtc::scoped_ptr<GlobalRef> audio_manager)
|
||||
: audio_manager_(std::move(audio_manager)),
|
||||
init_(native_reg->GetMethodId("init", "()Z")),
|
||||
dispose_(native_reg->GetMethodId("dispose", "()V")),
|
||||
is_communication_mode_enabled_(
|
||||
native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")),
|
||||
is_device_blacklisted_for_open_sles_usage_(
|
||||
native_reg->GetMethodId(
|
||||
"isDeviceBlacklistedForOpenSLESUsage", "()Z")) {
|
||||
native_reg->GetMethodId("isDeviceBlacklistedForOpenSLESUsage",
|
||||
"()Z")) {
|
||||
ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/audio_device/android/audio_record_jni.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "webrtc/base/arraysize.h"
|
||||
@ -28,18 +30,15 @@ namespace webrtc {
|
||||
|
||||
// AudioRecordJni::JavaAudioRecord implementation.
|
||||
AudioRecordJni::JavaAudioRecord::JavaAudioRecord(
|
||||
NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_record)
|
||||
: audio_record_(audio_record.Pass()),
|
||||
NativeRegistration* native_reg,
|
||||
rtc::scoped_ptr<GlobalRef> audio_record)
|
||||
: audio_record_(std::move(audio_record)),
|
||||
init_recording_(native_reg->GetMethodId("initRecording", "(II)I")),
|
||||
start_recording_(native_reg->GetMethodId("startRecording", "()Z")),
|
||||
stop_recording_(native_reg->GetMethodId("stopRecording", "()Z")),
|
||||
enable_built_in_aec_(native_reg->GetMethodId(
|
||||
"enableBuiltInAEC", "(Z)Z")),
|
||||
enable_built_in_agc_(native_reg->GetMethodId(
|
||||
"enableBuiltInAGC", "(Z)Z")),
|
||||
enable_built_in_ns_(native_reg->GetMethodId(
|
||||
"enableBuiltInNS", "(Z)Z")) {
|
||||
}
|
||||
enable_built_in_aec_(native_reg->GetMethodId("enableBuiltInAEC", "(Z)Z")),
|
||||
enable_built_in_agc_(native_reg->GetMethodId("enableBuiltInAGC", "(Z)Z")),
|
||||
enable_built_in_ns_(native_reg->GetMethodId("enableBuiltInNS", "(Z)Z")) {}
|
||||
|
||||
AudioRecordJni::JavaAudioRecord::~JavaAudioRecord() {}
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "webrtc/modules/audio_device/android/audio_manager.h"
|
||||
#include "webrtc/modules/audio_device/android/audio_track_jni.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "webrtc/base/arraysize.h"
|
||||
@ -28,16 +30,16 @@ namespace webrtc {
|
||||
|
||||
// AudioTrackJni::JavaAudioTrack implementation.
|
||||
AudioTrackJni::JavaAudioTrack::JavaAudioTrack(
|
||||
NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_track)
|
||||
: audio_track_(audio_track.Pass()),
|
||||
NativeRegistration* native_reg,
|
||||
rtc::scoped_ptr<GlobalRef> audio_track)
|
||||
: audio_track_(std::move(audio_track)),
|
||||
init_playout_(native_reg->GetMethodId("initPlayout", "(II)V")),
|
||||
start_playout_(native_reg->GetMethodId("startPlayout", "()Z")),
|
||||
stop_playout_(native_reg->GetMethodId("stopPlayout", "()Z")),
|
||||
set_stream_volume_(native_reg->GetMethodId("setStreamVolume", "(I)Z")),
|
||||
get_stream_max_volume_(native_reg->GetMethodId(
|
||||
"getStreamMaxVolume", "()I")),
|
||||
get_stream_volume_(native_reg->GetMethodId("getStreamVolume", "()I")) {
|
||||
}
|
||||
get_stream_max_volume_(
|
||||
native_reg->GetMethodId("getStreamMaxVolume", "()I")),
|
||||
get_stream_volume_(native_reg->GetMethodId("getStreamVolume", "()I")) {}
|
||||
|
||||
AudioTrackJni::JavaAudioTrack::~JavaAudioTrack() {}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "webrtc/modules/audio_processing/test/audio_file_processor.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/modules/audio_processing/test/protobuf_utils.h"
|
||||
@ -43,13 +44,13 @@ ChannelBuffer<float> GetChannelBuffer(const WavFile& file) {
|
||||
WavFileProcessor::WavFileProcessor(scoped_ptr<AudioProcessing> ap,
|
||||
scoped_ptr<WavReader> in_file,
|
||||
scoped_ptr<WavWriter> out_file)
|
||||
: ap_(ap.Pass()),
|
||||
: ap_(std::move(ap)),
|
||||
in_buf_(GetChannelBuffer(*in_file)),
|
||||
out_buf_(GetChannelBuffer(*out_file)),
|
||||
input_config_(GetStreamConfig(*in_file)),
|
||||
output_config_(GetStreamConfig(*out_file)),
|
||||
buffer_reader_(in_file.Pass()),
|
||||
buffer_writer_(out_file.Pass()) {}
|
||||
buffer_reader_(std::move(in_file)),
|
||||
buffer_writer_(std::move(out_file)) {}
|
||||
|
||||
bool WavFileProcessor::ProcessChunk() {
|
||||
if (!buffer_reader_.Read(&in_buf_)) {
|
||||
@ -68,11 +69,11 @@ bool WavFileProcessor::ProcessChunk() {
|
||||
AecDumpFileProcessor::AecDumpFileProcessor(scoped_ptr<AudioProcessing> ap,
|
||||
FILE* dump_file,
|
||||
scoped_ptr<WavWriter> out_file)
|
||||
: ap_(ap.Pass()),
|
||||
: ap_(std::move(ap)),
|
||||
dump_file_(dump_file),
|
||||
out_buf_(GetChannelBuffer(*out_file)),
|
||||
output_config_(GetStreamConfig(*out_file)),
|
||||
buffer_writer_(out_file.Pass()) {
|
||||
buffer_writer_(std::move(out_file)) {
|
||||
RTC_CHECK(dump_file_) << "Could not open dump file for reading.";
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
@ -122,12 +123,12 @@ int main(int argc, char* argv[]) {
|
||||
if (FLAGS_dump.empty()) {
|
||||
auto in_file = rtc_make_scoped_ptr(new WavReader(FLAGS_i));
|
||||
std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl;
|
||||
processor.reset(
|
||||
new WavFileProcessor(ap.Pass(), in_file.Pass(), out_file.Pass()));
|
||||
processor.reset(new WavFileProcessor(std::move(ap), std::move(in_file),
|
||||
std::move(out_file)));
|
||||
|
||||
} else {
|
||||
processor.reset(new AecDumpFileProcessor(
|
||||
ap.Pass(), fopen(FLAGS_dump.c_str(), "rb"), out_file.Pass()));
|
||||
std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file)));
|
||||
}
|
||||
|
||||
int num_chunks = 0;
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/modules/audio_processing/test/test_utils.h"
|
||||
|
||||
@ -32,7 +34,7 @@ void RawFile::WriteSamples(const float* samples, size_t num_samples) {
|
||||
}
|
||||
|
||||
ChannelBufferWavReader::ChannelBufferWavReader(rtc::scoped_ptr<WavReader> file)
|
||||
: file_(file.Pass()) {}
|
||||
: file_(std::move(file)) {}
|
||||
|
||||
bool ChannelBufferWavReader::Read(ChannelBuffer<float>* buffer) {
|
||||
RTC_CHECK_EQ(file_->num_channels(), buffer->num_channels());
|
||||
@ -49,7 +51,7 @@ bool ChannelBufferWavReader::Read(ChannelBuffer<float>* buffer) {
|
||||
}
|
||||
|
||||
ChannelBufferWavWriter::ChannelBufferWavWriter(rtc::scoped_ptr<WavWriter> file)
|
||||
: file_(file.Pass()) {}
|
||||
: file_(std::move(file)) {}
|
||||
|
||||
void ChannelBufferWavWriter::Write(const ChannelBuffer<float>& buffer) {
|
||||
RTC_CHECK_EQ(file_->num_channels(), buffer.num_channels());
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.h"
|
||||
#include "webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.h"
|
||||
@ -22,7 +24,7 @@ ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
|
||||
new ScreenCapturerWinGdi(options));
|
||||
|
||||
if (options.allow_use_magnification_api())
|
||||
return new ScreenCapturerWinMagnifier(gdi_capturer.Pass());
|
||||
return new ScreenCapturerWinMagnifier(std::move(gdi_capturer));
|
||||
|
||||
return gdi_capturer.release();
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame_win.h"
|
||||
@ -37,7 +39,7 @@ Atomic32 ScreenCapturerWinMagnifier::tls_index_(TLS_OUT_OF_INDEXES);
|
||||
|
||||
ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier(
|
||||
rtc::scoped_ptr<ScreenCapturer> fallback_capturer)
|
||||
: fallback_capturer_(fallback_capturer.Pass()),
|
||||
: fallback_capturer_(std::move(fallback_capturer)),
|
||||
fallback_capturer_started_(false),
|
||||
callback_(NULL),
|
||||
current_screen_id_(kFullDesktopScreenId),
|
||||
@ -53,8 +55,7 @@ ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier(
|
||||
host_window_(NULL),
|
||||
magnifier_window_(NULL),
|
||||
magnifier_initialized_(false),
|
||||
magnifier_capture_succeeded_(true) {
|
||||
}
|
||||
magnifier_capture_succeeded_(true) {}
|
||||
|
||||
ScreenCapturerWinMagnifier::~ScreenCapturerWinMagnifier() {
|
||||
// DestroyWindow must be called before MagUninitialize. magnifier_window_ is
|
||||
|
||||
@ -29,7 +29,7 @@ const uint32_t kSenderSsrc = 0x12345678;
|
||||
|
||||
class RtcpPacketAppTest : public ::testing::Test {
|
||||
protected:
|
||||
void BuildPacket() { packet = app.Build().Pass(); }
|
||||
void BuildPacket() { packet = app.Build(); }
|
||||
void ParsePacket() {
|
||||
RtcpCommonHeader header;
|
||||
EXPECT_TRUE(
|
||||
|
||||
@ -30,7 +30,7 @@ const uint32_t kCsrc2 = 0x33343536;
|
||||
|
||||
class RtcpPacketByeTest : public ::testing::Test {
|
||||
protected:
|
||||
void BuildPacket() { packet = bye.Build().Pass(); }
|
||||
void BuildPacket() { packet = bye.Build(); }
|
||||
void ParsePacket() {
|
||||
RtcpCommonHeader header;
|
||||
EXPECT_TRUE(
|
||||
|
||||
@ -25,7 +25,7 @@ namespace {
|
||||
|
||||
class RtcpPacketExtendedJitterReportTest : public ::testing::Test {
|
||||
protected:
|
||||
void BuildPacket() { packet = ij.Build().Pass(); }
|
||||
void BuildPacket() { packet = ij.Build(); }
|
||||
void ParsePacket() {
|
||||
RtcpCommonHeader header;
|
||||
EXPECT_TRUE(
|
||||
|
||||
@ -39,7 +39,7 @@ const size_t kPacketLength = sizeof(kPacket);
|
||||
|
||||
class RtcpPacketReceiverReportTest : public ::testing::Test {
|
||||
protected:
|
||||
void BuildPacket() { packet = rr.Build().Pass(); }
|
||||
void BuildPacket() { packet = rr.Build(); }
|
||||
void ParsePacket() {
|
||||
RtcpCommonHeader header;
|
||||
EXPECT_TRUE(
|
||||
|
||||
@ -38,8 +38,7 @@ ProcessThread::~ProcessThread() {}
|
||||
// static
|
||||
rtc::scoped_ptr<ProcessThread> ProcessThread::Create(
|
||||
const char* thread_name) {
|
||||
return rtc::scoped_ptr<ProcessThread>(new ProcessThreadImpl(thread_name))
|
||||
.Pass();
|
||||
return rtc::scoped_ptr<ProcessThread>(new ProcessThreadImpl(thread_name));
|
||||
}
|
||||
|
||||
ProcessThreadImpl::ProcessThreadImpl(const char* thread_name)
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/modules/include/module.h"
|
||||
@ -295,7 +297,7 @@ TEST(ProcessThreadImpl, PostTask) {
|
||||
rtc::scoped_ptr<EventWrapper> task_ran(EventWrapper::Create());
|
||||
rtc::scoped_ptr<RaiseEventTask> task(new RaiseEventTask(task_ran.get()));
|
||||
thread.Start();
|
||||
thread.PostTask(task.Pass());
|
||||
thread.PostTask(std::move(task));
|
||||
EXPECT_EQ(kEventSignaled, task_ran->Wait(100));
|
||||
thread.Stop();
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
|
||||
: clock_(clock),
|
||||
running_(false),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
frame_event_(event.Pass()),
|
||||
frame_event_(std::move(event)),
|
||||
max_number_of_frames_(kStartNumberOfFrames),
|
||||
free_frames_(),
|
||||
decodable_frames_(),
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
@ -40,9 +41,9 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||
rtc::scoped_ptr<EventWrapper> jitter_buffer_event)
|
||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
clock_(clock),
|
||||
jitter_buffer_(clock_, jitter_buffer_event.Pass()),
|
||||
jitter_buffer_(clock_, std::move(jitter_buffer_event)),
|
||||
timing_(timing),
|
||||
render_wait_event_(receiver_event.Pass()),
|
||||
render_wait_event_(std::move(receiver_event)),
|
||||
max_video_delay_ms_(kMaxVideoDelayMs) {
|
||||
Reset();
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/p2p/base/dtlstransportchannel.h"
|
||||
|
||||
#include "webrtc/p2p/base/common.h"
|
||||
@ -224,7 +226,7 @@ bool DtlsTransportChannelWrapper::SetRemoteFingerprint(
|
||||
}
|
||||
|
||||
// At this point we know we are doing DTLS
|
||||
remote_fingerprint_value_ = remote_fingerprint_value.Pass();
|
||||
remote_fingerprint_value_ = std::move(remote_fingerprint_value);
|
||||
remote_fingerprint_algorithm_ = digest_alg;
|
||||
|
||||
bool reconnect = dtls_;
|
||||
|
||||
@ -53,9 +53,9 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
received_dtls_client_hello_(false),
|
||||
received_dtls_server_hello_(false) {}
|
||||
void CreateCertificate(rtc::KeyType key_type) {
|
||||
certificate_ = rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate(name_, key_type)).Pass());
|
||||
certificate_ =
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate(name_, key_type)));
|
||||
}
|
||||
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() {
|
||||
return certificate_;
|
||||
|
||||
@ -268,15 +268,11 @@ TEST_F(TransportControllerTest, TestGetSslRole) {
|
||||
|
||||
TEST_F(TransportControllerTest, TestSetAndGetLocalCertificate) {
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> certificate1 =
|
||||
rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT))
|
||||
.Pass());
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)));
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> certificate2 =
|
||||
rtc::RTCCertificate::Create(
|
||||
rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT))
|
||||
.Pass());
|
||||
rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>(
|
||||
rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)));
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> returned_certificate;
|
||||
|
||||
FakeTransportChannel* channel1 = CreateChannel("audio", 1);
|
||||
|
||||
@ -26,11 +26,10 @@ using cricket::TransportOptions;
|
||||
class TransportDescriptionFactoryTest : public testing::Test {
|
||||
public:
|
||||
TransportDescriptionFactoryTest()
|
||||
: cert1_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>(
|
||||
new rtc::FakeSSLIdentity("User1")).Pass())),
|
||||
cert2_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>(
|
||||
new rtc::FakeSSLIdentity("User2")).Pass())) {
|
||||
}
|
||||
: cert1_(rtc::RTCCertificate::Create(
|
||||
scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("User1")))),
|
||||
cert2_(rtc::RTCCertificate::Create(
|
||||
scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("User2")))) {}
|
||||
|
||||
void CheckDesc(const TransportDescription* desc,
|
||||
const std::string& opt, const std::string& ice_ufrag,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user