Backed out changeset a6c459e49121 (bug 844705) for build bustage. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 08 Apr 2013 10:11:29 -0400
changeset 118990 24b27125d907a4f1ac5e1b971d747c70556d3f75
parent 118989 e7620c6e01d22480a2a277edfcf8fee666bee332
child 118991 9bf480c7f8b51e4a530321bf70c393251a5d59d2
push id636
push userryanvm@gmail.com
push dateMon, 08 Apr 2013 14:16:49 +0000
reviewersbackout
bugs844705
milestone18.0
backs outa6c459e49121060f58c2402f51c2894883547c54
Backed out changeset a6c459e49121 (bug 844705) for build bustage. a=backout
dom/bluetooth/BluetoothOppManager.cpp
--- a/dom/bluetooth/BluetoothOppManager.cpp
+++ b/dom/bluetooth/BluetoothOppManager.cpp
@@ -114,41 +114,16 @@ BluetoothOppManagerObserver::Observe(nsI
   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
     return sInstance->HandleShutdown();
   }
 
   MOZ_ASSERT(false, "BluetoothOppManager got unexpected topic!");
   return NS_ERROR_UNEXPECTED;
 }
 
-class SendSocketDataTask : public nsRunnable
-{
-public:
-  SendSocketDataTask(uint8_t* aStream, uint32_t aSize)
-    : mStream(aStream)
-    , mSize(aSize)
-  {
-    MOZ_ASSERT(!NS_IsMainThread());
-  }
-
-  NS_IMETHOD Run()
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-
-    sInstance->SendPutRequest(mStream, mSize);
-    sSentFileLength += mSize;
-
-    return NS_OK;
-  }
-
-private:
-  nsAutoArrayPtr<uint8_t> mStream;
-  uint32_t mSize;
-};
-
 class ReadFileTask : public Task
 {
 public:
   ReadFileTask(UnixSocketImpl* aImpl,
                nsIInputStream* aInputStream,
                uint32_t aRemoteMaxPacketSize)
     : mImpl(aImpl),
       mInputStream(aInputStream)
@@ -160,37 +135,31 @@ public:
 
   virtual void Run()
   {
     // NB: We know that we're not yet shutdown. We assert this under
     // SendPutRequest (in RawSendSocketData).
     MOZ_ASSERT(!NS_IsMainThread());
 
     uint32_t numRead;
-    nsAutoArrayPtr<char> buf(new char[mAvailablePacketSize]); 
+    nsAutoArrayPtr<char> buf(new char[mAvailablePacketSize]);
 
     // function inputstream->Read() only works on non-main thread
     nsresult rv = mInputStream->Read(buf.get(), mAvailablePacketSize, &numRead);
     if (NS_FAILED(rv)) {
       // Needs error handling here
-      NS_WARNING("Failed to read from input stream");
       return;
     }
 
     if (numRead > 0) {
       if (sSentFileLength + numRead >= sFileLength) {
         sWaitingToSendPutFinal = true;
       }
-
-      nsRefPtr<SendSocketDataTask> task =
-        new SendSocketDataTask((uint8_t*)buf.forgot(), numRead);
-      if (NS_FAILED(NS_DispatchToMainThread(task))) {
-        NS_WARNING("Failed to dispatch to main thread!");
-        return NS_ERROR_FAILURE;
-      }
+      sInstance->SendPutRequest(mImpl, (uint8_t*)buf.get(), numRead);
+      sSentFileLength += numRead;
     }
   }
 
 private:
   UnixSocketImpl* mImpl;
   nsCOMPtr<nsIInputStream> mInputStream;
   uint32_t mAvailablePacketSize;
 };