OLD | NEW |
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 BASE_DEBUG_TRACED_VALUE_H_ |
6 #define CC_DEBUG_TRACED_VALUE_H_ | 6 #define BASE_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 } | 16 namespace debug { |
17 namespace cc { | |
18 | 17 |
19 class TracedValue : public base::debug::ConvertableToTraceFormat { | 18 // This class is used to convert base::Value to a ConvertableToTraceFormat |
| 19 // object. It allows to build the argument value at the point of instrumenation |
| 20 // and postpone costly part of its serialization until the tracing is stopped. |
| 21 class BASE_EXPORT TracedValue : public base::debug::ConvertableToTraceFormat { |
20 public: | 22 public: |
21 static scoped_ptr<base::Value> CreateIDRef(const void* id); | 23 static scoped_ptr<base::Value> CreateIDRef(const void* id); |
22 static void MakeDictIntoImplicitSnapshot( | 24 static void MakeDictIntoImplicitSnapshot(base::DictionaryValue* dict, |
23 base::DictionaryValue* dict, const char* object_name, const void* id); | 25 const char* object_name, |
| 26 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); |
35 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( | 38 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( |
36 base::Value* value); | 39 base::Value* value); |
37 | 40 |
38 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE; | 41 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE; |
39 | 42 |
40 private: | 43 private: |
41 explicit TracedValue(base::Value* value); | 44 explicit TracedValue(base::Value* value); |
42 virtual ~TracedValue(); | 45 virtual ~TracedValue(); |
43 | 46 |
44 scoped_ptr<base::Value> value_; | 47 scoped_ptr<base::Value> value_; |
45 | 48 |
46 DISALLOW_COPY_AND_ASSIGN(TracedValue); | 49 DISALLOW_COPY_AND_ASSIGN(TracedValue); |
47 }; | 50 }; |
48 | 51 |
49 } // namespace cc | 52 } // namespace debug |
| 53 } // namespace base |
50 | 54 |
51 #endif // CC_DEBUG_TRACED_VALUE_H_ | 55 #endif // BASE_DEBUG_TRACED_VALUE_H_ |
OLD | NEW |