Index: extensions/browser/extension_host.cc |
diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc |
index 7874528d272ba54f76d1f4c78d462533d2b78fc4..f82480c27b9a15331228ef918c81ababb19f6a80 100644 |
--- a/extensions/browser/extension_host.cc |
+++ b/extensions/browser/extension_host.cc |
@@ -12,7 +12,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/metrics/field_trial.h" |
-#include "base/metrics/histogram.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "content/public/browser/browser_context.h" |
@@ -152,9 +152,10 @@ ExtensionHost::ExtensionHost(const Extension* extension, |
ExtensionHost::~ExtensionHost() { |
if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE && |
- extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { |
+ extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_) && |
+ since_created_.get()) { |
UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime", |
- since_created_.Elapsed()); |
+ since_created_->Elapsed()); |
} |
content::NotificationService::current()->Notify( |
extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
@@ -238,6 +239,7 @@ const GURL& ExtensionHost::GetURL() const { |
} |
void ExtensionHost::LoadInitialURL() { |
+ since_created_.reset(new base::ElapsedTimer()); |
host_contents_->GetController().LoadURL( |
initial_url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
std::string()); |
@@ -306,23 +308,24 @@ void ExtensionHost::DidStopLoading(content::RenderViewHost* render_view_host) { |
did_stop_loading_ = true; |
OnDidStopLoading(); |
if (notify) { |
+ CHECK(since_created_.get()); |
if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
if (extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) { |
- UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime", |
- since_created_.Elapsed()); |
+ UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.EventPageLoadTime", |
Yoyo Zhou
2015/02/06 01:59:12
I think this is the right change, even though on m
|
+ since_created_->Elapsed()); |
} else { |
- UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", |
- since_created_.Elapsed()); |
+ UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime", |
+ since_created_->Elapsed()); |
Ilya Sherman
2015/02/06 02:56:13
If you change what macro is used -- really, if you
|
} |
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_DIALOG) { |
UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", |
- since_created_.Elapsed()); |
+ since_created_->Elapsed()); |
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { |
UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime", |
- since_created_.Elapsed()); |
+ since_created_->Elapsed()); |
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_INFOBAR) { |
UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime", |
- since_created_.Elapsed()); |
+ since_created_->Elapsed()); |
} |
// Send the notification last, because it might result in this being |