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/debug/trace_event_argument.h"
8 #include "base/strings/stringprintf.h"
12 void TracedValue::AppendIDRef(const void* id
, base::debug::TracedValue
* state
) {
13 state
->BeginDictionary();
14 state
->SetString("id_ref", base::StringPrintf("%p", id
));
15 state
->EndDictionary();
18 void TracedValue::SetIDRef(const void* id
,
19 base::debug::TracedValue
* state
,
21 state
->BeginDictionary(name
);
22 state
->SetString("id_ref", base::StringPrintf("%p", id
));
23 state
->EndDictionary();
26 void TracedValue::MakeDictIntoImplicitSnapshot(base::debug::TracedValue
* dict
,
27 const char* object_name
,
29 dict
->SetString("id", base::StringPrintf("%s/%p", object_name
, id
));
32 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
34 base::debug::TracedValue
* dict
,
35 const char* object_name
,
37 dict
->SetString("cat", category
);
38 MakeDictIntoImplicitSnapshot(dict
, object_name
, id
);
41 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
43 base::debug::TracedValue
* dict
,
44 const char* object_base_type_name
,
45 const char* object_name
,
47 dict
->SetString("cat", category
);
48 dict
->SetString("base_type", object_base_type_name
);
49 MakeDictIntoImplicitSnapshot(dict
, object_name
, id
);