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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // doesn't have a pending callback). | 48 // doesn't have a pending callback). |
49 virtual bool IsDataReady() = 0; | 49 virtual bool IsDataReady() = 0; |
50 | 50 |
51 // Persist allows for the server information to be updated for future users. | 51 // Persist allows for the server information to be updated for future users. |
52 // This is a fire and forget operation: the caller may drop its reference | 52 // This is a fire and forget operation: the caller may drop its reference |
53 // from this object and the store operation will still complete. This can | 53 // from this object and the store operation will still complete. This can |
54 // only be called once WaitForDataReady has returned OK or called its | 54 // only be called once WaitForDataReady has returned OK or called its |
55 // callback. | 55 // callback. |
56 virtual void Persist() = 0; | 56 virtual void Persist() = 0; |
57 | 57 |
| 58 // Helper methods used for computing time spent to read QUIC server |
| 59 // information from disk cache. |
| 60 const base::TimeTicks& read_start_time() const { return read_start_time_; } |
| 61 void set_read_start_time(const base::TimeTicks& request_time) { |
| 62 read_start_time_ = request_time; |
| 63 } |
| 64 |
58 struct State { | 65 struct State { |
59 State(); | 66 State(); |
60 ~State(); | 67 ~State(); |
61 | 68 |
62 void Clear(); | 69 void Clear(); |
63 | 70 |
64 // This class matches QuicClientCryptoConfig::CachedState. | 71 // This class matches QuicClientCryptoConfig::CachedState. |
65 std::string server_config; // A serialized handshake message. | 72 std::string server_config; // A serialized handshake message. |
66 std::string source_address_token; // An opaque proof of IP ownership. | 73 std::string source_address_token; // An opaque proof of IP ownership. |
67 std::vector<std::string> certs; // A list of certificates in leaf-first | 74 std::vector<std::string> certs; // A list of certificates in leaf-first |
(...skipping 19 matching lines...) Expand all Loading... |
87 | 94 |
88 private: | 95 private: |
89 // ParseInner is a helper function for Parse. | 96 // ParseInner is a helper function for Parse. |
90 bool ParseInner(const std::string& data); | 97 bool ParseInner(const std::string& data); |
91 | 98 |
92 // SerializeInner is a helper function for Serialize. | 99 // SerializeInner is a helper function for Serialize. |
93 std::string SerializeInner() const; | 100 std::string SerializeInner() const; |
94 | 101 |
95 // This is the QUIC server hostname for which we restore the crypto_config. | 102 // This is the QUIC server hostname for which we restore the crypto_config. |
96 const std::string hostname_; | 103 const std::string hostname_; |
| 104 |
| 105 // Time when call to WaitForDataReady was made, used for computing time spent |
| 106 // to read QUIC server information from disk cache. |
| 107 base::TimeTicks read_start_time_; |
97 }; | 108 }; |
98 | 109 |
99 class QuicServerInfoFactory { | 110 class QuicServerInfoFactory { |
100 public: | 111 public: |
101 virtual ~QuicServerInfoFactory(); | 112 virtual ~QuicServerInfoFactory(); |
102 | 113 |
103 // GetForHost returns a fresh, allocated QuicServerInfo for the given | 114 // GetForHost returns a fresh, allocated QuicServerInfo for the given |
104 // hostname or NULL on failure. | 115 // hostname or NULL on failure. |
105 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; | 116 virtual QuicServerInfo* GetForHost(const std::string& hostname) = 0; |
106 }; | 117 }; |
107 | 118 |
108 } // namespace net | 119 } // namespace net |
109 | 120 |
110 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ | 121 #endif // NET_QUIC_CRYPTO_QUIC_SERVER_INFO_H_ |
OLD | NEW |