| Index: content/browser/loader/resource_dispatcher_host_impl.cc
|
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| index 981c71ba454f337c573f6c9b64805d7934a13ce5..7fa16021fdebcc3bcbb9bd4ed81000c2a81e2c2a 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -47,6 +47,7 @@
|
| #include "content/browser/frame_host/navigator.h"
|
| #include "content/browser/loader/async_resource_handler.h"
|
| #include "content/browser/loader/async_revalidation_manager.h"
|
| +#include "content/browser/loader/content_size_resource_handler_manager.h"
|
| #include "content/browser/loader/cross_site_resource_handler.h"
|
| #include "content/browser/loader/detachable_resource_handler.h"
|
| #include "content/browser/loader/loader_delegate.h"
|
| @@ -1070,6 +1071,10 @@ std::unique_ptr<net::ClientCertStore>
|
|
|
| void ResourceDispatcherHostImpl::OnInit() {
|
| scheduler_.reset(new ResourceScheduler);
|
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kContentSizePolicy)) {
|
| + content_size_manager_.reset(new ContentSizeResourceHandlerManager());
|
| + }
|
| }
|
|
|
| void ResourceDispatcherHostImpl::OnShutdown() {
|
| @@ -1099,6 +1104,7 @@ void ResourceDispatcherHostImpl::OnShutdown() {
|
| }
|
|
|
| scheduler_.reset();
|
| + content_size_manager_.reset();
|
| }
|
|
|
| bool ResourceDispatcherHostImpl::OnMessageReceived(
|
| @@ -1679,6 +1685,14 @@ ResourceDispatcherHostImpl::AddStandardHandlers(
|
| BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
|
| }
|
|
|
| + // Insert a handler for inspecting content sizes as they come in. Note that
|
| + // this handler can cancel requests if they are associated with frames that go
|
| + // over a prescribed limit.
|
| + if (content_size_manager_) {
|
| + handler =
|
| + content_size_manager_->MaybeAddHandler(std::move(handler), request);
|
| + }
|
| +
|
| // TODO(ricea): Stop looking this up so much.
|
| ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
|
| throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id,
|
| @@ -2279,6 +2293,8 @@ void ResourceDispatcherHostImpl::SetLoaderDelegate(
|
| void ResourceDispatcherHostImpl::OnRenderFrameDeleted(
|
| const GlobalFrameRoutingId& global_routing_id) {
|
| CancelRequestsForRoute(global_routing_id);
|
| + if (content_size_manager_)
|
| + content_size_manager_->FrameDeleted(global_routing_id);
|
| }
|
|
|
| // static
|
|
|