| Index: chrome/browser/extensions/user_script_listener.cc
|
| diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc
|
| index 232b365e0067ea526dc364614f3f2da6bab14da0..56a8c35986218a020d2847a13f00af1eb9d19a2c 100644
|
| --- a/chrome/browser/extensions/user_script_listener.cc
|
| +++ b/chrome/browser/extensions/user_script_listener.cc
|
| @@ -5,6 +5,8 @@
|
| #include "chrome/browser/extensions/user_script_listener.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| +#include "base/timer/elapsed_timer.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
|
| @@ -34,8 +36,11 @@ class UserScriptListener::Throttle
|
| DCHECK(should_defer_);
|
| should_defer_ = false;
|
| // Only resume the request if |this| has deferred it.
|
| - if (did_defer_)
|
| + if (did_defer_) {
|
| + UMA_HISTOGRAM_TIMES("Extensions.ThrottledNetworkRequestDelay",
|
| + timer_->Elapsed());
|
| controller()->Resume();
|
| + }
|
| }
|
|
|
| // ResourceThrottle implementation:
|
| @@ -44,6 +49,7 @@ class UserScriptListener::Throttle
|
| if (should_defer_) {
|
| *defer = true;
|
| did_defer_ = true;
|
| + timer_.reset(new base::ElapsedTimer());
|
| }
|
| }
|
|
|
| @@ -54,6 +60,9 @@ class UserScriptListener::Throttle
|
| private:
|
| bool should_defer_;
|
| bool did_defer_;
|
| + scoped_ptr<base::ElapsedTimer> timer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(Throttle);
|
| };
|
|
|
| struct UserScriptListener::ProfileData {
|
| @@ -131,6 +140,8 @@ bool UserScriptListener::ShouldDelayRequest(const GURL& url,
|
| }
|
|
|
| void UserScriptListener::StartDelayedRequests() {
|
| + UMA_HISTOGRAM_COUNTS_100("Extensions.ThrottledNetworkRequests",
|
| + throttles_.size());
|
| WeakThrottleList::const_iterator it;
|
| for (it = throttles_.begin(); it != throttles_.end(); ++it) {
|
| if (it->get())
|
|
|