OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/performance_monitor/performance_monitor.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/threading/worker_pool.h" | 16 #include "base/threading/worker_pool.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/browser_shutdown.h" | 19 #include "chrome/browser/browser_shutdown.h" |
20 #include "chrome/browser/extensions/crx_installer.h" | 20 #include "chrome/browser/extensions/crx_installer.h" |
21 #include "chrome/browser/performance_monitor/constants.h" | 21 #include "chrome/browser/performance_monitor/constants.h" |
22 #include "chrome/browser/performance_monitor/performance_monitor_util.h" | 22 #include "chrome/browser/performance_monitor/performance_monitor_util.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_iterator.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
30 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
31 #include "chrome/common/extensions/extension_constants.h" | 31 #include "chrome/common/extensions/extension_constants.h" |
32 #include "chrome/test/base/chrome_process_util.h" | 32 #include "chrome/test/base/chrome_process_util.h" |
33 #include "content/public/browser/browser_child_process_host.h" | 33 #include "content/public/browser/browser_child_process_host.h" |
34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/load_notification_details.h" | 35 #include "content/public/browser/load_notification_details.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 391 } |
392 | 392 |
393 metrics_map_.reset(new_map); | 393 metrics_map_.reset(new_map); |
394 } | 394 } |
395 | 395 |
396 void PerformanceMonitor::UpdateLiveProfiles() { | 396 void PerformanceMonitor::UpdateLiveProfiles() { |
397 std::string time = TimeToString(base::Time::Now()); | 397 std::string time = TimeToString(base::Time::Now()); |
398 scoped_ptr<std::set<std::string> > active_profiles( | 398 scoped_ptr<std::set<std::string> > active_profiles( |
399 new std::set<std::string>()); | 399 new std::set<std::string>()); |
400 | 400 |
401 for (BrowserList::const_iterator iter = BrowserList::begin(); | 401 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
402 iter != BrowserList::end(); ++iter) { | 402 active_profiles->insert(it->profile()->GetDebugName()); |
403 active_profiles->insert((*iter)->profile()->GetDebugName()); | |
404 } | |
405 | 403 |
406 BrowserThread::PostBlockingPoolSequencedTask( | 404 BrowserThread::PostBlockingPoolSequencedTask( |
407 Database::kDatabaseSequenceToken, | 405 Database::kDatabaseSequenceToken, |
408 FROM_HERE, | 406 FROM_HERE, |
409 base::Bind(&PerformanceMonitor::UpdateLiveProfilesHelper, | 407 base::Bind(&PerformanceMonitor::UpdateLiveProfilesHelper, |
410 base::Unretained(this), | 408 base::Unretained(this), |
411 base::Passed(active_profiles.Pass()), | 409 base::Passed(active_profiles.Pass()), |
412 time)); | 410 time)); |
413 } | 411 } |
414 | 412 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 if (!url_list.empty()) | 621 if (!url_list.empty()) |
624 url_list += ", "; | 622 url_list += ", "; |
625 | 623 |
626 url_list += url; | 624 url_list += url; |
627 } | 625 } |
628 | 626 |
629 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); | 627 AddEvent(util::CreateRendererFailureEvent(base::Time::Now(), type, url_list)); |
630 } | 628 } |
631 | 629 |
632 } // namespace performance_monitor | 630 } // namespace performance_monitor |
OLD | NEW |