OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CRYPTO_QUIC_SERVER_INFO_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
6 #define NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
17 #include "net/quic/core/quic_server_id.h" | 17 #include "net/quic/core/quic_server_id.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class X509Certificate; | 21 class X509Certificate; |
22 | 22 |
23 // QuicServerInfo is an interface for fetching information about a QUIC server. | 23 // QuicServerInfo is an interface for fetching information about a QUIC server. |
24 // This information may be stored on disk so does not include keys or other | 24 // This information may be stored on disk so does not include keys or other |
25 // sensitive information. Primarily it's intended for caching the QUIC server's | 25 // sensitive information. Primarily it's intended for caching the QUIC server's |
26 // crypto config. | 26 // crypto config. |
27 class NET_EXPORT_PRIVATE QuicServerInfo { | 27 class NET_EXPORT_PRIVATE QuicServerInfo { |
28 public: | 28 public: |
| 29 // Enum to track number of times data read/parse/write API calls of |
| 30 // QuicServerInfo to and from disk cache is called. |
| 31 enum QuicServerInfoAPICall { |
| 32 QUIC_SERVER_INFO_START = 0, |
| 33 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1, |
| 34 QUIC_SERVER_INFO_PARSE = 2, |
| 35 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3, |
| 36 QUIC_SERVER_INFO_READY_TO_PERSIST = 4, |
| 37 QUIC_SERVER_INFO_PERSIST = 5, |
| 38 QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6, |
| 39 QUIC_SERVER_INFO_RESET_WAIT_FOR_DATA_READY = 7, |
| 40 QUIC_SERVER_INFO_NUM_OF_API_CALLS = 8, |
| 41 }; |
| 42 |
| 43 // Enum to track failure reasons to read/load/write of QuicServerInfo to |
| 44 // and from disk cache. |
| 45 enum FailureReason { |
| 46 WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0, |
| 47 GET_BACKEND_FAILURE = 1, |
| 48 OPEN_FAILURE = 2, |
| 49 CREATE_OR_OPEN_FAILURE = 3, |
| 50 PARSE_NO_DATA_FAILURE = 4, |
| 51 PARSE_FAILURE = 5, |
| 52 READ_FAILURE = 6, |
| 53 READY_TO_PERSIST_FAILURE = 7, |
| 54 PERSIST_NO_BACKEND_FAILURE = 8, |
| 55 WRITE_FAILURE = 9, |
| 56 NO_FAILURE = 10, |
| 57 PARSE_DATA_DECODE_FAILURE = 11, |
| 58 NUM_OF_FAILURES = 12, |
| 59 }; |
| 60 |
29 explicit QuicServerInfo(const QuicServerId& server_id); | 61 explicit QuicServerInfo(const QuicServerId& server_id); |
30 virtual ~QuicServerInfo(); | 62 virtual ~QuicServerInfo(); |
31 | 63 |
32 // Start will commence the lookup. This must be called before any other | 64 // Start will commence the lookup. This must be called before any other |
33 // methods. By opportunistically calling this early, it may be possible to | 65 // methods. By opportunistically calling this early, it may be possible to |
34 // overlap this object's lookup and reduce latency. | 66 // overlap this object's lookup and reduce latency. |
35 virtual void Start() = 0; | 67 virtual void Start() = 0; |
36 | 68 |
37 // WaitForDataReady returns OK if the fetch of the requested data has | 69 // WaitForDataReady returns OK if the fetch of the requested data has |
38 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on | 70 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // |server_id| or NULL on failure. | 172 // |server_id| or NULL on failure. |
141 virtual QuicServerInfo* GetForServer(const QuicServerId& server_id) = 0; | 173 virtual QuicServerInfo* GetForServer(const QuicServerId& server_id) = 0; |
142 | 174 |
143 private: | 175 private: |
144 DISALLOW_COPY_AND_ASSIGN(QuicServerInfoFactory); | 176 DISALLOW_COPY_AND_ASSIGN(QuicServerInfoFactory); |
145 }; | 177 }; |
146 | 178 |
147 } // namespace net | 179 } // namespace net |
148 | 180 |
149 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 181 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
OLD | NEW |