| Index: content/browser/loader/resource_scheduler.cc
|
| diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc
|
| index 2e1c500cc10cb84f07534a4aeaf5fe4d72200197..f2b329fc15956d5944af049ed228794848a1efc4 100644
|
| --- a/content/browser/loader/resource_scheduler.cc
|
| +++ b/content/browser/loader/resource_scheduler.cc
|
| @@ -227,6 +227,7 @@ class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
|
| scheduler_(scheduler),
|
| priority_(priority),
|
| fifo_ordering_(0),
|
| + peak_delayable_requests_in_flight_(0u),
|
| host_port_pair_(net::HostPortPair::FromURL(request->url())),
|
| weak_ptr_factory_(this) {
|
| DCHECK(!request_->GetUserData(kUserDataKey));
|
| @@ -234,6 +235,16 @@ class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
|
| }
|
|
|
| ~ScheduledResourceRequest() override {
|
| + if ((attributes_ & kAttributeLayoutBlocking) == kAttributeLayoutBlocking) {
|
| + UMA_HISTOGRAM_COUNTS_100(
|
| + "ResourceScheduler.PeakDelayableRequestsInFlight.LayoutBlocking",
|
| + peak_delayable_requests_in_flight_);
|
| + }
|
| + if (!((attributes_ & kAttributeDelayable) == kAttributeDelayable)) {
|
| + UMA_HISTOGRAM_COUNTS_100(
|
| + "ResourceScheduler.PeakDelayableRequestsInFlight.NonDelayable",
|
| + peak_delayable_requests_in_flight_);
|
| + }
|
| request_->RemoveUserData(kUserDataKey);
|
| scheduler_->RemoveRequest(this);
|
| }
|
| @@ -274,6 +285,11 @@ class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
|
| ready_ = true;
|
| }
|
|
|
| + void UpdateDelayableRequestsInFlight(size_t delayable_requests_in_flight) {
|
| + peak_delayable_requests_in_flight_ = std::max(
|
| + peak_delayable_requests_in_flight_, delayable_requests_in_flight);
|
| + }
|
| +
|
| void set_request_priority_params(const RequestPriorityParams& priority) {
|
| priority_ = priority;
|
| }
|
| @@ -328,6 +344,9 @@ class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
|
| ResourceScheduler* scheduler_;
|
| RequestPriorityParams priority_;
|
| uint32_t fifo_ordering_;
|
| +
|
| + // Maximum number of delayable requests in-flight when |this| was in-flight.
|
| + size_t peak_delayable_requests_in_flight_;
|
| // Cached to excessive recomputation in ShouldKeepSearching.
|
| const net::HostPortPair host_port_pair_;
|
|
|
| @@ -494,9 +513,40 @@ class ResourceScheduler::Client {
|
| YIELD_SCHEDULER
|
| };
|
|
|
| + // Records the metrics related to number of requests in flight.
|
| + void RecordRequestCountMetrics() const {
|
| + UMA_HISTOGRAM_COUNTS_100("ResourceScheduler.RequestsCount.All",
|
| + in_flight_requests_.size());
|
| + UMA_HISTOGRAM_COUNTS_100("ResourceScheduler.RequestsCount.Delayable",
|
| + in_flight_delayable_count_);
|
| + UMA_HISTOGRAM_COUNTS_100(
|
| + "ResourceScheduler.RequestsCount.NonDelayable",
|
| + in_flight_requests_.size() - in_flight_delayable_count_);
|
| + UMA_HISTOGRAM_COUNTS_100(
|
| + "ResourceScheduler.RequestsCount.TotalLayoutBlocking",
|
| + total_layout_blocking_count_);
|
| + }
|
| +
|
| void InsertInFlightRequest(ScheduledResourceRequest* request) {
|
| in_flight_requests_.insert(request);
|
| SetRequestAttributes(request, DetermineRequestAttributes(request));
|
| + RecordRequestCountMetrics();
|
| +
|
| + if (RequestAttributesAreSet(request->attributes(), kAttributeDelayable)) {
|
| + // Notify all in-flight with the new count of in-flight delayable
|
| + // requests.
|
| + for (RequestSet::const_iterator it = in_flight_requests_.begin();
|
| + it != in_flight_requests_.end(); ++it) {
|
| + (*it)->UpdateDelayableRequestsInFlight(in_flight_delayable_count_);
|
| + }
|
| + }
|
| +
|
| + if (RequestAttributesAreSet(request->attributes(),
|
| + kAttributeLayoutBlocking) ||
|
| + !RequestAttributesAreSet(request->attributes(), kAttributeDelayable)) {
|
| + // |request| is either a layout blocking or a non-delayable request.
|
| + request->UpdateDelayableRequestsInFlight(in_flight_delayable_count_);
|
| + }
|
| }
|
|
|
| void EraseInFlightRequest(ScheduledResourceRequest* request) {
|
|
|