netwerk/protocol/http/PSpdyPush.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial