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

Side by Side Diff: content/browser/loader/async_revalidation_manager.h

Issue 1977313002: Define parameter structs of resource messages out of resource_messages.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 unified diff | Download patch
OLDNEW
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 CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_
6 #define CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_ 6 #define CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 13
14 class GURL; 14 class GURL;
15 struct ResourceHostMsg_Request;
16 15
17 namespace net { 16 namespace net {
18 class URLRequest; 17 class URLRequest;
19 class HttpCache; 18 class HttpCache;
20 } 19 }
21 20
22 namespace content { 21 namespace content {
23 22
24 class AsyncRevalidationDriver; 23 class AsyncRevalidationDriver;
25 class ResourceContext; 24 class ResourceContext;
26 class ResourceScheduler; 25 class ResourceScheduler;
26 struct ResourceRequest;
27 27
28 // One instance of this class manages all active AsyncRevalidationDriver objects 28 // One instance of this class manages all active AsyncRevalidationDriver objects
29 // for all profiles. It is created by and owned by 29 // for all profiles. It is created by and owned by
30 // ResourceDispatcherHostImpl. It also implements the creation of a new 30 // ResourceDispatcherHostImpl. It also implements the creation of a new
31 // net::URLRequest and AsyncRevalidationDriver from an existing net::URLRequest 31 // net::URLRequest and AsyncRevalidationDriver from an existing net::URLRequest
32 // that has had the stale-while-revalidate algorithm applied to it. 32 // that has had the stale-while-revalidate algorithm applied to it.
33 class AsyncRevalidationManager { 33 class AsyncRevalidationManager {
34 public: 34 public:
35 AsyncRevalidationManager(); 35 AsyncRevalidationManager();
36 ~AsyncRevalidationManager(); 36 ~AsyncRevalidationManager();
37 37
38 // Starts an async revalidation by copying |for_request|. |scheduler| must 38 // Starts an async revalidation by copying |for_request|. |scheduler| must
39 // remain valid until this object is destroyed. 39 // remain valid until this object is destroyed.
40 void BeginAsyncRevalidation(const net::URLRequest& for_request, 40 void BeginAsyncRevalidation(const net::URLRequest& for_request,
41 ResourceScheduler* scheduler); 41 ResourceScheduler* scheduler);
42 42
43 // Cancel all pending async revalidations that use ResourceContext. 43 // Cancel all pending async revalidations that use ResourceContext.
44 void CancelAsyncRevalidationsForResourceContext( 44 void CancelAsyncRevalidationsForResourceContext(
45 ResourceContext* resource_context); 45 ResourceContext* resource_context);
46 46
47 static bool QualifiesForAsyncRevalidation( 47 static bool QualifiesForAsyncRevalidation(const ResourceRequest& request);
48 const ResourceHostMsg_Request& request);
49 48
50 private: 49 private:
51 // The key of the map of pending async revalidations. This key has a distinct 50 // The key of the map of pending async revalidations. This key has a distinct
52 // value for every in-progress async revalidation. It is used to avoid 51 // value for every in-progress async revalidation. It is used to avoid
53 // duplicate async revalidations, and also to cancel affected async 52 // duplicate async revalidations, and also to cancel affected async
54 // revalidations when a ResourceContext is removed. 53 // revalidations when a ResourceContext is removed.
55 // 54 //
56 // Request headers are intentionally not included in the key for simplicity, 55 // Request headers are intentionally not included in the key for simplicity,
57 // as they usually don't affect caching. 56 // as they usually don't affect caching.
58 // 57 //
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Map of AsyncRevalidationDriver instances that are currently in-flight: 98 // Map of AsyncRevalidationDriver instances that are currently in-flight:
100 // either waiting to be scheduled or active on the network. 99 // either waiting to be scheduled or active on the network.
101 AsyncRevalidationMap in_progress_; 100 AsyncRevalidationMap in_progress_;
102 101
103 DISALLOW_COPY_AND_ASSIGN(AsyncRevalidationManager); 102 DISALLOW_COPY_AND_ASSIGN(AsyncRevalidationManager);
104 }; 103 };
105 104
106 } // namespace content 105 } // namespace content
107 106
108 #endif // CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_ 107 #endif // CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler.cc ('k') | content/browser/loader/async_revalidation_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698