| 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 648822822bc627cc3549f69ebe7d5a8a7d724206..1dab73f4b468e7d08b947505ccb1d7cb3f683945 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.h
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.h
|
| @@ -30,6 +30,7 @@
|
| #include "content/browser/loader/global_routing_id.h"
|
| #include "content/browser/loader/resource_loader.h"
|
| #include "content/browser/loader/resource_loader_delegate.h"
|
| +#include "content/browser/loader/resource_request_info_impl.h"
|
| #include "content/browser/loader/resource_scheduler.h"
|
| #include "content/common/content_export.h"
|
| #include "content/common/resource_request_body.h"
|
| @@ -342,15 +343,42 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
|
| friend class ResourceMessageDelegate;
|
|
|
| // Information about status of a ResourceLoader.
|
| - struct LoadInfo {
|
| + struct CONTENT_EXPORT LoadInfo {
|
| + LoadInfo();
|
| + LoadInfo(const LoadInfo& info);
|
| + ~LoadInfo();
|
| +
|
| + bool IsUploading() const;
|
| +
|
| + // This function returns true if the LoadInfo of |a| is "more interesting"
|
| + // than the LoadInfo of |b|. The load that is currently sending the larger
|
| + // request body is considered more interesting. If neither request is
|
| + // sending a body (Neither request has a body, or any request that has a
|
| + // body is not currently sending the body), the request that is further
|
| + // along is considered more interesting.
|
| + //
|
| + // This takes advantage of the fact that the load states are an enumeration
|
| + // listed in the order in which they usually occur during the lifetime of a
|
| + // request, so states with larger numeric values are generally further along
|
| + // toward completion.
|
| + //
|
| + // For example, by this measure "tranferring data" is a more interesting
|
| + // state than "resolving host" because when transferring data something is
|
| + // being done that corresponds to changes that the user might observe,
|
| + // whereas waiting for a host name to resolve implies being stuck.
|
| + bool IsMoreInteresting(const LoadInfo& other) const;
|
| +
|
| GURL url;
|
| net::LoadStateWithParam load_state;
|
| uint64_t upload_position;
|
| uint64_t upload_size;
|
| +
|
| + // Associates the load with a web contents.
|
| + ResourceRequestInfo::WebContentsGetter web_contents_getter;
|
| };
|
|
|
| - // Map from ProcessID+RouteID pair to the "most interesting" LoadState.
|
| - typedef std::map<GlobalRoutingID, LoadInfo> LoadInfoMap;
|
| + // Map from ProcessID+FrameRouteID pair to the "most interesting" LoadState.
|
| + typedef std::map<GlobalFrameRoutingId, LoadInfo> LoadInfoMap;
|
|
|
| // ResourceLoaderDelegate implementation:
|
| ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
|
| @@ -430,29 +458,14 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
|
| // not rely on this iterator being valid on return.
|
| void RemovePendingLoader(const LoaderMap::iterator& iter);
|
|
|
| - // This function returns true if the LoadInfo of |a| is "more interesting"
|
| - // than the LoadInfo of |b|. The load that is currently sending the larger
|
| - // request body is considered more interesting. If neither request is
|
| - // sending a body (Neither request has a body, or any request that has a body
|
| - // is not currently sending the body), the request that is further along is
|
| - // considered more interesting.
|
| - //
|
| - // This takes advantage of the fact that the load states are an enumeration
|
| - // listed in the order in which they usually occur during the lifetime of a
|
| - // request, so states with larger numeric values are generally further along
|
| - // toward completion.
|
| - //
|
| - // For example, by this measure "tranferring data" is a more interesting state
|
| - // than "resolving host" because when transferring data something is being
|
| - // done that corresponds to changes that the user might observe, whereas
|
| - // waiting for a host name to resolve implies being stuck.
|
| - static bool LoadInfoIsMoreInteresting(const LoadInfo& a, const LoadInfo& b);
|
| -
|
| // Used to marshal calls to LoadStateChanged from the IO to UI threads. All
|
| - // are done as a single callback to avoid spamming the UI thread.
|
| + // are done as a single callback to avoid spamming the UI thread. Note that
|
| + // GetLoadInfoForAllRoutes de-dupes based on frame, but not based on tab.
|
| + // Thus, logic here also constructs a map and finds the most interesting load
|
| + // state per WebContents.
|
| static void UpdateLoadInfoOnUIThread(std::unique_ptr<LoadInfoMap> info_map);
|
|
|
| - // Gets the most interesting LoadInfo for each GlobalRoutingID.
|
| + // Gets the most interesting LoadInfo for each GlobalFrameRoutingID.
|
| std::unique_ptr<LoadInfoMap> GetLoadInfoForAllRoutes();
|
|
|
| // Checks all pending requests and updates the load info if necessary.
|
|
|