OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROPERTIES_BASED_QUIC_SERVER_INFO_H_ | 5 #ifndef NET_QUIC_CRYPTO_PROPERTIES_BASED_QUIC_SERVER_INFO_H_ |
6 #define NET_QUIC_CRYPTO_PROPERTIES_BASED_QUIC_SERVER_INFO_H_ | 6 #define NET_QUIC_CRYPTO_PROPERTIES_BASED_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/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 #include "net/quic/crypto/quic_server_info.h" | 15 #include "net/quic/crypto/quic_server_info.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class HttpServerProperties; | 19 class HttpServerProperties; |
20 | 20 |
21 // PropertiesBasedQuicServerInfo fetches information about a QUIC server from | 21 // PropertiesBasedQuicServerInfo fetches information about a QUIC server from |
22 // HttpServerProperties. Since the information is defined to be non-sensitive, | 22 // HttpServerProperties. Since the information is defined to be non-sensitive, |
23 // it's ok for us to keep it on disk. | 23 // it's ok for us to keep it on disk. |
24 class NET_EXPORT_PRIVATE PropertiesBasedQuicServerInfo : public QuicServerInfo { | 24 class NET_EXPORT_PRIVATE PropertiesBasedQuicServerInfo : public QuicServerInfo { |
25 public: | 25 public: |
26 PropertiesBasedQuicServerInfo( | 26 PropertiesBasedQuicServerInfo(const QuicServerId& server_id, |
27 const QuicServerId& server_id, | 27 HttpServerProperties* http_server_properties); |
28 base::WeakPtr<HttpServerProperties> http_server_properties); | |
29 ~PropertiesBasedQuicServerInfo() override; | 28 ~PropertiesBasedQuicServerInfo() override; |
30 | 29 |
31 // QuicServerInfo implementation. | 30 // QuicServerInfo implementation. |
32 void Start() override; | 31 void Start() override; |
33 int WaitForDataReady(const CompletionCallback& callback) override; | 32 int WaitForDataReady(const CompletionCallback& callback) override; |
34 void ResetWaitForDataReadyCallback() override; | 33 void ResetWaitForDataReadyCallback() override; |
35 void CancelWaitForDataReadyCallback() override; | 34 void CancelWaitForDataReadyCallback() override; |
36 bool IsDataReady() override; | 35 bool IsDataReady() override; |
37 bool IsReadyToPersist() override; | 36 bool IsReadyToPersist() override; |
38 void Persist() override; | 37 void Persist() override; |
39 void OnExternalCacheHit() override; | 38 void OnExternalCacheHit() override; |
40 | 39 |
41 private: | 40 private: |
42 base::WeakPtr<HttpServerProperties> http_server_properties_; | 41 HttpServerProperties* http_server_properties_; |
43 | 42 |
44 DISALLOW_COPY_AND_ASSIGN(PropertiesBasedQuicServerInfo); | 43 DISALLOW_COPY_AND_ASSIGN(PropertiesBasedQuicServerInfo); |
45 }; | 44 }; |
46 | 45 |
47 class NET_EXPORT_PRIVATE PropertiesBasedQuicServerInfoFactory | 46 class NET_EXPORT_PRIVATE PropertiesBasedQuicServerInfoFactory |
48 : public QuicServerInfoFactory { | 47 : public QuicServerInfoFactory { |
49 public: | 48 public: |
50 explicit PropertiesBasedQuicServerInfoFactory( | 49 explicit PropertiesBasedQuicServerInfoFactory( |
51 base::WeakPtr<HttpServerProperties> http_server_properties); | 50 HttpServerProperties* http_server_properties); |
52 ~PropertiesBasedQuicServerInfoFactory() override; | 51 ~PropertiesBasedQuicServerInfoFactory() override; |
53 | 52 |
54 QuicServerInfo* GetForServer(const QuicServerId& server_id) override; | 53 QuicServerInfo* GetForServer(const QuicServerId& server_id) override; |
55 | 54 |
56 private: | 55 private: |
57 base::WeakPtr<HttpServerProperties> http_server_properties_; | 56 HttpServerProperties* http_server_properties_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(PropertiesBasedQuicServerInfoFactory); | 58 DISALLOW_COPY_AND_ASSIGN(PropertiesBasedQuicServerInfoFactory); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace net | 61 } // namespace net |
63 | 62 |
64 #endif // NET_QUIC_CRYPTO_PROPERTIES_BASED_QUIC_SERVER_INFO_H_ | 63 #endif // NET_QUIC_CRYPTO_PROPERTIES_BASED_QUIC_SERVER_INFO_H_ |
OLD | NEW |