| 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 #ifndef CHROME_BROWSER_MEMORY_DETAILS_H_ | 5 #ifndef CHROME_BROWSER_MEMORY_DETAILS_H_ |
| 6 #define CHROME_BROWSER_MEMORY_DETAILS_H_ | 6 #define CHROME_BROWSER_MEMORY_DETAILS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "chrome/common/child_process_info.h" | 13 #include "chrome/common/child_process_info.h" |
| 14 | 14 |
| 15 // We collect data about each browser process. A browser may | 15 // We collect data about each browser process. A browser may |
| 16 // have multiple processes (of course!). Even IE has multiple | 16 // have multiple processes (of course!). Even IE has multiple |
| 17 // processes these days. | 17 // processes these days. |
| 18 struct ProcessMemoryInformation { | 18 struct ProcessMemoryInformation { |
| 19 ProcessMemoryInformation() | 19 ProcessMemoryInformation(); |
| 20 : pid(0), | 20 ~ProcessMemoryInformation(); |
| 21 num_processes(0), | |
| 22 is_diagnostics(false), | |
| 23 type(ChildProcessInfo::UNKNOWN_PROCESS) { | |
| 24 } | |
| 25 | 21 |
| 26 // The process id. | 22 // The process id. |
| 27 base::ProcessId pid; | 23 base::ProcessId pid; |
| 28 // The working set information. | 24 // The working set information. |
| 29 base::WorkingSetKBytes working_set; | 25 base::WorkingSetKBytes working_set; |
| 30 // The committed bytes. | 26 // The committed bytes. |
| 31 base::CommittedKBytes committed; | 27 base::CommittedKBytes committed; |
| 32 // The process version | 28 // The process version |
| 33 std::wstring version; | 29 std::wstring version; |
| 34 // The process product name. | 30 // The process product name. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Initiate updating the current memory details. These are fetched | 90 // Initiate updating the current memory details. These are fetched |
| 95 // asynchronously because data must be collected from multiple threads. | 91 // asynchronously because data must be collected from multiple threads. |
| 96 // OnDetailsAvailable will be called when this process is complete. | 92 // OnDetailsAvailable will be called when this process is complete. |
| 97 void StartFetch(); | 93 void StartFetch(); |
| 98 | 94 |
| 99 virtual void OnDetailsAvailable() {} | 95 virtual void OnDetailsAvailable() {} |
| 100 | 96 |
| 101 protected: | 97 protected: |
| 102 friend class base::RefCountedThreadSafe<MemoryDetails>; | 98 friend class base::RefCountedThreadSafe<MemoryDetails>; |
| 103 | 99 |
| 104 virtual ~MemoryDetails() {} | 100 virtual ~MemoryDetails(); |
| 105 | 101 |
| 106 private: | 102 private: |
| 107 // Collect child process information on the IO thread. This is needed because | 103 // Collect child process information on the IO thread. This is needed because |
| 108 // information about some child process types (i.e. plugins) can only be taken | 104 // information about some child process types (i.e. plugins) can only be taken |
| 109 // on that thread. The data will be used by about:memory. When finished, | 105 // on that thread. The data will be used by about:memory. When finished, |
| 110 // invokes back to the file thread to run the rest of the about:memory | 106 // invokes back to the file thread to run the rest of the about:memory |
| 111 // functionality. | 107 // functionality. |
| 112 void CollectChildInfoOnIOThread(); | 108 void CollectChildInfoOnIOThread(); |
| 113 | 109 |
| 114 // Collect current process information from the OS and store it | 110 // Collect current process information from the OS and store it |
| (...skipping 24 matching lines...) Expand all Loading... |
| 139 | 135 |
| 140 // Returns a pointer to the ProcessData structure for Chrome. | 136 // Returns a pointer to the ProcessData structure for Chrome. |
| 141 ProcessData* ChromeBrowser(); | 137 ProcessData* ChromeBrowser(); |
| 142 | 138 |
| 143 std::vector<ProcessData> process_data_; | 139 std::vector<ProcessData> process_data_; |
| 144 | 140 |
| 145 DISALLOW_COPY_AND_ASSIGN(MemoryDetails); | 141 DISALLOW_COPY_AND_ASSIGN(MemoryDetails); |
| 146 }; | 142 }; |
| 147 | 143 |
| 148 #endif // CHROME_BROWSER_MEMORY_DETAILS_H_ | 144 #endif // CHROME_BROWSER_MEMORY_DETAILS_H_ |
| OLD | NEW |