| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "extensions/browser/extension_host.h" |    5 #include "extensions/browser/extension_host.h" | 
|    6  |    6  | 
|    7 #include "base/logging.h" |    7 #include "base/logging.h" | 
|    8 #include "base/metrics/field_trial.h" |    8 #include "base/metrics/field_trial.h" | 
|    9 #include "base/metrics/histogram_macros.h" |    9 #include "base/metrics/histogram_macros.h" | 
|   10 #include "base/profiler/scoped_tracker.h" |   10 #include "base/profiler/scoped_tracker.h" | 
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  260  |  260  | 
|  261   // TODO(aa): This is suspicious. There can be multiple views in an extension, |  261   // TODO(aa): This is suspicious. There can be multiple views in an extension, | 
|  262   // and they aren't all going to use ExtensionHost. This should be in someplace |  262   // and they aren't all going to use ExtensionHost. This should be in someplace | 
|  263   // more central, like EPM maybe. |  263   // more central, like EPM maybe. | 
|  264   content::NotificationService::current()->Notify( |  264   content::NotificationService::current()->Notify( | 
|  265       extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |  265       extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 
|  266       content::Source<BrowserContext>(browser_context_), |  266       content::Source<BrowserContext>(browser_context_), | 
|  267       content::Details<ExtensionHost>(this)); |  267       content::Details<ExtensionHost>(this)); | 
|  268 } |  268 } | 
|  269  |  269  | 
|  270 void ExtensionHost::DidStartLoading(content::RenderViewHost* render_view_host) { |  270 void ExtensionHost::DidStartLoading() { | 
|  271   if (!has_loaded_once_) { |  271   if (!has_loaded_once_) { | 
|  272     FOR_EACH_OBSERVER(DeferredStartRenderHostObserver, |  272     FOR_EACH_OBSERVER(DeferredStartRenderHostObserver, | 
|  273                       deferred_start_render_host_observer_list_, |  273                       deferred_start_render_host_observer_list_, | 
|  274                       OnDeferredStartRenderHostDidStartFirstLoad(this)); |  274                       OnDeferredStartRenderHostDidStartFirstLoad(this)); | 
|  275   } |  275   } | 
|  276 } |  276 } | 
|  277  |  277  | 
|  278 void ExtensionHost::DidStopLoading(content::RenderViewHost* render_view_host) { |  278 void ExtensionHost::DidStopLoading() { | 
|  279   // Only record UMA for the first load. Subsequent loads will likely behave |  279   // Only record UMA for the first load. Subsequent loads will likely behave | 
|  280   // quite different, and it's first load we're most interested in. |  280   // quite different, and it's first load we're most interested in. | 
|  281   bool first_load = !has_loaded_once_; |  281   bool first_load = !has_loaded_once_; | 
|  282   has_loaded_once_ = true; |  282   has_loaded_once_ = true; | 
|  283   if (first_load) { |  283   if (first_load) { | 
|  284     RecordStopLoadingUMA(); |  284     RecordStopLoadingUMA(); | 
|  285     OnDidStopFirstLoad(); |  285     OnDidStopFirstLoad(); | 
|  286     content::NotificationService::current()->Notify( |  286     content::NotificationService::current()->Notify( | 
|  287         extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, |  287         extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, | 
|  288         content::Source<BrowserContext>(browser_context_), |  288         content::Source<BrowserContext>(browser_context_), | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  469       UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime2", |  469       UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime2", | 
|  470                                  load_start_->Elapsed()); |  470                                  load_start_->Elapsed()); | 
|  471     } |  471     } | 
|  472   } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { |  472   } else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) { | 
|  473     UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", |  473     UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2", | 
|  474                                load_start_->Elapsed()); |  474                                load_start_->Elapsed()); | 
|  475   } |  475   } | 
|  476 } |  476 } | 
|  477  |  477  | 
|  478 }  // namespace extensions |  478 }  // namespace extensions | 
| OLD | NEW |