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

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

Issue 12886022: Implement offline mode behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to r193064. Created 7 years, 8 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 | Annotate | Revision Log
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.h" 25 #include "base/time.h"
26 #include "base/timer.h" 26 #include "base/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/offline_policy.h"
28 #include "content/browser/loader/render_view_host_tracker.h" 29 #include "content/browser/loader/render_view_host_tracker.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/public/browser/child_process_data.h" 34 #include "content/public/browser/child_process_data.h"
34 #include "content/public/browser/download_id.h" 35 #include "content/public/browser/download_id.h"
35 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/resource_dispatcher_host.h" 37 #include "content/public/browser/resource_dispatcher_host.h"
37 #include "ipc/ipc_message.h" 38 #include "ipc/ipc_message.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ResourceScheduler* scheduler() { return scheduler_.get(); } 231 ResourceScheduler* scheduler() { return scheduler_.get(); }
231 232
232 private: 233 private:
233 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 234 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
234 TestBlockedRequestsProcessDies); 235 TestBlockedRequestsProcessDies);
235 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 236 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
236 IncrementOutstandingRequestsMemoryCost); 237 IncrementOutstandingRequestsMemoryCost);
237 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 238 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
238 CalculateApproximateMemoryCost); 239 CalculateApproximateMemoryCost);
239 240
241 typedef std::pair<int, int> ProcessRouteIDs;
darin (slow to review) 2013/04/11 20:01:23 nit: maybe call this GlobalRoutingID? maybe it sh
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Happy to take your guidance on this; I was just co
242
240 class ShutdownTask; 243 class ShutdownTask;
241 244
242 friend class ShutdownTask; 245 friend class ShutdownTask;
243 friend class ResourceMessageDelegate; 246 friend class ResourceMessageDelegate;
244 247
245 // ResourceLoaderDelegate implementation: 248 // ResourceLoaderDelegate implementation:
246 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( 249 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
247 ResourceLoader* loader, 250 ResourceLoader* loader,
248 net::AuthChallengeInfo* auth_info) OVERRIDE; 251 net::AuthChallengeInfo* auth_info) OVERRIDE;
249 virtual bool AcceptAuthRequest( 252 virtual bool AcceptAuthRequest(
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // used as a special value all over the resource_dispatcher_host for 405 // used as a special value all over the resource_dispatcher_host for
403 // uninitialized variables.) This way, we no longer have the unlikely (but 406 // uninitialized variables.) This way, we no longer have the unlikely (but
404 // observed in the real world!) event where we have two requests with the same 407 // observed in the real world!) event where we have two requests with the same
405 // request_id_. 408 // request_id_.
406 int request_id_; 409 int request_id_;
407 410
408 // True if the resource dispatcher host has been shut down. 411 // True if the resource dispatcher host has been shut down.
409 bool is_shutdown_; 412 bool is_shutdown_;
410 413
411 typedef std::vector<linked_ptr<ResourceLoader> > BlockedLoadersList; 414 typedef std::vector<linked_ptr<ResourceLoader> > BlockedLoadersList;
412 typedef std::pair<int, int> ProcessRouteIDs;
413 typedef std::map<ProcessRouteIDs, BlockedLoadersList*> BlockedLoadersMap; 415 typedef std::map<ProcessRouteIDs, BlockedLoadersList*> BlockedLoadersMap;
414 BlockedLoadersMap blocked_loaders_map_; 416 BlockedLoadersMap blocked_loaders_map_;
415 417
416 // Maps the child_ids to the approximate number of bytes 418 // Maps the child_ids to the approximate number of bytes
417 // being used to service its resource requests. No entry implies 0 cost. 419 // being used to service its resource requests. No entry implies 0 cost.
418 typedef std::map<int, int> OutstandingRequestsMemoryCostMap; 420 typedef std::map<int, int> OutstandingRequestsMemoryCostMap;
419 OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_; 421 OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_;
420 422
421 // |max_outstanding_requests_cost_per_process_| is the upper bound on how 423 // |max_outstanding_requests_cost_per_process_| is the upper bound on how
422 // many outstanding requests can be issued per child process host. 424 // many outstanding requests can be issued per child process host.
(...skipping 22 matching lines...) Expand all
445 std::set<const ResourceContext*> active_resource_contexts_; 447 std::set<const ResourceContext*> active_resource_contexts_;
446 448
447 typedef std::map<GlobalRequestID, 449 typedef std::map<GlobalRequestID,
448 ObserverList<ResourceMessageDelegate>*> DelegateMap; 450 ObserverList<ResourceMessageDelegate>*> DelegateMap;
449 DelegateMap delegate_map_; 451 DelegateMap delegate_map_;
450 452
451 scoped_ptr<ResourceScheduler> scheduler_; 453 scoped_ptr<ResourceScheduler> scheduler_;
452 454
453 RenderViewHostTracker tracker_; // Lives on UI thread. 455 RenderViewHostTracker tracker_; // Lives on UI thread.
454 456
457 typedef std::map<ProcessRouteIDs, OfflinePolicy*> OfflineMap;
458
459 OfflineMap offline_map_;
darin (slow to review) 2013/04/11 20:01:23 nit: I think it'd read better in the .cc file if t
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done.
460
455 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 461 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
456 }; 462 };
457 463
458 } // namespace content 464 } // namespace content
459 465
460 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 466 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698