OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 5 #ifndef NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
6 #define NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 6 #define NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
7 | 7 |
8 #include "net/quic/quic_client_session_base.h" | 8 #include "net/quic/quic_client_session_base.h" |
9 | 9 |
10 #include "net/quic/quic_types.h" | 10 #include "net/quic/quic_types.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 // QuicClientPushPromiseIndex is the interface to support rendezvous | 14 // QuicClientPushPromiseIndex is the interface to support rendezvous |
15 // between client requests and resources delivered via server push. | 15 // between client requests and resources delivered via server push. |
16 // The same index can be shared across multiple sessions (e.g. for the | 16 // The same index can be shared across multiple sessions (e.g. for the |
17 // same browser users profile), since cross-origin pushes are allowed | 17 // same browser users profile), since cross-origin pushes are allowed |
18 // (subject to authority constraints). | 18 // (subject to authority constraints). |
19 | 19 |
20 class NET_EXPORT_PRIVATE QuicClientPushPromiseIndex { | 20 class NET_EXPORT_PRIVATE QuicClientPushPromiseIndex { |
21 public: | 21 public: |
22 // Delegate is used to complete the rendezvous that began with | 22 // Delegate is used to complete the rendezvous that began with |
23 // |Try()|. | 23 // |Try()|. |
24 class Delegate { | 24 class NET_EXPORT_PRIVATE Delegate { |
25 public: | 25 public: |
26 virtual ~Delegate(){}; | 26 virtual ~Delegate(){}; |
27 | 27 |
28 // The primary lookup matched request with push promise by URL. A | 28 // The primary lookup matched request with push promise by URL. A |
29 // secondary match is necessary to ensure Vary (RFC 2616, 14.14) | 29 // secondary match is necessary to ensure Vary (RFC 2616, 14.14) |
30 // is honored. If Vary is not present, return true. If Vary is | 30 // is honored. If Vary is not present, return true. If Vary is |
31 // present, return whether designated header fields of | 31 // present, return whether designated header fields of |
32 // |promise_request| and |client_request| match. | 32 // |promise_request| and |client_request| match. |
33 virtual bool CheckVary(const SpdyHeaderBlock& client_request, | 33 virtual bool CheckVary(const SpdyHeaderBlock& client_request, |
34 const SpdyHeaderBlock& promise_request, | 34 const SpdyHeaderBlock& promise_request, |
(...skipping 19 matching lines...) Expand all Loading... |
54 TryHandle() {} | 54 TryHandle() {} |
55 ~TryHandle(); | 55 ~TryHandle(); |
56 | 56 |
57 private: | 57 private: |
58 DISALLOW_COPY_AND_ASSIGN(TryHandle); | 58 DISALLOW_COPY_AND_ASSIGN(TryHandle); |
59 }; | 59 }; |
60 | 60 |
61 QuicClientPushPromiseIndex(); | 61 QuicClientPushPromiseIndex(); |
62 virtual ~QuicClientPushPromiseIndex(); | 62 virtual ~QuicClientPushPromiseIndex(); |
63 | 63 |
| 64 // Called by client code, used to enforce affinity between requests |
| 65 // for promised streams and the session the promise came from. |
| 66 QuicClientPromisedInfo* GetPromised(const string& url); |
| 67 |
64 // Called by client code, to initiate rendezvous between a request | 68 // Called by client code, to initiate rendezvous between a request |
65 // and a server push stream. If |request|'s url is in the index, | 69 // and a server push stream. If |request|'s url is in the index, |
66 // rendezvous will be attempted and may complete immediately or | 70 // rendezvous will be attempted and may complete immediately or |
67 // asynchronously. If the matching promise and response headers | 71 // asynchronously. If the matching promise and response headers |
68 // have already arrived, the delegate's methods will fire | 72 // have already arrived, the delegate's methods will fire |
69 // recursively from within |Try()|. Returns |QUIC_SUCCESS| if the | 73 // recursively from within |Try()|. Returns |QUIC_SUCCESS| if the |
70 // rendezvous was a success. Returns |QUIC_FAILURE| if there was no | 74 // rendezvous was a success. Returns |QUIC_FAILURE| if there was no |
71 // matching promise, or if there was but the rendezvous has failed. | 75 // matching promise, or if there was but the rendezvous has failed. |
72 // Returns QUIC_PENDING if a matching promise was found, but the | 76 // Returns QUIC_PENDING if a matching promise was found, but the |
73 // rendezvous needs to complete asynchronously because the promised | 77 // rendezvous needs to complete asynchronously because the promised |
(...skipping 10 matching lines...) Expand all Loading... |
84 | 88 |
85 private: | 89 private: |
86 QuicPromisedByUrlMap promised_by_url_; | 90 QuicPromisedByUrlMap promised_by_url_; |
87 | 91 |
88 DISALLOW_COPY_AND_ASSIGN(QuicClientPushPromiseIndex); | 92 DISALLOW_COPY_AND_ASSIGN(QuicClientPushPromiseIndex); |
89 }; | 93 }; |
90 | 94 |
91 } // namespace net | 95 } // namespace net |
92 | 96 |
93 #endif // NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 97 #endif // NET_QUIC_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
OLD | NEW |