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

Side by Side Diff: cc/debug/traced_value.h

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_DEBUG_TRACED_VALUE_H_ 5 #ifndef CC_DEBUG_TRACED_VALUE_H_
6 #define CC_DEBUG_TRACED_VALUE_H_ 6 #define CC_DEBUG_TRACED_VALUE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 12
13 namespace base { 13 namespace base {
14 class DictionaryValue; 14 class DictionaryValue;
15 class Value; 15 class Value;
16 namespace debug {
17 class TracedValue;
18 }
16 } 19 }
17 namespace cc { 20 namespace cc {
18 21
19 class TracedValue : public base::debug::ConvertableToTraceFormat { 22 class TracedValue : public base::debug::ConvertableToTraceFormat {
20 public: 23 public:
21 static scoped_ptr<base::Value> CreateIDRef(const void* id); 24 static scoped_ptr<base::Value> CreateIDRef(const void* id);
22 static void MakeDictIntoImplicitSnapshot( 25 static void MakeDictIntoImplicitSnapshot(
23 base::DictionaryValue* dict, const char* object_name, const void* id); 26 base::DictionaryValue* dict, const char* object_name, const void* id);
24 static void MakeDictIntoImplicitSnapshotWithCategory( 27 static void MakeDictIntoImplicitSnapshotWithCategory(
25 const char* category, 28 const char* category,
26 base::DictionaryValue* dict, 29 base::DictionaryValue* dict,
27 const char* object_name, 30 const char* object_name,
28 const void* id); 31 const void* id);
29 static void MakeDictIntoImplicitSnapshotWithCategory( 32 static void MakeDictIntoImplicitSnapshotWithCategory(
30 const char* category, 33 const char* category,
31 base::DictionaryValue* dict, 34 base::DictionaryValue* dict,
32 const char* object_base_type_name, 35 const char* object_base_type_name,
33 const char* object_name, 36 const char* object_name,
34 const void* id); 37 const void* id);
38 static void AppendIDRef(const void* id, base::debug::TracedValue* array);
39 static void SetIDRef(const void* id,
40 base::debug::TracedValue* dict,
41 const char* name);
42 static void MakeDictIntoImplicitSnapshot(base::debug::TracedValue* dict,
43 const char* object_name,
44 const void* id);
45 static void MakeDictIntoImplicitSnapshotWithCategory(
46 const char* category,
47 base::debug::TracedValue* dict,
48 const char* object_name,
49 const void* id);
50 static void MakeDictIntoImplicitSnapshotWithCategory(
51 const char* category,
52 base::debug::TracedValue* dict,
53 const char* object_base_type_name,
54 const char* object_name,
55 const void* id);
35 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( 56 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue(
36 base::Value* value); 57 base::Value* value);
37 58
38 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE; 59 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE;
39 60
40 private: 61 private:
41 explicit TracedValue(base::Value* value); 62 explicit TracedValue(base::Value* value);
42 virtual ~TracedValue(); 63 virtual ~TracedValue();
43 64
44 scoped_ptr<base::Value> value_; 65 scoped_ptr<base::Value> value_;
45 66
46 DISALLOW_COPY_AND_ASSIGN(TracedValue); 67 DISALLOW_COPY_AND_ASSIGN(TracedValue);
47 }; 68 };
48 69
49 template <class T>
50 static scoped_refptr<base::debug::ConvertableToTraceFormat> ToTrace(T* t) {
51 return TracedValue::FromValue(t->AsValue().release());
52 }
53
54 template <class T>
55 static scoped_refptr<base::debug::ConvertableToTraceFormat> ToTrace(
56 const T& t) {
57 return ToTrace(&t);
58 }
59
60 } // namespace cc 70 } // namespace cc
61 71
62 #endif // CC_DEBUG_TRACED_VALUE_H_ 72 #endif // CC_DEBUG_TRACED_VALUE_H_
OLDNEW
« cc/base/math_util.h ('K') | « cc/debug/traced_picture.cc ('k') | cc/debug/traced_value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698