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 "chrome/browser/private_working_set_snapshot.h" | 5 #include "chrome/browser/private_working_set_snapshot.h" |
6 | 6 |
7 #include <pdh.h> | 7 #include <pdh.h> |
8 #include <pdhmsg.h> | 8 #include <pdhmsg.h> |
| 9 #include <stddef.h> |
9 | 10 |
10 #include <algorithm> | 11 #include <algorithm> |
11 | 12 |
12 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
13 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
14 | 15 |
15 // Link pdh.lib (import library for pdh.dll) whenever this file is linked in. | 16 // Link pdh.lib (import library for pdh.dll) whenever this file is linked in. |
16 #pragma comment(lib, "pdh.lib") | 17 #pragma comment(lib, "pdh.lib") |
17 | 18 |
18 PrivateWorkingSetSnapshot::PrivateWorkingSetSnapshot() {} | 19 PrivateWorkingSetSnapshot::PrivateWorkingSetSnapshot() {} |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 size_t PrivateWorkingSetSnapshot::GetPrivateWorkingSet( | 183 size_t PrivateWorkingSetSnapshot::GetPrivateWorkingSet( |
183 base::ProcessId process_id) const { | 184 base::ProcessId process_id) const { |
184 // Do a binary search for the requested process ID and return the working set | 185 // Do a binary search for the requested process ID and return the working set |
185 // if found. | 186 // if found. |
186 auto p = std::lower_bound(records_.begin(), records_.end(), process_id); | 187 auto p = std::lower_bound(records_.begin(), records_.end(), process_id); |
187 if (p != records_.end() && p->process_id == process_id) | 188 if (p != records_.end() && p->process_id == process_id) |
188 return p->private_ws; | 189 return p->private_ws; |
189 | 190 |
190 return 0; | 191 return 0; |
191 } | 192 } |
OLD | NEW |