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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.h

Issue 11270027: Add a ResourceScheduler to ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 8 years 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
Index: content/browser/loader/resource_dispatcher_host_impl.h
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index 20b3d5515ccfd50c13fc352bc24fe6dc09e9cc1b..b2cef3f94e213b0ea654de19c4438a233ef6998c 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -26,6 +26,7 @@
#include "content/browser/download/download_resource_handler.h"
#include "content/browser/loader/resource_loader.h"
#include "content/browser/loader/resource_loader_delegate.h"
+#include "content/browser/loader/resource_scheduler.h"
#include "content/common/content_export.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/notification_types.h"
@@ -199,6 +200,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
return delegate_;
}
+ ResourceScheduler* scheduler() {
+ return &resource_scheduler_;
+ }
+
// Must be called after the ResourceRequestInfo has been created
// and associated with the request.
scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload(
@@ -261,7 +266,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
scoped_ptr<ResourceHandler> handler);
void StartLoading(ResourceRequestInfoImpl* info,
- const linked_ptr<ResourceLoader>& loader);
+ scoped_ptr<ResourceLoader> loader);
// Updates the "cost" of outstanding requests for |child_id|.
// The "cost" approximates how many bytes are consumed by all the in-memory
@@ -275,13 +280,12 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Estimate how much heap space |request| will consume to run.
static int CalculateApproximateMemoryCost(net::URLRequest* request);
- // The list of all requests that we have pending. This list is not really
+ // The list of all requests that we have scheduled. This list is not really
// optimized, and assumes that we have relatively few requests pending at once
// since some operations require brute-force searching of the list.
//
- // It may be enhanced in the future to provide some kind of prioritization
- // mechanism. We should also consider a hashtable or binary tree if it turns
- // out we have a lot of things here.
+ // We should also consider a hashtable or binary tree if it turns out we have
+ // a lot of things here.
typedef std::map<GlobalRequestID, linked_ptr<ResourceLoader> > LoaderMap;
// Deletes the pending request identified by the iterator passed in.
@@ -377,7 +381,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// True if the resource dispatcher host has been shut down.
bool is_shutdown_;
- typedef std::vector<linked_ptr<ResourceLoader> > BlockedLoadersList;
+ typedef ScopedVector<ResourceLoader> BlockedLoadersList;
typedef std::pair<int, int> ProcessRouteIDs;
typedef std::map<ProcessRouteIDs, BlockedLoadersList*> BlockedLoadersMap;
BlockedLoadersMap blocked_loaders_map_;
@@ -413,9 +417,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// shutdown.
std::set<const ResourceContext*> active_resource_contexts_;
+ ResourceScheduler resource_scheduler_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
};
} // namespace content
-#endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
+#endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698