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 1c745bd13091ce73f90d60c269588b81656995a1..7ccc9fa3fb7352087528f714b2ec84ac95dc6f8d 100644 |
--- a/content/browser/loader/resource_dispatcher_host_impl.h |
+++ b/content/browser/loader/resource_dispatcher_host_impl.h |
@@ -38,7 +38,9 @@ |
#include "content/public/browser/download_url_parameters.h" |
#include "content/public/browser/global_request_id.h" |
#include "content/public/browser/notification_types.h" |
+#include "content/public/browser/render_view_host.h" |
Randy Smith (Not in Mondays)
2016/01/20 23:23:19
Why?
Charlie Harrison
2016/01/21 18:52:55
Removed.
|
#include "content/public/browser/resource_dispatcher_host.h" |
+#include "content/public/browser/web_contents_observer.h" |
#include "content/public/common/resource_type.h" |
#include "ipc/ipc_message.h" |
#include "net/base/request_priority.h" |
@@ -63,6 +65,7 @@ class ShareableFileReference; |
namespace content { |
class AppCacheService; |
class AsyncRevalidationManager; |
+class FrameTree; |
class NavigationURLLoaderImplCore; |
class ResourceContext; |
class ResourceDispatcherHostDelegate; |
@@ -77,6 +80,23 @@ struct DownloadSaveInfo; |
struct NavigationRequestInfo; |
struct Referrer; |
+// This class is responsible for notifying the IO thread (specifically, the |
+// ResourceDispatcherHostImpl) of frame events. It has an interace for callers |
+// to use and also sends notifications on WebContentsObserver events. All |
+// methods (static or class) will be called from the UI thread and post to the |
+// IO |
+// thread. |
nasko
2016/01/16 00:15:58
This can fit with the previous line :).
Charlie Harrison
2016/01/21 18:52:55
Done. Oops :)
|
+// TODO(csharrison): Add methods tracking visibility and audio changes, to |
+// propogate to the ResourceScheduler. |
+class LoaderIOThreadNotifier : public WebContentsObserver { |
+ public: |
+ explicit LoaderIOThreadNotifier(WebContents* web_contents); |
+ ~LoaderIOThreadNotifier() override; |
+ |
+ // content::WebContentsObserver: |
+ void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
+}; |
+ |
class CONTENT_EXPORT ResourceDispatcherHostImpl |
: public ResourceDispatcherHost, |
public ResourceLoaderDelegate { |
@@ -88,6 +108,21 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
// hasn't been created yet. |
static ResourceDispatcherHostImpl* Get(); |
+ // This method notifies the RDHI concerning the status of an entire frame |
+ // tree. This will correspond to page-level events affecting resource loading. |
+ static void NotifyForEachFrame( |
+ FrameTree* frame_tree, |
+ base::Callback<void(ResourceDispatcherHostImpl*, |
+ const GlobalFrameRoutingId&)> frame_callback); |
+ |
+ // This method notifies the RDHI concerning the status of a frame. Consumers |
+ // should use the public ResourceDispatcherHost static methods if the |
+ // RenderFrameHost is available. |
+ static void NotifyForRoute(const GlobalFrameRoutingId& routing_id, |
+ base::Callback<void(ResourceDispatcherHostImpl*, |
+ const GlobalFrameRoutingId&)> |
+ frame_callback); |
+ |
// ResourceDispatcherHost implementation: |
void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; |
void SetAllowCrossOriginAuthPrompt(bool value) override; |
@@ -105,8 +140,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
uint32_t download_id, |
const DownloadStartedCallback& started_callback) override; |
void ClearLoginDelegateForRequest(net::URLRequest* request) override; |
- void BlockRequestsForRoute(int child_id, int route_id) override; |
- void ResumeBlockedRequestsForRoute(int child_id, int route_id) override; |
// Puts the resource dispatcher host in an inactive state (unable to begin |
// new requests). Cancels all pending requests. |
@@ -176,6 +209,8 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
return save_file_manager_.get(); |
} |
+ void OnRenderFrameDeleted(const GlobalFrameRoutingId& routing_id); |
+ |
// Called when a RenderViewHost is created. |
void OnRenderViewHostCreated(int child_id, |
int route_id, |
@@ -211,8 +246,15 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
void RemovePendingRequest(int child_id, int request_id); |
+ // Causes all new requests for the route identified by |routing_id| to be |
+ // blocked (not being started) until ResumeBlockedRequestsForRoute is called. |
+ void BlockRequestsForRoute(const GlobalFrameRoutingId& routing_id); |
+ |
+ // Resumes any blocked request for the specified route id. |
+ void ResumeBlockedRequestsForRoute(const GlobalFrameRoutingId& routing_id); |
+ |
// Cancels any blocked request for the specified route id. |
- void CancelBlockedRequestsForRoute(int child_id, int route_id); |
+ void CancelBlockedRequestsForRoute(const GlobalFrameRoutingId& routing_id); |
// Maintains a collection of temp files created in support of |
// the download_to_file capability. Used to grant access to the |
@@ -378,8 +420,9 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
static int CalculateApproximateMemoryCost(net::URLRequest* request); |
// Force cancels any pending requests for the given route id. This method |
- // acts like CancelRequestsForProcess when route_id is -1. |
- void CancelRequestsForRoute(int child_id, int route_id); |
+ // acts like CancelRequestsForProcess when the |route_id| member of |
+ // |routing_id| is -1. |
nasko
2016/01/16 00:15:58
MSG_ROUTING_NONE
Charlie Harrison
2016/01/21 18:52:55
Done.
|
+ void CancelRequestsForRoute(const GlobalFrameRoutingId& routing_id); |
// The list of all requests that we have pending. This list is not really |
// optimized, and assumes that we have relatively few requests pending at once |
@@ -424,8 +467,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
void UpdateLoadInfo(); |
// Resumes or cancels (if |cancel_requests| is true) any blocked requests. |
- void ProcessBlockedRequestsForRoute(int child_id, |
- int route_id, |
+ void ProcessBlockedRequestsForRoute(const GlobalFrameRoutingId& routing_id, |
bool cancel_requests); |
void OnRequestResource(int routing_id, |
@@ -551,7 +593,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
bool is_shutdown_; |
typedef std::vector<linked_ptr<ResourceLoader> > BlockedLoadersList; |
- typedef std::map<GlobalRoutingID, BlockedLoadersList*> BlockedLoadersMap; |
+ typedef std::map<GlobalFrameRoutingId, BlockedLoadersList*> BlockedLoadersMap; |
BlockedLoadersMap blocked_loaders_map_; |
// Maps the child_ids to the approximate number of bytes |