| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/memory_details.h" | 5 #include "chrome/browser/memory_details.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 process.process_name = UTF8ToUTF16(process_template[index].process_name); | 77 process.process_name = UTF8ToUTF16(process_template[index].process_name); |
| 78 process_data_.push_back(process); | 78 process_data_.push_back(process); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 ProcessData* MemoryDetails::ChromeBrowser() { | 82 ProcessData* MemoryDetails::ChromeBrowser() { |
| 83 return &process_data_[CHROME_BROWSER]; | 83 return &process_data_[CHROME_BROWSER]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void MemoryDetails::CollectProcessData( | 86 void MemoryDetails::CollectProcessData( |
| 87 std::vector<ProcessMemoryInformation> child_info) { | 87 const std::vector<ProcessMemoryInformation>& child_info) { |
| 88 // This must be run on the file thread to avoid jank (|ProcessInfoSnapshot| | 88 // This must be run on the file thread to avoid jank (|ProcessInfoSnapshot| |
| 89 // runs /bin/ps, which isn't instantaneous). | 89 // runs /bin/ps, which isn't instantaneous). |
| 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 91 | 91 |
| 92 // Clear old data. | 92 // Clear old data. |
| 93 for (size_t index = 0; index < MAX_BROWSERS; index++) | 93 for (size_t index = 0; index < MAX_BROWSERS; index++) |
| 94 process_data_[index].processes.clear(); | 94 process_data_[index].processes.clear(); |
| 95 | 95 |
| 96 // First, we use |NamedProcessIterator| to get the PIDs of the processes we're | 96 // First, we use |NamedProcessIterator| to get the PIDs of the processes we're |
| 97 // interested in; we save our results to avoid extra calls to | 97 // interested in; we save our results to avoid extra calls to |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 // Memory info. | 222 // Memory info. |
| 223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
| 224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
| 225 | 225 |
| 226 // Add the process info to our list. | 226 // Add the process info to our list. |
| 227 process_data_[CHROME_BROWSER].processes.push_back(info); | 227 process_data_[CHROME_BROWSER].processes.push_back(info); |
| 228 } | 228 } |
| OLD | NEW |