summaryrefslogtreecommitdiffstats
path: root/cc/debug/traced_picture.cc
blob: 7f04d0d783f7fda6ed1190e157ac0405c383f4a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/debug/traced_picture.h"

#include "base/json/json_writer.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "cc/debug/traced_value.h"

namespace cc {

TracedPicture::TracedPicture(scoped_refptr<Picture> picture)
  : picture_(picture) {
}

TracedPicture::~TracedPicture() {
}

scoped_ptr<base::debug::ConvertableToTraceFormat>
    TracedPicture::AsTraceablePicture(Picture* picture) {
  TracedPicture* ptr = new TracedPicture(picture);
  scoped_ptr<TracedPicture> result(ptr);
  return result.PassAs<base::debug::ConvertableToTraceFormat>();
}

void TracedPicture::AppendAsTraceFormat(std::string* out) const {
  scoped_ptr<base::Value> value = picture_->AsValue();
  std::string tmp;
  base::JSONWriter::Write(value.get(), &tmp);
  out->append(tmp);
}

}  // namespace cc