diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:55:10 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:55:10 +0000 |
commit | a27a938d8511abfaf89d6e2d0e4d4242c76dffed (patch) | |
tree | 98b133536459106b96a0ee09e0deb94b8d92c4b3 /chrome/browser/memory_details.h | |
parent | 342c2c40bd1729fe985d5a6ee06f6eb28bbcdc22 (diff) | |
download | chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.zip chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.tar.gz chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.tar.bz2 |
Refactor plugin process code in the browser process so that the browser/about:memory/task manager/metrics code doesn't depend on PluginProcessHost pointers. In a future changelist I'll add one central child process registry in the browser process.
Review URL: http://codereview.chromium.org/20196
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.h')
-rw-r--r-- | chrome/browser/memory_details.h | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h index 0a542cc..17a00a1 100644 --- a/chrome/browser/memory_details.h +++ b/chrome/browser/memory_details.h @@ -12,6 +12,7 @@ #include "base/file_path.h" #include "base/process_util.h" #include "base/ref_counted.h" +#include "chrome/common/child_process_info.h" class MessageLoop; @@ -38,17 +39,14 @@ struct ProcessMemoryInformation { // A process is a diagnostics process if it is rendering // about:xxx information. bool is_diagnostics; + // If this is a child process of Chrome, what type (i.e. plugin) it is. + ChildProcessInfo::ProcessType type; + // A collection of titles used, i.e. for a tab it'll show all the page titles. + std::vector<std::wstring> titles; }; typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList; -// Information that we need about a plugin process. -struct PluginProcessInformation { - int pid; - FilePath plugin_path; -}; -typedef std::vector<PluginProcessInformation> PluginProcessInformationList; - // Browser Process Information. struct ProcessData { const wchar_t* name; @@ -95,9 +93,6 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> { // after OnDetailsAvailable() has been called. ProcessData* processes() { return process_data_; } - // Access to the plugin details. - const PluginProcessInformationList* plugins() const { return &plugins_; } - // Initiate updating the current memory details. These are fetched // asynchronously because data must be collected from multiple threads. // OnDetailsAvailable will be called when this process is complete. @@ -106,30 +101,30 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> { virtual void OnDetailsAvailable() {} private: - // Collect the a list of information about current plugin processes that - // will be used by about:memory. When finished, invokes back to the - // return_loop to run the rest of the about:memory functionality. - // Runs on the IO thread because the PluginProcessHost is only accessible - // from the IO thread. - void CollectPluginInformation(); + // Collect child process information on the IO thread. This is needed because + // information about some child process types (i.e. plugins) can only be taken + // on that thread. The data will be used by about:memory. When finished, + // invokes back to the file thread to run the rest of the about:memory + // functionality. + void CollectChildInfoOnIOThread(); // Collect current process information from the OS and store it // for processing. If data has already been collected, clears old // data and re-collects the data. // Note - this function enumerates memory details from many processes - // and is fairly expensive to run. - void CollectProcessData(); + // and is fairly expensive to run, hence it's run on the file thread. + // The parameter holds information about processes from the IO thread. + void CollectProcessData(std::vector<ProcessMemoryInformation>); - // Collect renderer specific information. This information is gathered - // on the Browser thread, where the RenderHostIterator is accessible. - void CollectRenderHostInformation(); + // Collect child process information on the UI thread. Information about + // renderer processes is only available there. + void CollectChildInfoOnUIThread(); // Each time we take a memory sample, we do a little work to update // the global histograms for tracking memory usage. void UpdateHistograms(); ProcessData process_data_[MAX_BROWSERS]; - PluginProcessInformationList plugins_; MessageLoop* ui_loop_; DISALLOW_EVIL_CONSTRUCTORS(MemoryDetails); |