OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_HTTP_CACHE_LOOKUP_MANAGER_H_ | |
6 #define NET_HTTP_CACHE_LOOKUP_MANAGER_H_ | |
7 | |
8 #include "net/base/net_export.h" | |
9 #include "net/http/http_cache.h" | |
10 #include "net/http/http_cache_transaction.h" | |
11 #include "net/spdy/server_push_delegate.h" | |
12 | |
13 namespace net { | |
14 | |
15 // An implementation of ServerPushDelegate that can issue HttpCache::Transaction | |
16 // when a server push is received on the session layer to lookup whether the | |
17 // response to the pushed URL is cached. | |
Ryan Hamilton
2016/11/17 22:47:24
How about:
An implementation of ServerPushDelegat
Zhongyi Shi
2016/11/18 20:34:19
Done.
| |
18 class NET_EXPORT_PRIVATE HttpCacheLookupManager : public ServerPushDelegate { | |
19 public: | |
20 // |http_cache| MUST outlive the HttpCacheLookupManager. | |
21 HttpCacheLookupManager(HttpCache* http_cache, | |
22 const NetLogWithSource& net_log); | |
23 ~HttpCacheLookupManager() override; | |
24 | |
25 void OnPush(std::unique_ptr<ServerPushHelper> push_helper) override; | |
26 | |
27 // Invoked when the HttpCache::Transaction for |url| finishes to cancel the | |
28 // server push if the response to the server push is found cached. | |
29 void OnPushFilteringComplete(const GURL& url, int rv); | |
Ryan Hamilton
2016/11/17 22:47:24
nit: How about simply OnLookupComplete?
Zhongyi Shi
2016/11/18 20:34:19
Done.
| |
30 | |
31 private: | |
32 // A class that owns the ServerPushHelper and generated HttpRequestInfo and | |
33 // HttpTransaction for the ServerPushHelper. | |
34 struct LookupTransaction { | |
35 explicit LookupTransaction(std::unique_ptr<ServerPushHelper> push_helper); | |
36 ~LookupTransaction(); | |
37 | |
38 std::unique_ptr<ServerPushHelper> push_helper; | |
39 std::unique_ptr<HttpRequestInfo> request; | |
40 std::unique_ptr<HttpTransaction> transaction; | |
41 }; | |
42 | |
43 NetLogWithSource net_log_; | |
44 // HttpCache must outlive the HttpCacheLookupManager. | |
45 HttpCache* http_cache_; | |
46 std::map<GURL, std::unique_ptr<LookupTransaction>> lookup_transactions_; | |
47 base::WeakPtrFactory<HttpCacheLookupManager> weak_factory_; | |
48 }; | |
49 | |
50 } // namespace net | |
51 | |
52 #endif // NET_HTTP_CACHE_LOOKUP_MANAGER_H_ | |
OLD | NEW |