bug 1034918 - nshttptransaction dtor can be private r=sworkman
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 08 Jul 2014 12:43:04 -0400
changeset 192865 ea72e2c9debe3c8101d6787997010f6bdcb3f3e6
parent 192864 8df1affbbde7a3805ab195cd2a687c9d7aaa163f
child 192866 e185bf9449f60b5483d1cfbee126967b70be4f57
push id7663
push userkwierso@gmail.com
push dateWed, 09 Jul 2014 03:08:08 +0000
treeherderfx-team@48de6f4f82af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs1034918
milestone33.0a1
bug 1034918 - nshttptransaction dtor can be private r=sworkman
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1736,19 +1736,19 @@ nsHttpTransaction::ReleaseBlockingTransa
     RemoveDispatchedAsBlocking();
     mLoadGroupCI = nullptr;
 }
 
 //-----------------------------------------------------------------------------
 // nsHttpTransaction deletion event
 //-----------------------------------------------------------------------------
 
-class nsDeleteHttpTransaction : public nsRunnable {
+class DeleteHttpTransaction : public nsRunnable {
 public:
-    nsDeleteHttpTransaction(nsHttpTransaction *trans)
+    DeleteHttpTransaction(nsHttpTransaction *trans)
         : mTrans(trans)
     {}
 
     NS_IMETHOD Run()
     {
         delete mTrans;
         return NS_OK;
     }
@@ -1762,17 +1762,17 @@ nsHttpTransaction::DeleteSelfOnConsumerT
     LOG(("nsHttpTransaction::DeleteSelfOnConsumerThread [this=%p]\n", this));
 
     bool val;
     if (!mConsumerTarget ||
         (NS_SUCCEEDED(mConsumerTarget->IsOnCurrentThread(&val)) && val)) {
         delete this;
     } else {
         LOG(("proxying delete to consumer thread...\n"));
-        nsCOMPtr<nsIRunnable> event = new nsDeleteHttpTransaction(this);
+        nsCOMPtr<nsIRunnable> event = new DeleteHttpTransaction(this);
         if (NS_FAILED(mConsumerTarget->Dispatch(event, NS_DISPATCH_NORMAL)))
             NS_WARNING("failed to dispatch nsHttpDeleteTransaction event");
     }
 }
 
 bool
 nsHttpTransaction::TryToRunPacedRequest()
 {
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -23,34 +23,21 @@
 
 //-----------------------------------------------------------------------------
 
 class nsIHttpActivityObserver;
 class nsIEventTarget;
 class nsIInputStream;
 class nsIOutputStream;
 
-namespace mozilla {
-
-namespace net {
+namespace mozilla { namespace net {
 
 class nsHttpChunkedDecoder;
 class nsHttpRequestHead;
 class nsHttpResponseHead;
-class nsHttpTransaction;
-
-}
-
-template<>
-struct HasDangerousPublicDestructor<net::nsHttpTransaction>
-{
-  static const bool value = true;
-};
-
-namespace net {
 
 //-----------------------------------------------------------------------------
 // nsHttpTransaction represents a single HTTP transaction.  It is thread-safe,
 // intended to run on the socket thread.
 //-----------------------------------------------------------------------------
 
 class nsHttpTransaction : public nsAHttpTransaction
                         , public ATokenBucketEvent
@@ -59,17 +46,16 @@ class nsHttpTransaction : public nsAHttp
 {
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSAHTTPTRANSACTION
     NS_DECL_NSIINPUTSTREAMCALLBACK
     NS_DECL_NSIOUTPUTSTREAMCALLBACK
 
     nsHttpTransaction();
-    virtual ~nsHttpTransaction();
 
     //
     // called to initialize the transaction
     //
     // @param caps
     //        the transaction capabilities (see nsHttp.h)
     // @param connInfo
     //        the connection type for this transaction.
@@ -142,16 +128,19 @@ public:
     nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return mLoadGroupCI.get(); }
     void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI) { mLoadGroupCI = aLoadGroupCI; }
     void DispatchedAsBlocking();
     void RemoveDispatchedAsBlocking();
 
     nsHttpTransaction *QueryHttpTransaction() MOZ_OVERRIDE { return this; }
 
 private:
+    friend class DeleteHttpTransaction;
+    virtual ~nsHttpTransaction();
+
     nsresult Restart();
     nsresult RestartInProgress();
     char    *LocateHttpStart(char *buf, uint32_t len,
                              bool aAllowPartialMatch);
     nsresult ParseLine(char *line);
     nsresult ParseLineSegment(char *seg, uint32_t len);
     nsresult ParseHead(char *, uint32_t count, uint32_t *countRead);
     nsresult HandleContentStart();