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

Unified Diff: base/file_version_info.h

Issue 1306603003: Redefine CreateFileVersionInfoForCurrentModule() as a macro on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a real macro Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/app/client_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_version_info.h
diff --git a/base/file_version_info.h b/base/file_version_info.h
index 57b837c24b08e90c8a1b14ec4175160a7cea0d3e..8c1bf92438e7b0a849e06cd3eb8de25cb046ccd2 100644
--- a/base/file_version_info.h
+++ b/base/file_version_info.h
@@ -32,6 +32,17 @@ class FilePath;
// version returns values from the Info.plist as appropriate. TODO(avi): make
// this a less-obvious Windows-ism.
+#if defined(OS_WIN)
+// Creates a FileVersionInfo for the current module. Returns NULL in case of
+// error. The returned object should be deleted when you are done with it. This
+// is done as a macro to force inlining of __ImageBase. It used to be inside of
+// a method labeled with __forceinline, but inlining through __forceinline
+// stopped working for Debug builds in VS2013 (http://crbug.com/516359).
+#define CREATE_FILE_VERSION_INFO_FOR_CURRENT_MODULE() \
+ FileVersionInfo::CreateFileVersionInfoForModule( \
+ reinterpret_cast<HMODULE>(&__ImageBase))
+#endif
+
class BASE_EXPORT FileVersionInfo {
public:
virtual ~FileVersionInfo() {}
@@ -46,17 +57,9 @@ class BASE_EXPORT FileVersionInfo {
#if defined(OS_WIN)
// Creates a FileVersionInfo for the specified module. Returns NULL in case
// of error. The returned object should be deleted when you are done with it.
+ // See CREATE_FILE_VERSION_INFO_FOR_CURRENT_MODULE() helper above for a
+ // CreateFileVersionInfoForCurrentModule() alternative for Windows.
static FileVersionInfo* CreateFileVersionInfoForModule(HMODULE module);
-
- // Creates a FileVersionInfo for the current module. Returns NULL in case
- // of error. The returned object should be deleted when you are done with it.
- // This function should be inlined so that the "current module" is evaluated
- // correctly, instead of being the module that contains base.
- __forceinline static FileVersionInfo*
- CreateFileVersionInfoForCurrentModule() {
- HMODULE module = reinterpret_cast<HMODULE>(&__ImageBase);
- return CreateFileVersionInfoForModule(module);
- }
#else
// Creates a FileVersionInfo for the current module. Returns NULL in case
// of error. The returned object should be deleted when you are done with it.
« no previous file with comments | « no previous file | chrome/app/client_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698