summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 18:12:12 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-22 18:12:12 +0000
commit2da0f07a597c2d810d56e4b2cf909b044bcab4b7 (patch)
tree1e6fa10dc47f98cf8c4ea831704c9dac9f837933 /base
parent779000e07ebcdb833a96c5fa398250b7a1d429a0 (diff)
downloadchromium_src-2da0f07a597c2d810d56e4b2cf909b044bcab4b7.zip
chromium_src-2da0f07a597c2d810d56e4b2cf909b044bcab4b7.tar.gz
chromium_src-2da0f07a597c2d810d56e4b2cf909b044bcab4b7.tar.bz2
Remove base/image_util. This seems not to be used anywhere.
TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/5975004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gypi3
-rw-r--r--base/image_util.cc72
-rw-r--r--base/image_util.h67
3 files changed, 0 insertions, 142 deletions
diff --git a/base/base.gypi b/base/base.gypi
index 543d280..b2dc0a2 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -519,7 +519,6 @@
'debug_on_start.cc',
'event_recorder.cc',
'file_version_info.cc',
- 'image_util.cc',
'object_watcher.cc',
'pe_image.cc',
'registry.cc',
@@ -618,8 +617,6 @@
'hmac_nss.cc',
'hmac_openssl.cc',
'hmac_win.cc',
- 'image_util.cc',
- 'image_util.h',
'linux_util.cc',
'linux_util.h',
'md5.cc',
diff --git a/base/image_util.cc b/base/image_util.cc
deleted file mode 100644
index d17158f..0000000
--- a/base/image_util.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include <windows.h>
-#include <ImageHlp.h>
-#include <psapi.h>
-
-#include "base/image_util.h"
-#include "base/process_util.h"
-
-// imagehlp.dll appears to ship in all win versions after Win95.
-// nsylvain verified it is present in win2k.
-// Using #pragma comment for dependency, instead of LoadLibrary/GetProcAddress.
-#pragma comment(lib, "imagehlp.lib")
-
-namespace image_util {
-
-// ImageMetrics
-ImageMetrics::ImageMetrics(HANDLE process) : process_(process) {
-}
-
-ImageMetrics::~ImageMetrics() {
-}
-
-bool ImageMetrics::GetDllImageSectionData(const std::string& loaded_dll_name,
- ImageSectionsData* section_sizes) {
- // Get a handle to the loaded DLL
- HMODULE the_dll = GetModuleHandleA(loaded_dll_name.c_str());
- char full_filename[MAX_PATH];
- // Get image path
- if (GetModuleFileNameExA(process_, the_dll, full_filename, MAX_PATH)) {
- return GetImageSectionSizes(full_filename, section_sizes);
- }
- return false;
-}
-
-bool ImageMetrics::GetProcessImageSectionData(ImageSectionsData*
- section_sizes) {
- char exe_path[MAX_PATH];
- // Get image path
- if (GetModuleFileNameExA(process_, NULL, exe_path, MAX_PATH)) {
- return GetImageSectionSizes(exe_path, section_sizes);
- }
- return false;
-}
-
-// private
-bool ImageMetrics::GetImageSectionSizes(char* qualified_path,
- ImageSectionsData* result) {
- LOADED_IMAGE li;
- // TODO (timsteele): There is no unicode version for MapAndLoad, hence
- // why ansi functions are used in this class. Should we try and rewrite
- // this call ourselves to be safe?
- if (MapAndLoad(qualified_path, 0, &li, FALSE, TRUE)) {
- IMAGE_SECTION_HEADER* section_header = li.Sections;
- for (unsigned i = 0; i < li.NumberOfSections; i++, section_header++) {
- std::string name(reinterpret_cast<char*>(section_header->Name));
- ImageSectionData data(name, section_header->Misc.VirtualSize ?
- section_header->Misc.VirtualSize :
- section_header->SizeOfRawData);
- // copy into result
- result->push_back(data);
- }
- } else {
- // map and load failed
- return false;
- }
- UnMapAndLoad(&li);
- return true;
-}
-
-} // namespace image_util
diff --git a/base/image_util.h b/base/image_util.h
deleted file mode 100644
index ccdffc3..0000000
--- a/base/image_util.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file/namespace contains utility functions for gathering
-// information about PE (Portable Executable) headers within
-// images (dll's / exe's )
-
-#ifndef BASE_IMAGE_UTIL_H_
-#define BASE_IMAGE_UTIL_H_
-#pragma once
-
-#include <windows.h>
-#include <vector>
-
-#include "base/basictypes.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;
-};
-
-typedef std::vector<ImageSectionData> ImageSectionsData;
-
-// Provides image statistics for modules of a specified process, or for the
-// specified process' own executable file. To use, invoke CreateImageMetrics()
-// 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_COPY_AND_ASSIGN(ImageMetrics);
-};
-
-} // namespace image_util
-
-#endif // BASE_IMAGE_UTIL_H_