diff --git a/third_party_mods/libjingle/libjingle.gyp b/third_party_mods/libjingle/libjingle.gyp index 3ad05d9831..f92f6eb4dc 100644 --- a/third_party_mods/libjingle/libjingle.gyp +++ b/third_party_mods/libjingle/libjingle.gyp @@ -632,10 +632,12 @@ } ], # inside_chromium_build ['peer_connection_dev==1', { 'sources': [ + '<(libjingle_mods)/source/talk/base/refcount.h', + '<(libjingle_mods)/source/talk/base/scoped_refptr.h', '<(libjingle_mods)/source/talk/p2p/client/fakeportallocator.h', '<(libjingle_mods)/source/talk/session/phone/channel.cc', '<(libjingle_mods)/source/talk/session/phone/channel.h', - '<(libjingle_mods)/source/talk/session/phone/mediasession.cc', + '<(libjingle_mods)/source/talk/session/phone/mediasession.cc', ], },{ 'sources': [ @@ -716,7 +718,7 @@ '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmessage.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionsignaling.cc', '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionsignaling.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/refcount.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/sessiondescriptionprovider.h' '<(libjingle_mods)/source/talk/app/webrtc_dev/streamcollectionimpl.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/videorendererimpl.cc', diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc index e87fc1bd33..d2a3d0f6cd 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc @@ -56,16 +56,16 @@ std::string AudioTrack::kind() const { talk_base::scoped_refptr AudioTrack::CreateRemote( const std::string& label, uint32 ssrc) { - talk_base::RefCount* track = - new talk_base::RefCount(label, ssrc); + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, ssrc); return track; } talk_base::scoped_refptr AudioTrack::CreateLocal( const std::string& label, AudioDeviceModule* audio_device) { - talk_base::RefCount* track = - new talk_base::RefCount(label, audio_device); + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, audio_device); return track; } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h index 6c5f545ed9..37a97c854a 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h @@ -31,7 +31,7 @@ #include "talk/app/webrtc_dev/mediastream.h" #include "talk/app/webrtc_dev/mediatrackimpl.h" #include "talk/app/webrtc_dev/notifierimpl.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/scoped_refptr.h" #ifdef WEBRTC_RELATIVE_PATH #include "modules/audio_device/main/interface/audio_device.h" diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h index 94995f97c4..06f908a90d 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h @@ -36,9 +36,9 @@ #include -#include "talk/app/webrtc_dev/refcount.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" #include "talk/base/basictypes.h" +#include "talk/base/refcount.h" +#include "talk/base/scoped_refptr.h" namespace cricket { class VideoRenderer; diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream_unittest.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream_unittest.cc index e6e9740c45..a3c18ae2fd 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream_unittest.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream_unittest.cc @@ -31,7 +31,7 @@ #include "gtest/gtest.h" #include "talk/app/webrtc_dev/mediastreamproxy.h" #include "talk/app/webrtc_dev/mediastreamtrackproxy.h" -#include "talk/app/webrtc_dev/refcount.h" +#include "talk/base/refcount.h" #include "talk/base/scoped_ptr.h" #include "talk/base/thread.h" @@ -253,7 +253,7 @@ class MediaStreamTest: public testing::Test, // Create a stream proxy object that uses our mocked // version of a LocalMediaStream. scoped_refptr mock_stream( - new talk_base::RefCount(label, + new talk_base::RefCountedObject(label, signaling_thread_.get())); stream_ = MediaStreamProxy::Create(label, signaling_thread_.get(), mock_stream); @@ -266,7 +266,7 @@ class MediaStreamTest: public testing::Test, scoped_refptr video_track_impl( VideoTrack::CreateLocal(kVideoTrackLabel, NULL)); scoped_refptr mock_videotrack( - new talk_base::RefCount(video_track_impl, + new talk_base::RefCountedObject(video_track_impl, signaling_thread_.get())); video_track_ = VideoTrackProxy::CreateLocal(mock_videotrack, signaling_thread_.get()); @@ -280,7 +280,7 @@ class MediaStreamTest: public testing::Test, scoped_refptr audio_track_impl( AudioTrack::CreateLocal(kAudioTrackLabel, NULL)); scoped_refptr mock_audiotrack( - new talk_base::RefCount(audio_track_impl, + new talk_base::RefCountedObject(audio_track_impl, signaling_thread_.get())); audio_track_ = AudioTrackProxy::CreateLocal(mock_audiotrack, signaling_thread_.get()); diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamhandler.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamhandler.cc index 99cdde7372..fd68a7c639 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamhandler.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamhandler.cc @@ -27,8 +27,6 @@ #include "talk/app/webrtc_dev/mediastreamhandler.h" -#include "talk/app/webrtc_dev/scoped_refptr_msg.h" - #ifdef WEBRTC_RELATIVE_PATH #include "modules/video_capture/main/interface/video_capture.h" #else diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc index ee2293974f..f6d30a75ab 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc @@ -32,8 +32,8 @@ namespace webrtc { talk_base::scoped_refptr MediaStream::Create( const std::string& label) { - talk_base::RefCount* stream = - new talk_base::RefCount(label); + talk_base::RefCountedObject* stream = + new talk_base::RefCountedObject(label); return stream; } @@ -41,10 +41,10 @@ MediaStream::MediaStream(const std::string& label) : label_(label), ready_state_(MediaStreamInterface::kInitializing), audio_track_list_( - new talk_base::RefCount< + new talk_base::RefCountedObject< MediaStreamTrackList >()), video_track_list_( - new talk_base::RefCount< + new talk_base::RefCountedObject< MediaStreamTrackList >()) { } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamproxy.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamproxy.cc index f49cd26c53..dfb1c9a203 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamproxy.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamproxy.cc @@ -26,8 +26,8 @@ */ #include "talk/app/webrtc_dev/mediastreamproxy.h" -#include "talk/app/webrtc_dev/refcount.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/refcount.h" +#include "talk/base/scoped_refptr.h" namespace { @@ -92,8 +92,8 @@ talk_base::scoped_refptr MediaStreamProxy::Create( const std::string& label, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* stream = - new talk_base::RefCount( + talk_base::RefCountedObject* stream = + new talk_base::RefCountedObject( label, signaling_thread, reinterpret_cast(NULL)); return stream; @@ -105,8 +105,8 @@ talk_base::scoped_refptr MediaStreamProxy::Create( LocalMediaStreamInterface* media_stream_impl) { ASSERT(signaling_thread); ASSERT(media_stream_impl); - talk_base::RefCount* stream = - new talk_base::RefCount(label, signaling_thread, + talk_base::RefCountedObject* stream = + new talk_base::RefCountedObject(label, signaling_thread, media_stream_impl); return stream; } @@ -116,10 +116,10 @@ MediaStreamProxy::MediaStreamProxy(const std::string& label, LocalMediaStreamInterface* media_stream_impl) : signaling_thread_(signaling_thread), media_stream_impl_(media_stream_impl), - audio_tracks_(new talk_base::RefCount< + audio_tracks_(new talk_base::RefCountedObject< MediaStreamTrackListProxy >( signaling_thread_)), - video_tracks_(new talk_base::RefCount< + video_tracks_(new talk_base::RefCountedObject< MediaStreamTrackListProxy >( signaling_thread_)) { if (media_stream_impl_ == NULL) { diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamtrackproxy.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamtrackproxy.cc index 30764d8788..f81ce52c39 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamtrackproxy.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamtrackproxy.cc @@ -26,7 +26,6 @@ */ #include "talk/app/webrtc_dev/mediastreamtrackproxy.h" -#include "talk/app/webrtc_dev/scoped_refptr_msg.h" namespace { @@ -266,8 +265,8 @@ talk_base::scoped_refptr AudioTrackProxy::CreateRemote( uint32 ssrc, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(label, ssrc, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, ssrc, signaling_thread); return track; } @@ -277,8 +276,8 @@ talk_base::scoped_refptr AudioTrackProxy::CreateLocal( AudioDeviceModule* audio_device, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(label, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, audio_device, signaling_thread); return track; @@ -288,8 +287,8 @@ talk_base::scoped_refptr AudioTrackProxy::CreateLocal( LocalAudioTrackInterface* implementation, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(implementation, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(implementation, signaling_thread); return track; } @@ -343,8 +342,8 @@ talk_base::scoped_refptr VideoTrackProxy::CreateRemote( uint32 ssrc, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(label, ssrc, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, ssrc, signaling_thread); return track; } @@ -354,8 +353,8 @@ talk_base::scoped_refptr VideoTrackProxy::CreateLocal( VideoCaptureModule* video_device, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(label, video_device, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, video_device, signaling_thread); return track; } @@ -364,8 +363,8 @@ talk_base::scoped_refptr VideoTrackProxy::CreateLocal( LocalVideoTrackInterface* implementation, talk_base::Thread* signaling_thread) { ASSERT(signaling_thread); - talk_base::RefCount* track = - new talk_base::RefCount(implementation, + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(implementation, signaling_thread); return track; } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_client_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_client_dev.cc deleted file mode 100644 index c359217332..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_client_dev.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * libjingle - * Copyright 2004--2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc/peerconnectionmanager.h" -#include "talk/base/logging.h" -#include "talk/p2p/client/basicportallocator.h" - -int main() { - LOG(INFO) << "Create PeerConnectionManager."; - - talk_base::scoped_ptr port_allocator_; - talk_base::scoped_ptr worker_thread_; - - port_allocator_.reset(new cricket::BasicPortAllocator( - new talk_base::BasicNetworkManager(), - talk_base::SocketAddress("stun.l.google.com", 19302), - talk_base::SocketAddress(), - talk_base::SocketAddress(), talk_base::SocketAddress())); - - worker_thread_.reset(new talk_base::Thread()); - if (!worker_thread_->SetName("workder thread", NULL) || - !worker_thread_->Start()) { - LOG(WARNING) << "Failed to start libjingle workder thread"; - } - - webrtc::PeerConnectionManager* peerconnection_manager = - webrtc::PeerConnectionManager::Create(port_allocator_.get(), - worker_thread_.get()); - return 0; -} diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc index b291130f5c..1fbe6994c4 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc @@ -30,7 +30,6 @@ #include #include "talk/app/webrtc_dev/mediastreamhandler.h" -#include "talk/app/webrtc_dev/scoped_refptr_msg.h" #include "talk/app/webrtc_dev/streamcollectionimpl.h" #include "talk/base/logging.h" #include "talk/session/phone/channelmanager.h" @@ -117,6 +116,12 @@ struct SignalingParams : public talk_base::MessageData { talk_base::scoped_refptr local_streams; }; +struct StreamCollectionParams : public talk_base::MessageData { + explicit StreamCollectionParams(webrtc::StreamCollectionInterface* streams) + : streams(streams) {} + talk_base::scoped_refptr streams; +}; + } // namespace namespace webrtc { @@ -206,10 +211,9 @@ PeerConnectionImpl::local_streams() { talk_base::scoped_refptr PeerConnectionImpl::remote_streams() { - ScopedRefMessageData* msg = - new ScopedRefMessageData(NULL); - signaling_thread_->Send(this, MSG_RETURNREMOTEMEDIASTREAMS, msg); - return msg->data(); + StreamCollectionParams msg(NULL); + signaling_thread_->Send(this, MSG_RETURNREMOTEMEDIASTREAMS, &msg); + return msg.streams; } bool PeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) { @@ -228,9 +232,8 @@ void PeerConnectionImpl::RemoveStream( } void PeerConnectionImpl::CommitStreamChanges() { - ScopedRefMessageData* msg = - new ScopedRefMessageData ( - StreamCollectionImpl::Create(local_media_streams_)); + StreamCollectionParams* msg(new StreamCollectionParams( + StreamCollectionImpl::Create(local_media_streams_))); signaling_thread_->Post(this, MSG_COMMITSTREAMCHANGES, msg); } @@ -238,10 +241,10 @@ void PeerConnectionImpl::OnMessage(talk_base::Message* msg) { talk_base::MessageData* data = msg->pdata; switch (msg->message_id) { case MSG_COMMITSTREAMCHANGES: { - ScopedRefMessageData* param( - static_cast*> (data)); - signaling_->CreateOffer(param->data()); - stream_handler_->CommitLocalStreams(param->data()); + StreamCollectionParams* param( + static_cast (data)); + signaling_->CreateOffer(param->streams); + stream_handler_->CommitLocalStreams(param->streams); delete data; // Because it is Posted. break; } @@ -252,9 +255,9 @@ void PeerConnectionImpl::OnMessage(talk_base::Message* msg) { break; } case MSG_RETURNREMOTEMEDIASTREAMS: { - ScopedRefMessageData* param( - static_cast*> (data)); - param->data() = StreamCollectionImpl::Create(remote_media_streams_); + StreamCollectionParams* param( + static_cast (data)); + param->streams = StreamCollectionImpl::Create(remote_media_streams_); break; } case MSG_TERMINATE: { diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc index 080c1bca21..77c464fc1c 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc @@ -66,8 +66,8 @@ namespace webrtc { talk_base::scoped_refptr PcNetworkManager::Create( talk_base::NetworkManager* network_manager) { - talk_base::RefCount* implementation = - new talk_base::RefCount(network_manager); + talk_base::RefCountedObject* implementation = + new talk_base::RefCountedObject(network_manager); return implementation; } @@ -85,8 +85,8 @@ PcNetworkManager::~PcNetworkManager() { talk_base::scoped_refptr PcPacketSocketFactory::Create( talk_base::PacketSocketFactory* socket_factory) { - talk_base::RefCount* implementation = - new talk_base::RefCount(socket_factory); + talk_base::RefCountedObject* implementation = + new talk_base::RefCountedObject(socket_factory); return implementation; } @@ -105,8 +105,8 @@ talk_base::PacketSocketFactory* PcPacketSocketFactory::socket_factory() const { talk_base::scoped_refptr PeerConnectionManager::Create() { - talk_base::RefCount* pc_manager = - new talk_base::RefCount(); + talk_base::RefCountedObject* pc_manager = + new talk_base::RefCountedObject(); if (!pc_manager->Initialize()) { delete pc_manager; @@ -121,8 +121,8 @@ talk_base::scoped_refptr PeerConnectionManager::Create( PcNetworkManager* network_manager, PcPacketSocketFactory* socket_factory, AudioDeviceModule* default_adm) { - talk_base::RefCount* pc_manager = - new talk_base::RefCount(worker_thread, + talk_base::RefCountedObject* pc_manager = + new talk_base::RefCountedObject(worker_thread, signaling_thread, network_manager, socket_factory, @@ -226,8 +226,8 @@ talk_base::scoped_refptr PeerConnectionManagerImpl::CreatePeerConnection_s( const std::string& configuration, PeerConnectionObserver* observer) { - talk_base::RefCount* pc( - new talk_base::RefCount(channel_manager_.get(), + talk_base::RefCountedObject* pc( + new talk_base::RefCountedObject(channel_manager_.get(), signaling_thread_ptr_, worker_thread_ptr_, network_manager_, diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h index 17bda5bdc0..f5a75873aa 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h @@ -29,9 +29,9 @@ #include -#include "talk/base/scoped_ptr.h" #include "talk/app/webrtc_dev/peerconnection.h" #include "talk/app/webrtc_dev/mediastream.h" +#include "talk/base/scoped_ptr.h" #include "talk/base/thread.h" #include "talk/session/phone/channelmanager.h" diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmessage.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmessage.h index 14b0fd7b06..1d29d85278 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmessage.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmessage.h @@ -34,10 +34,10 @@ #include #include -#include "talk/app/webrtc_dev/refcount.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/refcount.h" #include "talk/base/basictypes.h" #include "talk/base/scoped_ptr.h" +#include "talk/base/scoped_refptr.h" #include "talk/session/phone/mediasession.h" #include "talk/p2p/base/sessiondescription.h" diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionsignaling.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionsignaling.h index 6c27f0edae..0a601b4c37 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionsignaling.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionsignaling.h @@ -40,13 +40,13 @@ #include "talk/app/webrtc_dev/mediastreamproxy.h" #include "talk/app/webrtc_dev/peerconnection.h" #include "talk/app/webrtc_dev/peerconnectionmessage.h" -#include "talk/app/webrtc_dev/refcount.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" #include "talk/app/webrtc_dev/sessiondescriptionprovider.h" #include "talk/app/webrtc_dev/webrtcsessionobserver.h" #include "talk/base/basictypes.h" #include "talk/base/messagehandler.h" +#include "talk/base/refcount.h" #include "talk/base/scoped_ptr.h" +#include "talk/base/scoped_refptr.h" #include "talk/base/thread.h" #include "talk/session/phone/mediasession.h" #include "talk/p2p/base/sessiondescription.h" diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/refcount.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/refcount.h deleted file mode 100644 index 8c27bf0552..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/refcount.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_REF_COUNT_H_ -#define TALK_APP_WEBRTC_REF_COUNT_H_ - -#include - -#include "talk/base/criticalsection.h" - -namespace talk_base { - -// Reference count interface. -class RefCountInterface { - public: - virtual int AddRef() = 0; - virtual int Release() = 0; -}; - -template -class RefCount : public T { - public: - RefCount() : ref_count_(0) { - } - - template - explicit RefCount(P p) : ref_count_(0), T(p) { - } - - template - RefCount(P1 p1, P2 p2) : ref_count_(0), T(p1, p2) { - } - - template - RefCount(P1 p1, P2 p2, P3 p3) : ref_count_(0), T(p1, p2, p3) { - } - - template - RefCount(P1 p1, P2 p2, P3 p3, P4 p4) : ref_count_(0), T(p1, p2, p3, p4) { - } - - template - RefCount(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) - : ref_count_(0), T(p1, p2, p3, p4, p5) { - } - - virtual int AddRef() { - return talk_base::AtomicOps::Increment(&ref_count_); - } - - virtual int Release() { - int count = talk_base::AtomicOps::Decrement(&ref_count_); - if (!count) { - delete this; - } - return count; - } - - protected: - int ref_count_; -}; - -} // namespace talk_base - -#endif // TALK_APP_WEBRTC_REF_COUNT_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr.h deleted file mode 100644 index ce54fd7158..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef TALK_APP_WEBRTC_SCOPED_REFPTR_H_ -#define TALK_APP_WEBRTC_SCOPED_REFPTR_H_ -// Originally these classes are copied from Chromium. - -// -// A smart pointer class for reference counted objects. Use this class instead -// of calling AddRef and Release manually on a reference counted object to -// avoid common memory leaks caused by forgetting to Release an object -// reference. Sample usage: -// -// class MyFoo : public RefCounted { -// ... -// }; -// -// void some_function() { -// scoped_refptr foo = new MyFoo(); -// foo->Method(param); -// // |foo| is released when this function returns -// } -// -// void some_other_function() { -// scoped_refptr foo = new MyFoo(); -// ... -// foo = NULL; // explicitly releases |foo| -// ... -// if (foo) -// foo->Method(param); -// } -// -// The above examples show how scoped_refptr acts like a pointer to T. -// Given two scoped_refptr classes, it is also possible to exchange -// references between the two objects, like so: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b.swap(a); -// // now, |b| references the MyFoo object, and |a| references NULL. -// } -// -// To make both |a| and |b| in the above example reference the same MyFoo -// object, simply use the assignment operator: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b = a; -// // now, |a| and |b| each own a reference to the same MyFoo object. -// } -// -namespace talk_base { - -template -class scoped_refptr { - public: - scoped_refptr() : ptr_(NULL) { - } - - scoped_refptr(T* p) : ptr_(p) { - if (ptr_) - ptr_->AddRef(); - } - - scoped_refptr(const scoped_refptr& r) : ptr_(r.ptr_) { - if (ptr_) - ptr_->AddRef(); - } - - template - scoped_refptr(const scoped_refptr& r) : ptr_(r.get()) { - if (ptr_) - ptr_->AddRef(); - } - - ~scoped_refptr() { - if (ptr_) - ptr_->Release(); - } - - T* get() const { return ptr_; } - operator T*() const { return ptr_; } - T* operator->() const { return ptr_; } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - T* release() { - T* retVal = ptr_; - ptr_ = NULL; - return retVal; - } - - scoped_refptr& operator=(T* p) { - // AddRef first so that self assignment should work - if (p) - p->AddRef(); - if (ptr_ ) - ptr_ ->Release(); - ptr_ = p; - return *this; - } - - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.ptr_; - } - - template - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.get(); - } - - void swap(T** pp) { - T* p = ptr_; - ptr_ = *pp; - *pp = p; - } - - void swap(scoped_refptr& r) { - swap(&r.ptr_); - } - - protected: - T* ptr_; -}; - -} // namespace talk_base - -#endif // TALK_APP_WEBRTC_SCOPED_REFPTR_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr_msg.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr_msg.h deleted file mode 100644 index 8601d65dcf..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/scoped_refptr_msg.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_ -#define TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_ - - -#include "talk/base/messagequeue.h" - -// Like ScopedRefMessageData, but for reference counting pointers. -template -class ScopedRefMessageData : public talk_base::MessageData { - public: - explicit ScopedRefMessageData(T* data) : data_(data) { } - const talk_base::scoped_refptr& data() const { return data_; } - talk_base::scoped_refptr& data() { return data_; } - private: - talk_base::scoped_refptr data_; -}; -/* -struct ScopedTypedMessageData : public talk_base::MessageData { - ScopedRefPtrMsgParams(talk_base::scoped_refptr ptr) - : ptr_(ptr) { - } - talk_base::scoped_refptr ptr_; -};*/ - -#endif // TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h index 18895088fd..4ab9012e60 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h @@ -39,15 +39,15 @@ namespace webrtc { class StreamCollectionImpl : public StreamCollectionInterface { public: static talk_base::scoped_refptr Create() { - talk_base::RefCount* implementation = - new talk_base::RefCount(); + talk_base::RefCountedObject* implementation = + new talk_base::RefCountedObject(); return implementation; } static talk_base::scoped_refptr Create( StreamCollectionImpl* streams) { - talk_base::RefCount* implementation = - new talk_base::RefCount(streams); + talk_base::RefCountedObject* implementation = + new talk_base::RefCountedObject(streams); return implementation; } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc index 96b9a36f18..49e57df87e 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc @@ -50,8 +50,8 @@ class VideoRendererImpl : public VideoRendererWrapperInterface { talk_base::scoped_refptr CreateVideoRenderer( cricket::VideoRenderer* renderer) { - talk_base::RefCount* r = - new talk_base::RefCount(renderer); + talk_base::RefCountedObject* r = + new talk_base::RefCountedObject(renderer); return r; } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc index ee47648160..c7027e18ea 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc @@ -64,16 +64,16 @@ std::string VideoTrack::kind() const { talk_base::scoped_refptr VideoTrack::CreateRemote( const std::string& label, uint32 ssrc) { - talk_base::RefCount* track = - new talk_base::RefCount(label, ssrc); + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, ssrc); return track; } talk_base::scoped_refptr VideoTrack::CreateLocal( const std::string& label, VideoCaptureModule* video_device) { - talk_base::RefCount* track = - new talk_base::RefCount(label, video_device); + talk_base::RefCountedObject* track = + new talk_base::RefCountedObject(label, video_device); return track; } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h index a0cdab2eab..421a003d55 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h @@ -33,7 +33,7 @@ #include "talk/app/webrtc_dev/mediastream.h" #include "talk/app/webrtc_dev/mediatrackimpl.h" #include "talk/app/webrtc_dev/notifierimpl.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/scoped_refptr.h" #ifdef WEBRTC_RELATIVE_PATH #include "modules/video_capture/main/interface/video_capture.h" diff --git a/third_party_mods/libjingle/source/talk/examples/peerconnection_client/linux/main_wnd.h b/third_party_mods/libjingle/source/talk/examples/peerconnection_client/linux/main_wnd.h index 816b6063fd..1a3fb459fe 100644 --- a/third_party_mods/libjingle/source/talk/examples/peerconnection_client/linux/main_wnd.h +++ b/third_party_mods/libjingle/source/talk/examples/peerconnection_client/linux/main_wnd.h @@ -14,7 +14,7 @@ #include "talk/examples/peerconnection_client/main_wnd.h" #include "talk/examples/peerconnection_client/peer_connection_client.h" -#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/scoped_refptr.h" // Forward declarations. typedef struct _GtkWidget GtkWidget;