Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/task_manager.h" | 5 #include "chrome/browser/task_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/task_manager_resource_providers.h" | 22 #include "chrome/browser/task_manager_resource_providers.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/pref_service.h" | 24 #include "chrome/common/pref_service.h" |
| 25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 26 #include "grit/app_resources.h" | 26 #include "grit/app_resources.h" |
| 27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
| 30 #include "net/url_request/url_request_job.h" | 30 #include "net/url_request/url_request_job.h" |
| 31 | 31 |
| 32 #if defined(OS_MACOSX) | |
| 33 #include "chrome/browser/mach_broker_mac.h" | |
| 34 #endif | |
| 35 | |
| 32 namespace { | 36 namespace { |
| 33 | 37 |
| 34 // The delay between updates of the information (in ms). | 38 // The delay between updates of the information (in ms). |
| 35 const int kUpdateTimeMs = 1000; | 39 const int kUpdateTimeMs = 1000; |
| 36 | 40 |
| 37 template <class T> | 41 template <class T> |
| 38 int ValueCompare(T value1, T value2) { | 42 int ValueCompare(T value1, T value2) { |
| 39 if (value1 < value2) | 43 if (value1 < value2) |
| 40 return -1; | 44 return -1; |
| 41 if (value1 == value2) | 45 if (value1 == value2) |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 new_entry_index = static_cast<int>(iter - resources_.begin()); | 533 new_entry_index = static_cast<int>(iter - resources_.begin()); |
| 530 resources_.insert(++iter, resource); | 534 resources_.insert(++iter, resource); |
| 531 } | 535 } |
| 532 | 536 |
| 533 // Create the ProcessMetrics for this process if needed (not in map). | 537 // Create the ProcessMetrics for this process if needed (not in map). |
| 534 if (metrics_map_.find(process) == metrics_map_.end()) { | 538 if (metrics_map_.find(process) == metrics_map_.end()) { |
| 535 base::ProcessMetrics* pm = | 539 base::ProcessMetrics* pm = |
| 536 #if !defined(OS_MACOSX) | 540 #if !defined(OS_MACOSX) |
| 537 base::ProcessMetrics::CreateProcessMetrics(process); | 541 base::ProcessMetrics::CreateProcessMetrics(process); |
| 538 #else | 542 #else |
| 539 // TODO(thakis): Write a port provider that knows the task ports of | 543 base::ProcessMetrics::CreateProcessMetrics(process, |
| 540 // child processes. | 544 MachBroker::instance()); |
|
jeremy
2009/12/19 20:49:10
Can CreateProcessMetrics call MachBroker::instance
Mark Mentovai
2009/12/21 19:23:10
If we can come up with a way to do this without th
| |
| 541 base::ProcessMetrics::CreateProcessMetrics(process, NULL); | |
| 542 #endif | 545 #endif |
| 543 | 546 |
| 544 metrics_map_[process] = pm; | 547 metrics_map_[process] = pm; |
| 545 } | 548 } |
| 546 | 549 |
| 547 // Notify the table that the contents have changed for it to redraw. | 550 // Notify the table that the contents have changed for it to redraw. |
| 548 FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, | 551 FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, |
| 549 OnItemsAdded(new_entry_index, 1)); | 552 OnItemsAdded(new_entry_index, 1)); |
| 550 } | 553 } |
| 551 | 554 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 // or popup, we can only have one tab, hence we need to process this in a | 894 // or popup, we can only have one tab, hence we need to process this in a |
| 892 // tabbed browser window. Currently, |browser| is pointing to the application, | 895 // tabbed browser window. Currently, |browser| is pointing to the application, |
| 893 // popup window. Therefore, we have to retrieve the last active tab again, | 896 // popup window. Therefore, we have to retrieve the last active tab again, |
| 894 // since a new window has been used. | 897 // since a new window has been used. |
| 895 if (browser->type() & Browser::TYPE_APP_POPUP) { | 898 if (browser->type() & Browser::TYPE_APP_POPUP) { |
| 896 browser = BrowserList::GetLastActive(); | 899 browser = BrowserList::GetLastActive(); |
| 897 DCHECK(browser); | 900 DCHECK(browser); |
| 898 } | 901 } |
| 899 browser->window()->Show(); | 902 browser->window()->Show(); |
| 900 } | 903 } |
| OLD | NEW |