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

Unified Diff: base/location.cc

Issue 2415673005: Revert of Move GetProgramCounter in FROM_HERE to a common function (Closed)
Patch Set: Created 4 years, 2 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 | « base/location.h ('k') | base/location_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/location.cc
diff --git a/base/location.cc b/base/location.cc
index 77d205c6bae77c55c5f82fe3430fc3296fe11c6d..1333e6ec45354b1a633ae16de6088db47bab147d 100644
--- a/base/location.cc
+++ b/base/location.cc
@@ -13,25 +13,6 @@
#include "base/strings/stringprintf.h"
namespace tracked_objects {
-namespace {
-
-#if defined(COMPILER_MSVC)
-__forceinline
-#elif defined(COMPILER_GCC) && !defined(OS_NACL)
-__attribute__((always_inline))
-inline
-#endif
-const void* GetReturnAddress() {
-#if defined(COMPILER_MSVC)
- return _ReturnAddress();
-#elif defined(COMPILER_GCC) && !defined(OS_NACL)
- return __builtin_extract_return_addr(__builtin_return_address(0));
-#else
- return nullptr;
-#endif
-}
-
-} // namespace
Location::Location(const char* function_name,
const char* file_name,
@@ -55,18 +36,6 @@
file_name_(other.file_name_),
line_number_(other.line_number_),
program_counter_(other.program_counter_) {
-}
-
-// static
-#if defined(COMPILER_MSVC)
-__declspec(noinline)
-#endif
-Location Location::CreateForCurrentProgramCounter(
- const char* function_name,
- const char* file_name,
- int line_number) {
- const void* program_counter = GetReturnAddress();
- return Location(function_name, file_name, line_number, program_counter);
}
std::string Location::ToString() const {
@@ -125,7 +94,13 @@
__declspec(noinline)
#endif
BASE_EXPORT const void* GetProgramCounter() {
- return GetReturnAddress();
+#if defined(COMPILER_MSVC)
+ return _ReturnAddress();
+#elif defined(COMPILER_GCC) && !defined(OS_NACL)
+ return __builtin_extract_return_addr(__builtin_return_address(0));
+#else
+ return NULL;
+#endif
}
} // namespace tracked_objects
« no previous file with comments | « base/location.h ('k') | base/location_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698