The DisplayVirtualKeyboard function on Windows 8 and beyond should not be displaying...
[chromium-blink-merge.git] / cc / debug / traced_picture.cc
blob2db549234d8e824933d426fd657d5a7002fa193b
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_picture.h"
7 #include "base/json/json_writer.h"
8 #include "base/strings/stringprintf.h"
9 #include "base/values.h"
11 namespace cc {
13 TracedPicture::TracedPicture(scoped_refptr<const Picture> picture)
14 : picture_(picture), is_alias_(false) {}
16 TracedPicture::~TracedPicture() {
19 scoped_refptr<base::debug::ConvertableToTraceFormat>
20 TracedPicture::AsTraceablePicture(const Picture* picture) {
21 return scoped_refptr<base::debug::ConvertableToTraceFormat>(
22 new TracedPicture(picture));
25 scoped_refptr<base::debug::ConvertableToTraceFormat>
26 TracedPicture::AsTraceablePictureAlias(const Picture* original) {
27 scoped_refptr<TracedPicture> ptr = new TracedPicture(original);
28 ptr->is_alias_ = true;
29 return scoped_refptr<base::debug::ConvertableToTraceFormat>(ptr);
32 void TracedPicture::AppendAsTraceFormat(std::string* out) const {
33 if (is_alias_)
34 AppendPictureAlias(out);
35 else
36 AppendPicture(out);
39 void TracedPicture::AppendPictureAlias(std::string* out) const {
40 scoped_ptr<base::DictionaryValue> alias(new base::DictionaryValue());
41 alias->SetString("id_ref", base::StringPrintf("%p", picture_.get()));
43 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
44 res->Set("alias", alias.release());
46 std::string tmp;
47 base::JSONWriter::Write(res.get(), &tmp);
48 out->append(tmp);
51 void TracedPicture::AppendPicture(std::string* out) const {
52 scoped_ptr<base::Value> value = picture_->AsValue();
53 std::string tmp;
54 base::JSONWriter::Write(value.get(), &tmp);
55 out->append(tmp);
58 } // namespace cc