diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 13:10:38 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-01 13:10:38 +0000 |
commit | d12aa932d3555eda2c011022e94df82023fa191d (patch) | |
tree | f1f9244b6beccfd2797d74fc1d1acea896d2a601 /cc/debug/traced_value.h | |
parent | 59d75c8166ae16a7879c11595fbde2ab1cffad3b (diff) | |
download | chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.zip chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.tar.gz chromium_src-d12aa932d3555eda2c011022e94df82023fa191d.tar.bz2 |
Add builders for tracing event's structural arguments
The new classes allow building JSON-like structural arguments. Current implementation uses base::Value as backing store but that can be replaced in the future with something more efficient without changing client code.
All clients of cc/debug/traced_value.h should eventually switch to use the new builders.
BUG=361045
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=286849
R=alph@chromium.org, dsinclair@chromium.org, nduca@chromium.org, willchan@chromium.org
Review URL: https://codereview.chromium.org/380763002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug/traced_value.h')
-rw-r--r-- | cc/debug/traced_value.h | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/cc/debug/traced_value.h b/cc/debug/traced_value.h index 560eaf8..c5ea30a 100644 --- a/cc/debug/traced_value.h +++ b/cc/debug/traced_value.h @@ -5,58 +5,36 @@ #ifndef CC_DEBUG_TRACED_VALUE_H_ #define CC_DEBUG_TRACED_VALUE_H_ -#include <string> - -#include "base/debug/trace_event.h" -#include "base/memory/scoped_ptr.h" - namespace base { -class DictionaryValue; -class Value; +namespace debug { +class TracedValue; +} } + namespace cc { -class TracedValue : public base::debug::ConvertableToTraceFormat { +class TracedValue { public: - static scoped_ptr<base::Value> CreateIDRef(const void* id); - static void MakeDictIntoImplicitSnapshot( - base::DictionaryValue* dict, const char* object_name, const void* id); + static void AppendIDRef(const void* id, base::debug::TracedValue* array); + static void SetIDRef(const void* id, + base::debug::TracedValue* dict, + const char* name); + static void MakeDictIntoImplicitSnapshot(base::debug::TracedValue* dict, + const char* object_name, + const void* id); static void MakeDictIntoImplicitSnapshotWithCategory( const char* category, - base::DictionaryValue* dict, + base::debug::TracedValue* dict, const char* object_name, const void* id); static void MakeDictIntoImplicitSnapshotWithCategory( const char* category, - base::DictionaryValue* dict, + base::debug::TracedValue* dict, const char* object_base_type_name, const char* object_name, const void* id); - static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( - base::Value* value); - - virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE; - - private: - explicit TracedValue(base::Value* value); - virtual ~TracedValue(); - - scoped_ptr<base::Value> value_; - - DISALLOW_COPY_AND_ASSIGN(TracedValue); }; -template <class T> -static scoped_refptr<base::debug::ConvertableToTraceFormat> ToTrace(T* t) { - return TracedValue::FromValue(t->AsValue().release()); -} - -template <class T> -static scoped_refptr<base::debug::ConvertableToTraceFormat> ToTrace( - const T& t) { - return ToTrace(&t); -} - } // namespace cc #endif // CC_DEBUG_TRACED_VALUE_H_ |