1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/debug/traced_value.h"
7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event_argument.h"
12 void TracedValue::AppendIDRef(const void* id
,
13 base::trace_event::TracedValue
* state
) {
14 state
->BeginDictionary();
15 state
->SetString("id_ref", base::StringPrintf("%p", id
));
16 state
->EndDictionary();
19 void TracedValue::SetIDRef(const void* id
,
20 base::trace_event::TracedValue
* state
,
22 state
->BeginDictionary(name
);
23 state
->SetString("id_ref", base::StringPrintf("%p", id
));
24 state
->EndDictionary();
27 void TracedValue::MakeDictIntoImplicitSnapshot(
28 base::trace_event::TracedValue
* dict
,
29 const char* object_name
,
31 dict
->SetString("id", base::StringPrintf("%s/%p", object_name
, id
));
34 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
36 base::trace_event::TracedValue
* dict
,
37 const char* object_name
,
39 dict
->SetString("cat", category
);
40 MakeDictIntoImplicitSnapshot(dict
, object_name
, id
);
43 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
45 base::trace_event::TracedValue
* dict
,
46 const char* object_base_type_name
,
47 const char* object_name
,
49 dict
->SetString("cat", category
);
50 dict
->SetString("base_type", object_base_type_name
);
51 MakeDictIntoImplicitSnapshot(dict
, object_name
, id
);