Chromium Code Reviews| 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 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" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 explicit TracedValue(base::Value* value); | 41 explicit TracedValue(base::Value* value); |
| 42 virtual ~TracedValue(); | 42 virtual ~TracedValue(); |
| 43 | 43 |
| 44 scoped_ptr<base::Value> value_; | 44 scoped_ptr<base::Value> value_; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(TracedValue); | 46 DISALLOW_COPY_AND_ASSIGN(TracedValue); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 template <class T> | |
| 50 static scoped_refptr<base::debug::ConvertableToTraceFormat> ToTrace(T* t) { | |
|
brianderson
2014/05/08 21:25:49
Nice!
| |
| 51 return TracedValue::FromValue(t->StateAsValue().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 | |
| 49 } // namespace cc | 60 } // namespace cc |
| 50 | 61 |
| 51 #endif // CC_DEBUG_TRACED_VALUE_H_ | 62 #endif // CC_DEBUG_TRACED_VALUE_H_ |
| OLD | NEW |