Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: chrome/browser/memory_details.h

Issue 333008: Mac: Implement about:memory. (Closed)
Patch Set: Merged ToT. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList; 46 typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList;
47 47
48 // Browser Process Information. 48 // Browser Process Information.
49 struct ProcessData { 49 struct ProcessData {
50 std::wstring name; 50 std::wstring name;
51 std::wstring process_name; 51 std::wstring process_name;
52 ProcessMemoryInformationList processes; 52 ProcessMemoryInformationList processes;
53 }; 53 };
54 54
55 #if defined(OS_MACOSX)
56 class ProcessInfoSnapshot;
57 #endif
58
55 // MemoryDetails fetches memory details about current running browsers. 59 // MemoryDetails fetches memory details about current running browsers.
56 // Because this data can only be fetched asynchronously, callers use 60 // Because this data can only be fetched asynchronously, callers use
57 // this class via a callback. 61 // this class via a callback.
58 // 62 //
59 // Example usage: 63 // Example usage:
60 // 64 //
61 // class MyMemoryDetailConsumer : public MemoryDetails { 65 // class MyMemoryDetailConsumer : public MemoryDetails {
62 // 66 //
63 // MyMemoryDetailConsumer() : MemoryDetails(true) { 67 // MyMemoryDetailConsumer() : MemoryDetails(true) {
64 // StartFetch(); // Starts fetching details. 68 // StartFetch(); // Starts fetching details.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void CollectChildInfoOnIOThread(); 100 void CollectChildInfoOnIOThread();
97 101
98 // Collect current process information from the OS and store it 102 // Collect current process information from the OS and store it
99 // for processing. If data has already been collected, clears old 103 // for processing. If data has already been collected, clears old
100 // data and re-collects the data. 104 // data and re-collects the data.
101 // Note - this function enumerates memory details from many processes 105 // Note - this function enumerates memory details from many processes
102 // and is fairly expensive to run, hence it's run on the file thread. 106 // and is fairly expensive to run, hence it's run on the file thread.
103 // The parameter holds information about processes from the IO thread. 107 // The parameter holds information about processes from the IO thread.
104 void CollectProcessData(std::vector<ProcessMemoryInformation>); 108 void CollectProcessData(std::vector<ProcessMemoryInformation>);
105 109
110 #if defined(OS_MACOSX)
111 // A helper for |CollectProcessData()|, collecting data on the Chrome/Chromium
112 // process with PID |pid|. The collected data is added to the state of the
113 // object (in |process_data_|).
114 void CollectProcessDataChrome(
115 const std::vector<ProcessMemoryInformation>& child_info,
116 base::ProcessId pid,
117 const ProcessInfoSnapshot& process_info);
118 #endif
119
106 // Collect child process information on the UI thread. Information about 120 // Collect child process information on the UI thread. Information about
107 // renderer processes is only available there. 121 // renderer processes is only available there.
108 void CollectChildInfoOnUIThread(); 122 void CollectChildInfoOnUIThread();
109 123
110 // Each time we take a memory sample, we do a little work to update 124 // Each time we take a memory sample, we do a little work to update
111 // the global histograms for tracking memory usage. 125 // the global histograms for tracking memory usage.
112 void UpdateHistograms(); 126 void UpdateHistograms();
113 127
114 // Returns a pointer to the ProcessData structure for Chrome. 128 // Returns a pointer to the ProcessData structure for Chrome.
115 ProcessData* ChromeBrowser(); 129 ProcessData* ChromeBrowser();
116 130
117 std::vector<ProcessData> process_data_; 131 std::vector<ProcessData> process_data_;
118 132
119 DISALLOW_EVIL_CONSTRUCTORS(MemoryDetails); 133 DISALLOW_EVIL_CONSTRUCTORS(MemoryDetails);
120 }; 134 };
121 135
122 #endif // CHROME_BROWSER_MEMORY_DETAILS_H_ 136 #endif // CHROME_BROWSER_MEMORY_DETAILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698