| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/load_monitoring_extension_host_queue.h" | 5 #include "extensions/browser/load_monitoring_extension_host_queue.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 15 #include "extensions/browser/extension_host.h" | 15 #include "extensions/browser/extension_host.h" |
| 16 #include "extensions/browser/extension_host_observer.h" | 16 #include "extensions/browser/extension_host_observer.h" |
| 17 #include "extensions/browser/serial_extension_host_queue.h" | 17 #include "extensions/browser/serial_extension_host_queue.h" |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 | 20 |
| 21 LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( | 21 LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( |
| 22 scoped_ptr<ExtensionHostQueue> delegate, | 22 std::unique_ptr<ExtensionHostQueue> delegate, |
| 23 base::TimeDelta monitor_time, | 23 base::TimeDelta monitor_time, |
| 24 const FinishedCallback& finished_callback) | 24 const FinishedCallback& finished_callback) |
| 25 : delegate_(std::move(delegate)), | 25 : delegate_(std::move(delegate)), |
| 26 monitor_time_(monitor_time), | 26 monitor_time_(monitor_time), |
| 27 finished_callback_(finished_callback), | 27 finished_callback_(finished_callback), |
| 28 started_(false), | 28 started_(false), |
| 29 num_queued_(0u), | 29 num_queued_(0u), |
| 30 num_loaded_(0u), | 30 num_loaded_(0u), |
| 31 max_awaiting_loading_(0u), | 31 max_awaiting_loading_(0u), |
| 32 max_active_loading_(0u), | 32 max_active_loading_(0u), |
| 33 weak_ptr_factory_(this) {} | 33 weak_ptr_factory_(this) {} |
| 34 | 34 |
| 35 LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( | 35 LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( |
| 36 scoped_ptr<ExtensionHostQueue> delegate) | 36 std::unique_ptr<ExtensionHostQueue> delegate) |
| 37 : LoadMonitoringExtensionHostQueue(std::move(delegate), | 37 : LoadMonitoringExtensionHostQueue(std::move(delegate), |
| 38 base::TimeDelta::FromMinutes(1), | 38 base::TimeDelta::FromMinutes(1), |
| 39 FinishedCallback()) {} | 39 FinishedCallback()) {} |
| 40 | 40 |
| 41 LoadMonitoringExtensionHostQueue::~LoadMonitoringExtensionHostQueue() { | 41 LoadMonitoringExtensionHostQueue::~LoadMonitoringExtensionHostQueue() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 void LoadMonitoringExtensionHostQueue::StartMonitoring() { | 44 void LoadMonitoringExtensionHostQueue::StartMonitoring() { |
| 45 if (started_) { | 45 if (started_) { |
| 46 return; | 46 return; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 UMA_HISTOGRAM_COUNTS_100( | 111 UMA_HISTOGRAM_COUNTS_100( |
| 112 "Extensions.ExtensionHostMonitoring.MaxActiveLoading", | 112 "Extensions.ExtensionHostMonitoring.MaxActiveLoading", |
| 113 max_active_loading_); | 113 max_active_loading_); |
| 114 if (!finished_callback_.is_null()) { | 114 if (!finished_callback_.is_null()) { |
| 115 finished_callback_.Run(num_queued_, num_loaded_, max_awaiting_loading_, | 115 finished_callback_.Run(num_queued_, num_loaded_, max_awaiting_loading_, |
| 116 max_active_loading_); | 116 max_active_loading_); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace extensions | 120 } // namespace extensions |
| OLD | NEW |