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

Unified Diff: base/location.cc

Issue 9702014: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/location.cc
diff --git a/base/location.cc b/base/location.cc
index adf6e210508bcc5a18f8e87b596c52d7e80f0d92..5a21fb1eb235741ddee7887a68f4721bb3665e1e 100644
--- a/base/location.cc
+++ b/base/location.cc
@@ -14,6 +14,10 @@ extern "C" {
#include "base/location.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
+#include "base/values.h"
+
+using base::DictionaryValue;
+using base::Value;
namespace tracked_objects {
@@ -71,18 +75,30 @@ void Location::WriteFunctionName(std::string* output) const {
}
}
-base::DictionaryValue* Location::ToValue() const {
- base::DictionaryValue* dictionary = new base::DictionaryValue;
- dictionary->Set("file_name", base::Value::CreateStringValue(file_name_));
- // Note: This function name is not escaped, and templates have less than
+//------------------------------------------------------------------------------
+SerializedLocation::SerializedLocation() {
+}
+
+SerializedLocation::SerializedLocation(
+ const tracked_objects::Location& location)
+ : file_name(location.file_name()),
+ function_name(location.function_name()),
+ line_number(location.line_number()) {
+}
+
+SerializedLocation::~SerializedLocation() {
+}
+
+void SerializedLocation::ToValue(DictionaryValue* dictionary) const {
+ dictionary->Set("file_name", Value::CreateStringValue(file_name));
+ // Note: This function name is not escaped, and templates have less-than
// characters, which means this is not suitable for display as HTML unless
// properly escaped.
- dictionary->Set("function_name",
- base::Value::CreateStringValue(function_name_));
- dictionary->Set("line_number", base::Value::CreateIntegerValue(line_number_));
- return dictionary;
+ dictionary->Set("function_name", Value::CreateStringValue(function_name));
+ dictionary->Set("line_number", Value::CreateIntegerValue(line_number));
}
+//------------------------------------------------------------------------------
#if defined(COMPILER_MSVC)
__declspec(noinline)
#endif
« no previous file with comments | « base/location.h ('k') | base/profiler/tracked_time.h » ('j') | base/profiler/tracked_time.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698