1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 // SPDY Server Push 7 8 /* 9 A pushed stream is put into a memory buffer (The SpdyPushTransactionBuffer) 10 and spooled there until a GET is made that can be matched up with it. At 11 that time we have two spdy streams - the GET (aka the sink) and the PUSH 12 (aka the source). Data is copied between those two streams for the lifetime 13 of the transaction. This is true even if the transaction buffer is empty, 14 partly complete, or totally loaded at the time the GET correspondence is made. 15 16 correspondence is done through a hash table of the full url, the spdy session, 17 and the load group. The load group is implicit because that's where the 18 hash is stored, the other items comprise the hash key. 19 20 Pushed streams are subject to aggressive flow control before they are matched 21 with a GET at which point flow control is effectively disabled to match the 22 client pull behavior. 23 */ 24 25 #ifndef mozilla_net_SpdyPush_Public_h 26 #define mozilla_net_SpdyPush_Public_h 27 28 #include "nsAutoPtr.h" 29 #include "nsDataHashtable.h" 30 #include "nsISupports.h" 31 #include "nsStringFwd.h" 32 33 namespace mozilla { 34 namespace net { 35 36 class Http2PushedStream; 37 38 // One cache per load group 39 class SpdyPushCache { 40 public: 41 // The cache holds only weak pointers - no references 42 SpdyPushCache(); 43 virtual ~SpdyPushCache(); 44 MOZ_MUST_USE bool RegisterPushedStreamHttp2(const nsCString& key, 45 Http2PushedStream* stream); 46 Http2PushedStream* RemovePushedStreamHttp2(const nsCString& key); 47 Http2PushedStream* RemovePushedStreamHttp2ByID(const nsCString& key, 48 const uint32_t& streamID); 49 50 private: 51 nsDataHashtable<nsCStringHashKey, Http2PushedStream*> mHashHttp2; 52 }; 53 54 } // namespace net 55 } // namespace mozilla 56 57 #endif // mozilla_net_SpdyPush_Public_h 58