Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Unified Diff: net/http/http_cache_lookup_manager.h

Issue 2503473004: Server push cancellation: add a new class HttpCacheLookupManager which implements ServerPushDelegate (Closed)
Patch Set: address rch's comments 1 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_cache_lookup_manager.cc » ('j') | net/http/http_cache_lookup_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_lookup_manager.h
diff --git a/net/http/http_cache_lookup_manager.h b/net/http/http_cache_lookup_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d872d034637337cdd77b838b8fd21536c6d5d9a4
--- /dev/null
+++ b/net/http/http_cache_lookup_manager.h
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP_CACHE_LOOKUP_MANAGER_H_
+#define NET_HTTP_CACHE_LOOKUP_MANAGER_H_
+
+#include "net/base/net_export.h"
+#include "net/http/http_cache.h"
+#include "net/http/http_cache_transaction.h"
+#include "net/spdy/server_push_delegate.h"
+
+namespace net {
+
+// An implementation of ServerPushDelegate that can issue HttpCache::Transaction
+// when a server push is received on the session layer to lookup whether the
+// 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.
+class NET_EXPORT_PRIVATE HttpCacheLookupManager : public ServerPushDelegate {
+ public:
+ // |http_cache| MUST outlive the HttpCacheLookupManager.
+ HttpCacheLookupManager(HttpCache* http_cache,
+ const NetLogWithSource& net_log);
+ ~HttpCacheLookupManager() override;
+
+ void OnPush(std::unique_ptr<ServerPushHelper> push_helper) override;
+
+ // Invoked when the HttpCache::Transaction for |url| finishes to cancel the
+ // server push if the response to the server push is found cached.
+ 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.
+
+ private:
+ // A class that owns the ServerPushHelper and generated HttpRequestInfo and
+ // HttpTransaction for the ServerPushHelper.
+ struct LookupTransaction {
+ explicit LookupTransaction(std::unique_ptr<ServerPushHelper> push_helper);
+ ~LookupTransaction();
+
+ std::unique_ptr<ServerPushHelper> push_helper;
+ std::unique_ptr<HttpRequestInfo> request;
+ std::unique_ptr<HttpTransaction> transaction;
+ };
+
+ NetLogWithSource net_log_;
+ // HttpCache must outlive the HttpCacheLookupManager.
+ HttpCache* http_cache_;
+ std::map<GURL, std::unique_ptr<LookupTransaction>> lookup_transactions_;
+ base::WeakPtrFactory<HttpCacheLookupManager> weak_factory_;
+};
+
+} // namespace net
+
+#endif // NET_HTTP_CACHE_LOOKUP_MANAGER_H_
« no previous file with comments | « no previous file | net/http/http_cache_lookup_manager.cc » ('j') | net/http/http_cache_lookup_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698