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_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
6 #define NET_QUIC_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 6 #define NET_QUIC_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/net_export.h" | |
11 #include "net/quic/core/quic_client_session_base.h" | 10 #include "net/quic/core/quic_client_session_base.h" |
12 #include "net/quic/core/quic_types.h" | 11 #include "net/quic/core/quic_types.h" |
| 12 #include "net/quic/platform/api/quic_export.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // QuicClientPushPromiseIndex is the interface to support rendezvous | 16 // QuicClientPushPromiseIndex is the interface to support rendezvous |
17 // between client requests and resources delivered via server push. | 17 // between client requests and resources delivered via server push. |
18 // The same index can be shared across multiple sessions (e.g. for the | 18 // The same index can be shared across multiple sessions (e.g. for the |
19 // same browser users profile), since cross-origin pushes are allowed | 19 // same browser users profile), since cross-origin pushes are allowed |
20 // (subject to authority constraints). | 20 // (subject to authority constraints). |
21 | 21 |
22 class NET_EXPORT_PRIVATE QuicClientPushPromiseIndex { | 22 class QUIC_EXPORT_PRIVATE QuicClientPushPromiseIndex { |
23 public: | 23 public: |
24 // Delegate is used to complete the rendezvous that began with | 24 // Delegate is used to complete the rendezvous that began with |
25 // |Try()|. | 25 // |Try()|. |
26 class NET_EXPORT_PRIVATE Delegate { | 26 class QUIC_EXPORT_PRIVATE Delegate { |
27 public: | 27 public: |
28 virtual ~Delegate() {} | 28 virtual ~Delegate() {} |
29 | 29 |
30 // The primary lookup matched request with push promise by URL. A | 30 // The primary lookup matched request with push promise by URL. A |
31 // secondary match is necessary to ensure Vary (RFC 2616, 14.14) | 31 // secondary match is necessary to ensure Vary (RFC 2616, 14.14) |
32 // is honored. If Vary is not present, return true. If Vary is | 32 // is honored. If Vary is not present, return true. If Vary is |
33 // present, return whether designated header fields of | 33 // present, return whether designated header fields of |
34 // |promise_request| and |client_request| match. | 34 // |promise_request| and |client_request| match. |
35 virtual bool CheckVary(const SpdyHeaderBlock& client_request, | 35 virtual bool CheckVary(const SpdyHeaderBlock& client_request, |
36 const SpdyHeaderBlock& promise_request, | 36 const SpdyHeaderBlock& promise_request, |
37 const SpdyHeaderBlock& promise_response) = 0; | 37 const SpdyHeaderBlock& promise_response) = 0; |
38 | 38 |
39 // On rendezvous success, provides the promised |stream|. Callee | 39 // On rendezvous success, provides the promised |stream|. Callee |
40 // does not inherit ownership of |stream|. On rendezvous failure, | 40 // does not inherit ownership of |stream|. On rendezvous failure, |
41 // |stream| is |nullptr| and the client should retry the request. | 41 // |stream| is |nullptr| and the client should retry the request. |
42 // Rendezvous can fail due to promise validation failure or RST on | 42 // Rendezvous can fail due to promise validation failure or RST on |
43 // promised stream. |url| will have been removed from the index | 43 // promised stream. |url| will have been removed from the index |
44 // before |OnRendezvousResult()| is invoked, so a recursive call to | 44 // before |OnRendezvousResult()| is invoked, so a recursive call to |
45 // |Try()| will return |QUIC_FAILURE|, which may be convenient for | 45 // |Try()| will return |QUIC_FAILURE|, which may be convenient for |
46 // retry purposes. | 46 // retry purposes. |
47 virtual void OnRendezvousResult(QuicSpdyStream* stream) = 0; | 47 virtual void OnRendezvousResult(QuicSpdyStream* stream) = 0; |
48 }; | 48 }; |
49 | 49 |
50 class NET_EXPORT_PRIVATE TryHandle { | 50 class QUIC_EXPORT_PRIVATE TryHandle { |
51 public: | 51 public: |
52 // Cancel the request. | 52 // Cancel the request. |
53 virtual void Cancel() = 0; | 53 virtual void Cancel() = 0; |
54 | 54 |
55 protected: | 55 protected: |
56 TryHandle() {} | 56 TryHandle() {} |
57 ~TryHandle(); | 57 ~TryHandle(); |
58 | 58 |
59 private: | 59 private: |
60 DISALLOW_COPY_AND_ASSIGN(TryHandle); | 60 DISALLOW_COPY_AND_ASSIGN(TryHandle); |
(...skipping 29 matching lines...) Expand all Loading... |
90 | 90 |
91 private: | 91 private: |
92 QuicPromisedByUrlMap promised_by_url_; | 92 QuicPromisedByUrlMap promised_by_url_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(QuicClientPushPromiseIndex); | 94 DISALLOW_COPY_AND_ASSIGN(QuicClientPushPromiseIndex); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace net | 97 } // namespace net |
98 | 98 |
99 #endif // NET_QUIC_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ | 99 #endif // NET_QUIC_CORE_QUIC_CLIENT_PUSH_PROMISE_INDEX_H_ |
OLD | NEW |