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

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

Issue 1041993004: content::ResourceDispatcherHostImpl changes for stale-while-revalidate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s-w-r-yhirano-patch
Patch Set: Functional change: An initial redirect leg is now async revalidated. s-w-r is still ignored after t… Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This is the browser side of the resource dispatcher, it receives requests 5 // This is the browser side of the resource dispatcher, it receives requests
6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and
7 // dispatches them to URLRequests. It then forwards the messages from the 7 // dispatches them to URLRequests. It then forwards the messages from the
8 // URLRequests back to the correct process for handling. 8 // URLRequests back to the correct process for handling.
9 // 9 //
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
11 11
12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
14 14
15 #include <map> 15 #include <map>
16 #include <set> 16 #include <set>
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 #include "base/basictypes.h" 20 #include "base/basictypes.h"
21 #include "base/gtest_prod_util.h" 21 #include "base/gtest_prod_util.h"
22 #include "base/memory/linked_ptr.h" 22 #include "base/memory/linked_ptr.h"
23 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
24 #include "base/observer_list.h" 24 #include "base/observer_list.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
27 #include "content/browser/download/download_resource_handler.h" 27 #include "content/browser/download/download_resource_handler.h"
28 #include "content/browser/loader/async_revalidation_manager.h"
davidben 2015/11/23 23:40:43 Forward-decl
Adam Rice 2015/11/25 19:39:40 Done.
28 #include "content/browser/loader/global_routing_id.h" 29 #include "content/browser/loader/global_routing_id.h"
29 #include "content/browser/loader/resource_loader.h" 30 #include "content/browser/loader/resource_loader.h"
30 #include "content/browser/loader/resource_loader_delegate.h" 31 #include "content/browser/loader/resource_loader_delegate.h"
31 #include "content/browser/loader/resource_scheduler.h" 32 #include "content/browser/loader/resource_scheduler.h"
32 #include "content/common/content_export.h" 33 #include "content/common/content_export.h"
33 #include "content/common/resource_request_body.h" 34 #include "content/common/resource_request_body.h"
34 #include "content/public/browser/child_process_data.h" 35 #include "content/public/browser/child_process_data.h"
35 #include "content/public/browser/download_item.h" 36 #include "content/public/browser/download_item.h"
36 #include "content/public/browser/download_url_parameters.h" 37 #include "content/public/browser/download_url_parameters.h"
37 #include "content/public/browser/global_request_id.h" 38 #include "content/public/browser/global_request_id.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 void FinishedWithResourcesForRequest(net::URLRequest* request); 274 void FinishedWithResourcesForRequest(net::URLRequest* request);
274 275
275 // PlzNavigate: Begins a request for NavigationURLLoader. |loader| is the 276 // PlzNavigate: Begins a request for NavigationURLLoader. |loader| is the
276 // loader to attach to the leaf resource handler. 277 // loader to attach to the leaf resource handler.
277 void BeginNavigationRequest( 278 void BeginNavigationRequest(
278 ResourceContext* resource_context, 279 ResourceContext* resource_context,
279 const NavigationRequestInfo& info, 280 const NavigationRequestInfo& info,
280 NavigationURLLoaderImplCore* loader, 281 NavigationURLLoaderImplCore* loader,
281 ServiceWorkerNavigationHandleCore* service_worker_handle_core); 282 ServiceWorkerNavigationHandleCore* service_worker_handle_core);
282 283
284 // Turns on stale-while-revalidate support, regardless of command-line flags
285 // or experiment status. For unit tests only.
286 void EnableStaleWhileRevalidateForTesting();
287
283 private: 288 private:
284 friend class ResourceDispatcherHostTest; 289 friend class ResourceDispatcherHostTest;
285 290
286 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 291 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
287 TestBlockedRequestsProcessDies); 292 TestBlockedRequestsProcessDies);
288 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 293 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
289 CalculateApproximateMemoryCost); 294 CalculateApproximateMemoryCost);
290 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 295 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
291 DetachableResourceTimesOut); 296 DetachableResourceTimesOut);
292 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 297 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 base::TimeTicks last_user_gesture_time_; 586 base::TimeTicks last_user_gesture_time_;
582 587
583 // Used during IPC message dispatching so that the handlers can get a pointer 588 // Used during IPC message dispatching so that the handlers can get a pointer
584 // to the source of the message. 589 // to the source of the message.
585 ResourceMessageFilter* filter_; 590 ResourceMessageFilter* filter_;
586 591
587 ResourceDispatcherHostDelegate* delegate_; 592 ResourceDispatcherHostDelegate* delegate_;
588 593
589 bool allow_cross_origin_auth_prompt_; 594 bool allow_cross_origin_auth_prompt_;
590 595
596 // AsyncRevalidationManager is non-NULL if and only if
597 // stale-while-revalidate is enabled.
598 scoped_ptr<AsyncRevalidationManager> async_revalidation_manager_;
599
591 // http://crbug.com/90971 - Assists in tracking down use-after-frees on 600 // http://crbug.com/90971 - Assists in tracking down use-after-frees on
592 // shutdown. 601 // shutdown.
593 std::set<const ResourceContext*> active_resource_contexts_; 602 std::set<const ResourceContext*> active_resource_contexts_;
594 603
595 typedef std::map<GlobalRequestID, 604 typedef std::map<GlobalRequestID,
596 base::ObserverList<ResourceMessageDelegate>*> DelegateMap; 605 base::ObserverList<ResourceMessageDelegate>*> DelegateMap;
597 DelegateMap delegate_map_; 606 DelegateMap delegate_map_;
598 607
599 scoped_ptr<ResourceScheduler> scheduler_; 608 scoped_ptr<ResourceScheduler> scheduler_;
600 609
601 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 610 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
602 }; 611 };
603 612
604 } // namespace content 613 } // namespace content
605 614
606 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 615 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698