GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / cc / debug / traced_value.cc
blobc2ac7f551016147e737268641583e31eba5824a5
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"
10 namespace cc {
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,
21 const char* name) {
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,
30 const void* id) {
31 dict->SetString("id", base::StringPrintf("%s/%p", object_name, id));
34 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
35 const char* category,
36 base::trace_event::TracedValue* dict,
37 const char* object_name,
38 const void* id) {
39 dict->SetString("cat", category);
40 MakeDictIntoImplicitSnapshot(dict, object_name, id);
43 void TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
44 const char* category,
45 base::trace_event::TracedValue* dict,
46 const char* object_base_type_name,
47 const char* object_name,
48 const void* id) {
49 dict->SetString("cat", category);
50 dict->SetString("base_type", object_base_type_name);
51 MakeDictIntoImplicitSnapshot(dict, object_name, id);
54 } // namespace cc