diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 00:19:17 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 00:19:17 +0000 |
commit | 5986ed239f7f2fc3f6b1d5f6385819151ae533db (patch) | |
tree | a07be3bc493c5dd34c5f62c6195a85c49ec22c2a /base/image_util.h | |
parent | 8ad85c0ef39433a26a0093853f34d7eec9be0706 (diff) | |
download | chromium_src-5986ed239f7f2fc3f6b1d5f6385819151ae533db.zip chromium_src-5986ed239f7f2fc3f6b1d5f6385819151ae533db.tar.gz chromium_src-5986ed239f7f2fc3f6b1d5f6385819151ae533db.tar.bz2 |
Make ResourceMessageFilter compile on Mac. It stubs out a substantial part of
the printing. It creates new base functions for converting PIDs to handles, and
then closing them (since Windows requires this). This also fixes the formatting
of image_util.
Review URL: http://codereview.chromium.org/20109
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/image_util.h')
-rw-r--r-- | base/image_util.h | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/base/image_util.h b/base/image_util.h index 6f0a19a..33ca08f 100644 --- a/base/image_util.h +++ b/base/image_util.h @@ -6,22 +6,25 @@ // information about PE (Portable Executable) headers within // images (dll's / exe's ) -#ifndef BASE_IMAGE_UTIL_H__ -#define BASE_IMAGE_UTIL_H__ +#ifndef BASE_IMAGE_UTIL_H_ +#define BASE_IMAGE_UTIL_H_ +#include <windows.h> #include <vector> + #include "base/basictypes.h" -#include <windows.h> namespace image_util { // Contains both the PE section name (.text, .reloc etc) and its size. struct ImageSectionData { + ImageSectionData (const std::string& section_name, size_t section_size) + : name (section_name), + size_in_bytes(section_size) { + } + std::string name; size_t size_in_bytes; - ImageSectionData (const std::string& section_name, size_t section_size) : - name (section_name), size_in_bytes(section_size) { - } }; typedef std::vector<ImageSectionData> ImageSectionsData; @@ -31,34 +34,34 @@ typedef std::vector<ImageSectionData> ImageSectionsData; // to get an instance for a specified process, then access the information via // methods. class ImageMetrics { - public: - // Creates an ImageMetrics instance for given process owned by - // the caller. - explicit ImageMetrics(HANDLE process); - ~ImageMetrics(); - - // Fills a vector of ImageSectionsData containing name/size info - // for every section found in the specified dll's PE section table. - // The DLL must be loaded by the process associated with this ImageMetrics - // instance. - bool GetDllImageSectionData(const std::string& loaded_dll_name, - ImageSectionsData* section_sizes); - - // Fills a vector if ImageSectionsData containing name/size info - // for every section found in the executable file of the process - // associated with this ImageMetrics instance. - bool GetProcessImageSectionData(ImageSectionsData* section_sizes); - - private: - // Helper for GetDllImageSectionData and GetProcessImageSectionData - bool GetImageSectionSizes(char* qualified_path, ImageSectionsData* result); - - HANDLE process_; - - DISALLOW_EVIL_CONSTRUCTORS(ImageMetrics); + public: + // Creates an ImageMetrics instance for given process owned by + // the caller. + explicit ImageMetrics(HANDLE process); + ~ImageMetrics(); + + // Fills a vector of ImageSectionsData containing name/size info + // for every section found in the specified dll's PE section table. + // The DLL must be loaded by the process associated with this ImageMetrics + // instance. + bool GetDllImageSectionData(const std::string& loaded_dll_name, + ImageSectionsData* section_sizes); + + // Fills a vector if ImageSectionsData containing name/size info + // for every section found in the executable file of the process + // associated with this ImageMetrics instance. + bool GetProcessImageSectionData(ImageSectionsData* section_sizes); + + private: + // Helper for GetDllImageSectionData and GetProcessImageSectionData + bool GetImageSectionSizes(char* qualified_path, ImageSectionsData* result); + + HANDLE process_; + + DISALLOW_COPY_AND_ASSIGN(ImageMetrics); }; -} // namespace image_util +} // namespace image_util -#endif +#endif // BASE_IMAGE_UTIL_H_ |