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

Unified Diff: base/tracked.h

Issue 7039020: Tag all tracked objects, including Tasks, with the program counter at the site of FROM_HERE. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 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
Index: base/tracked.h
===================================================================
--- base/tracked.h (revision 85540)
+++ base/tracked.h (working copy)
@@ -41,7 +41,10 @@
// Constructor should be called with a long-lived char*, such as __FILE__.
// It assumes the provided value will persist as a global constant, and it
// will not make a copy of it.
- Location(const char* function_name, const char* file_name, int line_number);
+ Location(const char* function_name,
+ const char* file_name,
+ int line_number,
+ void* program_counter);
// Provide a default constructor for easy of debugging.
Location();
@@ -63,6 +66,7 @@
const char* function_name() const { return function_name_; }
const char* file_name() const { return file_name_; }
int line_number() const { return line_number_; }
+ void* program_counter() const { return program_counter_; }
void Write(bool display_filename, bool display_function_name,
std::string* output) const;
@@ -74,13 +78,19 @@
const char* const function_name_;
const char* const file_name_;
const int line_number_;
+ void* program_counter_;
awong 2011/05/17 23:54:01 This does fundamentally change the nature of this
cpu_(ooo_6.6-7.5) 2011/05/18 00:52:26 But what if the program counter is const void* ?
awong 2011/05/18 01:02:45 I don't think that const really matters too much (
apatrick_chromium 2011/05/18 21:09:47 I made it "const void* const" for consistency. I d
apatrick_chromium 2011/05/18 21:09:47 I agree the result of GetProgramCounterRegister()
};
+BASE_API void* GetProgramCounterRegister();
//------------------------------------------------------------------------------
// Define a macro to record the current source location.
-#define FROM_HERE tracked_objects::Location(__FUNCTION__, __FILE__, __LINE__)
+#define FROM_HERE tracked_objects::Location( \
+ __FUNCTION__, \
+ __FILE__, \
+ __LINE__, \
+ tracked_objects::GetProgramCounterRegister()) \
//------------------------------------------------------------------------------
@@ -110,6 +120,8 @@
base::TimeTicks tracked_birth_time() const { return base::TimeTicks::Now(); }
#endif // defined(TRACK_ALL_TASK_OBJECTS)
+ void* get_birth_program_counter() const { return birth_program_counter_; }
+
private:
#if defined(TRACK_ALL_TASK_OBJECTS)
@@ -123,6 +135,8 @@
#endif // defined(TRACK_ALL_TASK_OBJECTS)
+ void* birth_program_counter_;
+
DISALLOW_COPY_AND_ASSIGN(Tracked);
};
« base/message_loop.cc ('K') | « base/message_loop.cc ('k') | base/tracked.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698