Backed out changeset f556245d6da1 (bug 856848) for build bustage on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 11 Apr 2013 15:42:37 -0400
changeset 128509 f23121d10690ddc689e6d3b262cc1b6c21288f66
parent 128508 2d4d6eea0dd6816ff6b79af7904e469c1e5a8521
child 128510 e7cb5c6e47f0e114af9d60fe270ebe6174f61aab
push id1509
push userryanvm@gmail.com
push dateFri, 12 Apr 2013 14:44:38 +0000
treeherderfx-team@aae000f9e3cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs856848
milestone23.0a1
backs outf556245d6da1f6edf50fbbea4180d2d22d1a3a63
Backed out changeset f556245d6da1 (bug 856848) for build bustage on a CLOSED TREE.
media/mtransport/runnable_utils.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/media/mtransport/runnable_utils.h
+++ b/media/mtransport/runnable_utils.h
@@ -21,41 +21,36 @@ class runnable_args_base : public nsRunn
   virtual bool returns_value() const { return false; }
 };
 
 // The generated file contains four major function templates
 // (in variants for arbitrary numbers of arguments up to 10,
 // which is why it is machine generated). The four templates
 // are:
 //
-// WrapRunnable(o, m, ...) -- wraps a member function m of an object ptr o
+// WrapRunnable(o, m, ...) -- wraps a member function m of an object ptr o 
 // WrapRunnableRet(o, m, ..., r) -- wraps a member function m of an object ptr o
 //                                  the function returns something that can
 //                                  be assigned to *r
 // WrapRunnableNM(f, ...) -- wraps a function f
 // WrapRunnableNMRet(f, ..., r) -- wraps a function f that returns something
 //                                 that can be assigned to *r
-//
+// 
 // All of these template functions return a Runnable* which can be passed
 // to Dispatch().
 #include "runnable_utils_generated.h"
 
 // Temporary hack. Really we want to have a template which will do this
 static inline nsresult RUN_ON_THREAD(nsIEventTarget *thread, nsIRunnable *runnable, uint32_t flags) {
   RefPtr<nsIRunnable> runnable_ref(runnable);
   if (thread) {
     bool on;
     nsresult rv;
     rv = thread->IsOnCurrentThread(&on);
-
-    // If the target thread has already shut down, we don't want to assert.
-    if (rv != NS_ERROR_NOT_INITIALIZED) {
-      MOZ_ASSERT(NS_SUCCEEDED(rv));
-    }
-
+    MOZ_ASSERT(NS_SUCCEEDED(rv));
     NS_ENSURE_SUCCESS(rv, rv);
     if(!on) {
       return thread->Dispatch(runnable_ref, flags);
     }
   }
   return runnable_ref->Run();
 }
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -272,17 +272,17 @@ PeerConnectionImpl::PeerConnectionImpl()
 : mRole(kRoleUnknown)
   , mCall(NULL)
   , mReadyState(kNew)
   , mIceState(kIceGathering)
   , mPCObserver(NULL)
   , mWindow(NULL)
   , mIdentity(NULL)
   , mSTSThread(NULL)
-  , mMedia(NULL)
+  , mMedia(new PeerConnectionMedia(this))
   , mNumAudioStreams(0)
   , mNumVideoStreams(0)
   , mHaveDataStream(false) {
 #ifdef MOZILLA_INTERNAL_API
   MOZ_ASSERT(NS_IsMainThread());
 #endif
 }
 
@@ -521,18 +521,16 @@ PeerConnectionImpl::Initialize(IPeerConn
   MOZ_ASSERT(pcctx);
 
   mCall = pcctx->createCall();
   if(!mCall.get()) {
     CSFLogError(logTag, "%s: Couldn't Create Call Object", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
 
-  mMedia = new PeerConnectionMedia(this);
-
   // Connect ICE slots.
   mMedia->SignalIceGatheringCompleted.connect(this, &PeerConnectionImpl::IceGatheringCompleted);
   mMedia->SignalIceCompleted.connect(this, &PeerConnectionImpl::IceCompleted);
   mMedia->SignalIceFailed.connect(this, &PeerConnectionImpl::IceFailed);
 
   // Initialize the media object.
   if (aRTCConfiguration) {
     IceConfiguration ic;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -115,27 +115,22 @@ PeerConnectionImpl* PeerConnectionImpl::
   PeerConnectionImpl *pc = new PeerConnectionImpl();
 
   CSFLogDebug(logTag, "Created PeerConnection: %p", pc);
 
   return pc;
 }
 
 
-PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl *parent)
-    : mParent(parent),
-      mLocalSourceStreamsLock("PeerConnectionMedia.mLocalSourceStreamsLock"),
-      mIceCtx(NULL),
-      mDNSResolver(new mozilla::NrIceResolver()),
-      mMainThread(mParent->GetMainThread()),
-      mSTSThread(mParent->GetSTSThread()) {}
-
 nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
                                    const std::vector<NrIceTurnServer>& turn_servers)
 {
+  mMainThread = mParent->GetMainThread();
+  mSTSThread = mParent->GetSTSThread();
+
   // TODO(ekr@rtfm.com): need some way to set not offerer later
   // Looks like a bug in the NrIceCtx API.
   mIceCtx = NrIceCtx::Create("PC:" + mParent->GetHandle(), true);
   if(!mIceCtx) {
     CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
   nsresult rv;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
@@ -225,17 +225,22 @@ RemoteSourceStreamInfo(already_AddRefed<
   nsRefPtr<DOMMediaStream> mMediaStream;
   std::map<int, mozilla::RefPtr<mozilla::MediaPipeline> > mPipelines;
   std::map<int, bool> mTypes;
   PeerConnectionMedia *mParent;
 };
 
 class PeerConnectionMedia : public sigslot::has_slots<> {
  public:
-  PeerConnectionMedia(PeerConnectionImpl *parent);
+  PeerConnectionMedia(PeerConnectionImpl *parent)
+      : mParent(parent),
+      mLocalSourceStreamsLock("PeerConnectionMedia.mLocalSourceStreamsLock"),
+      mIceCtx(NULL),
+      mDNSResolver(new mozilla::NrIceResolver()) {}
+
   ~PeerConnectionMedia() {}
 
   nsresult Init(const std::vector<mozilla::NrIceStunServer>& stun_servers,
                 const std::vector<mozilla::NrIceTurnServer>& turn_servers);
   // WARNING: This destroys the object!
   void SelfDestruct();
 
   mozilla::RefPtr<mozilla::NrIceCtx> ice_ctx() const { return mIceCtx; }
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -523,34 +523,35 @@ class ParsedSDP {
   std::multimap<int, std::string> ice_candidates_;
   std::multimap<std::string, SdpLine> sdp_map_;
   int levels_;
   int num_lines;
 };
 
 class SignalingAgent {
  public:
-  SignalingAgent() : pc(nullptr) {
-    cfg_.addStunServer("23.21.150.121", 3478);
-
-    pc = sipcc::PeerConnectionImpl::CreatePeerConnection();
-    ASSERT_TRUE(pc);
-  }
+  SignalingAgent() : pc(nullptr) {}
 
   ~SignalingAgent() {
-    mozilla::SyncRunnable::DispatchToThread(gThread,
+    mozilla::SyncRunnable::DispatchToThread(pc->GetMainThread(),
       WrapRunnable(this, &SignalingAgent::Close));
   }
 
   void Init_m(nsCOMPtr<nsIThread> thread)
   {
+    pc = sipcc::PeerConnectionImpl::CreatePeerConnection();
+    ASSERT_TRUE(pc);
+
     pObserver = new TestObserver(pc);
     ASSERT_TRUE(pObserver);
 
-    ASSERT_EQ(pc->Initialize(pObserver, nullptr, cfg_, thread), NS_OK);
+    sipcc::IceConfiguration cfg;
+    cfg.addStunServer("23.21.150.121", 3478);
+    ASSERT_EQ(pc->Initialize(pObserver, nullptr, cfg, thread), NS_OK);
+
   }
 
   void Init(nsCOMPtr<nsIThread> thread)
   {
     mozilla::SyncRunnable::DispatchToThread(thread,
       WrapRunnable(this, &SignalingAgent::Init_m, thread));
 
     ASSERT_TRUE_WAIT(sipcc_state() == sipcc::PeerConnectionImpl::kStarted,
@@ -591,22 +592,20 @@ class SignalingAgent {
     uint32_t res;
 
     pc->GetIceState(&res);
     return res;
   }
 
   void Close()
   {
-    if (pc) {
-      cout << "Close" << endl;
-      
-      pc->Close(false);
-      pc = nullptr;
-    }
+    cout << "Close" << endl;
+
+    pc->Close(false);
+    pc = nullptr;
 
     // Shutdown is synchronous evidently.
     // ASSERT_TRUE(pObserver->WaitForObserverCall());
     // ASSERT_EQ(pc->sipcc_state(), sipcc::PeerConnectionInterface::kIdle);
   }
 
   char* offer() const { return offer_; }
   char* answer() const { return answer_; }
@@ -845,17 +844,16 @@ void CreateAnswer(sipcc::MediaConstraint
   }
 
 public:
   mozilla::RefPtr<sipcc::PeerConnectionImpl> pc;
   nsRefPtr<TestObserver> pObserver;
   char* offer_;
   char* answer_;
   nsRefPtr<DOMMediaStream> domMediaStream_;
-  sipcc::IceConfiguration cfg_;
 
 private:
   void SDPSanityCheck(std::string sdp, uint32_t flags, bool offer)
   {
     ASSERT_TRUE(pObserver->state == TestObserver::stateSuccess);
     ASSERT_NE(sdp.find("v=0"), std::string::npos);
     ASSERT_NE(sdp.find("c=IN IP4"), std::string::npos);
     ASSERT_NE(sdp.find("a=fingerprint:sha-256"), std::string::npos);
@@ -991,29 +989,16 @@ class SignalingAgentTest : public ::test
     if (!agent->InitAllowFail(gThread))
       return false;
 
     agents_.push_back(agent.forget());
 
     return true;
   }
 
-  void CreateAgentNoInit() {
-    ScopedDeletePtr<SignalingAgent> agent(new SignalingAgent());
-    agents_.push_back(agent.forget());
-  }
-
-  bool InitAgent(size_t i) {
-    return agents_[i]->InitAllowFail(gThread);
-  }
-
-  SignalingAgent *agent(size_t i) {
-    return agents_[i];
-  }
-
  private:
   std::vector<SignalingAgent *> agents_;
 };
 
 
 class SignalingTest : public ::testing::Test {
 public:
   static void SetUpTestCase() {
@@ -1982,21 +1967,16 @@ TEST_F(SignalingAgentTest, CreateUntilFa
     if (!CreateAgent())
       break;
     std::cerr << "Created agent " << i << std::endl;
   }
   std::cerr << "Failed after creating " << i << " PCs " << std::endl;
   PR_Sleep(10000);  // Wait to see if we crash
 }
 
-// Test for bug 856433.
-TEST_F(SignalingAgentTest, CreateNoInit) {
-  CreateAgentNoInit();
-}
-
 /*
  * Test for Bug 843595
  */
 TEST_F(SignalingTest, missingUfrag)
 {
   sipcc::MediaConstraints constraints;
   std::string offer =
     "v=0\r\n"