|
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 |
|
32 class nsCString; |
|
33 |
|
34 namespace mozilla { |
|
35 namespace net { |
|
36 |
|
37 class SpdyPushedStream3; |
|
38 class SpdyPushedStream31; |
|
39 class Http2PushedStream; |
|
40 |
|
41 // One cache per load group |
|
42 class SpdyPushCache |
|
43 { |
|
44 public: |
|
45 // The cache holds only weak pointers - no references |
|
46 SpdyPushCache(); |
|
47 virtual ~SpdyPushCache(); |
|
48 |
|
49 // for spdy/3 |
|
50 public: |
|
51 bool RegisterPushedStreamSpdy3(nsCString key, |
|
52 SpdyPushedStream3 *stream); |
|
53 SpdyPushedStream3 *RemovePushedStreamSpdy3(nsCString key); |
|
54 |
|
55 private: |
|
56 nsDataHashtable<nsCStringHashKey, SpdyPushedStream3 *> mHashSpdy3; |
|
57 |
|
58 // for spdy/3.1 |
|
59 public: |
|
60 bool RegisterPushedStreamSpdy31(nsCString key, |
|
61 SpdyPushedStream31 *stream); |
|
62 SpdyPushedStream31 *RemovePushedStreamSpdy31(nsCString key); |
|
63 private: |
|
64 nsDataHashtable<nsCStringHashKey, SpdyPushedStream31 *> mHashSpdy31; |
|
65 |
|
66 // for http/2 |
|
67 public: |
|
68 bool RegisterPushedStreamHttp2(nsCString key, |
|
69 Http2PushedStream *stream); |
|
70 Http2PushedStream *RemovePushedStreamHttp2(nsCString key); |
|
71 private: |
|
72 nsDataHashtable<nsCStringHashKey, Http2PushedStream *> mHashHttp2; |
|
73 }; |
|
74 |
|
75 } // namespace mozilla::net |
|
76 } // namespace mozilla |
|
77 |
|
78 #endif // mozilla_net_SpdyPush_Public_h |