Home | History | Annotate | Download | only in debug
      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.
      4 
      5 #include "cc/debug/traced_picture.h"
      6 
      7 #include "base/json/json_writer.h"
      8 #include "base/strings/stringprintf.h"
      9 #include "base/values.h"
     10 #include "cc/debug/traced_value.h"
     11 
     12 namespace cc {
     13 
     14 TracedPicture::TracedPicture(scoped_refptr<Picture> picture)
     15   : picture_(picture) {
     16 }
     17 
     18 TracedPicture::~TracedPicture() {
     19 }
     20 
     21 scoped_ptr<base::debug::ConvertableToTraceFormat>
     22     TracedPicture::AsTraceablePicture(Picture* picture) {
     23   TracedPicture* ptr = new TracedPicture(picture);
     24   scoped_ptr<TracedPicture> result(ptr);
     25   return result.PassAs<base::debug::ConvertableToTraceFormat>();
     26 }
     27 
     28 void TracedPicture::AppendAsTraceFormat(std::string* out) const {
     29   scoped_ptr<base::Value> value = picture_->AsValue();
     30   std::string tmp;
     31   base::JSONWriter::Write(value.get(), &tmp);
     32   out->append(tmp);
     33 }
     34 
     35 }  // namespace cc
     36