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/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/numerics/safe_conversions.h" |
11 #include "base/process/process_metrics.h" | 12 #include "base/process/process_metrics.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 660 |
660 base::ProcessId pid = GetProcessId(index); | 661 base::ProcessId pid = GetProcessId(index); |
661 PerProcessValues& values( | 662 PerProcessValues& values( |
662 per_process_cache_[GetResource(index)->GetProcess()]); | 663 per_process_cache_[GetResource(index)->GetProcess()]); |
663 if (!values.is_video_memory_valid) { | 664 if (!values.is_video_memory_valid) { |
664 content::GPUVideoMemoryUsageStats::ProcessMap::const_iterator i = | 665 content::GPUVideoMemoryUsageStats::ProcessMap::const_iterator i = |
665 video_memory_usage_stats_.process_map.find(pid); | 666 video_memory_usage_stats_.process_map.find(pid); |
666 if (i == video_memory_usage_stats_.process_map.end()) | 667 if (i == video_memory_usage_stats_.process_map.end()) |
667 return false; | 668 return false; |
668 values.is_video_memory_valid = true; | 669 values.is_video_memory_valid = true; |
669 values.video_memory = i->second.video_memory; | 670 // If this checked_cast asserts, then need to change this code to use |
| 671 // uint64_t instead of size_t. |
| 672 values.video_memory = base::checked_cast<size_t>(i->second.video_memory); |
670 values.video_memory_has_duplicates = i->second.has_duplicates; | 673 values.video_memory_has_duplicates = i->second.has_duplicates; |
671 } | 674 } |
672 *video_memory = values.video_memory; | 675 *video_memory = values.video_memory; |
673 *has_duplicates = values.video_memory_has_duplicates; | 676 *has_duplicates = values.video_memory_has_duplicates; |
674 return true; | 677 return true; |
675 } | 678 } |
676 | 679 |
677 bool TaskManagerModel::GetSqliteMemoryUsedBytes( | 680 bool TaskManagerModel::GetSqliteMemoryUsedBytes( |
678 int index, | 681 int index, |
679 size_t* result) const { | 682 size_t* result) const { |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 params.host_desktop_type = desktop_type; | 1573 params.host_desktop_type = desktop_type; |
1571 chrome::Navigate(¶ms); | 1574 chrome::Navigate(¶ms); |
1572 } | 1575 } |
1573 | 1576 |
1574 TaskManager::TaskManager() | 1577 TaskManager::TaskManager() |
1575 : model_(new TaskManagerModel(this)) { | 1578 : model_(new TaskManagerModel(this)) { |
1576 } | 1579 } |
1577 | 1580 |
1578 TaskManager::~TaskManager() { | 1581 TaskManager::~TaskManager() { |
1579 } | 1582 } |
OLD | NEW |