/src/mozilla-central/netwerk/protocol/http/PSpdyPush.h
Line | Count | Source (jump to first uncovered line) |
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 | | { |
41 | | public: |
42 | | // The cache holds only weak pointers - no references |
43 | 0 | SpdyPushCache() = default; |
44 | | virtual ~SpdyPushCache(); |
45 | | MOZ_MUST_USE bool RegisterPushedStreamHttp2(const nsCString& key, |
46 | | Http2PushedStream *stream); |
47 | | Http2PushedStream *RemovePushedStreamHttp2(const nsCString& key); |
48 | | Http2PushedStream *RemovePushedStreamHttp2ByID(const nsCString& key, const uint32_t& streamID); |
49 | | private: |
50 | | nsDataHashtable<nsCStringHashKey, Http2PushedStream *> mHashHttp2; |
51 | | }; |
52 | | |
53 | | } // namespace net |
54 | | } // namespace mozilla |
55 | | |
56 | | #endif // mozilla_net_SpdyPush_Public_h |