bug 378637 part 6 - implement nsAHttpTransaction::QueryHttpTransaction r=hurley
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 15 Apr 2014 17:40:23 -0400
changeset 183601 fcf7f73bd7bb
parent 183600 1455ff7a4ecf
child 183602 a6a1c61cba7d
push id26799
push userphilringnalda@gmail.com
push date2014-05-18 00:55 +0000
treeherdermozilla-central@00ef3a7d7aa7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershurley
bugs378637
milestone32.0a1
bug 378637 part 6 - implement nsAHttpTransaction::QueryHttpTransaction r=hurley
netwerk/protocol/http/nsAHttpTransaction.h
netwerk/protocol/http/nsHttpTransaction.h
--- a/netwerk/protocol/http/nsAHttpTransaction.h
+++ b/netwerk/protocol/http/nsAHttpTransaction.h
@@ -119,16 +119,21 @@ public:
     // non pipeline implementations of nsAHttpTransaction
     virtual nsHttpPipeline *QueryPipeline() { return nullptr; }
 
     // equivalent to !!dynamic_cast<NullHttpTransaction *>(this)
     // A null transaction is expected to return BASE_STREAM_CLOSED on all of
     // its IO functions all the time.
     virtual bool IsNullTransaction() { return false; }
 
+    // If we used rtti this would be the result of doing
+    // dynamic_cast<nsHttpTransaction *>(this).. i.e. it can be nullptr for
+    // non nsHttpTransaction implementations of nsAHttpTransaction
+    virtual nsHttpTransaction *QueryHttpTransaction() { return nullptr; }
+
     // return the load group connection information associated with the transaction
     virtual nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return nullptr; }
 
     // The base definition of these is done in nsHttpTransaction.cpp
     virtual bool ResponseTimeoutEnabled() const;
     virtual PRIntervalTime ResponseTimeout();
 
     // Every transaction is classified into one of the types below. When using
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -118,16 +118,18 @@ public:
     bool UsesPipelining() const { return mCaps & NS_HTTP_ALLOW_PIPELINING; }
 
     // overload of nsAHttpTransaction::LoadGroupConnectionInfo()
     nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return mLoadGroupCI.get(); }
     void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI) { mLoadGroupCI = aLoadGroupCI; }
     void DispatchedAsBlocking();
     void RemoveDispatchedAsBlocking();
 
+    nsHttpTransaction *QueryHttpTransaction() MOZ_OVERRIDE { return this; }
+
 private:
     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);