OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/debug/traced_picture.h" | 5 #include "cc/debug/traced_picture.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 scoped_ptr<base::debug::ConvertableToTraceFormat> | 21 scoped_ptr<base::debug::ConvertableToTraceFormat> |
22 TracedPicture::AsTraceablePicture(Picture* picture) { | 22 TracedPicture::AsTraceablePicture(Picture* picture) { |
23 TracedPicture* ptr = new TracedPicture(picture); | 23 TracedPicture* ptr = new TracedPicture(picture); |
24 scoped_ptr<TracedPicture> result(ptr); | 24 scoped_ptr<TracedPicture> result(ptr); |
25 return result.PassAs<base::debug::ConvertableToTraceFormat>(); | 25 return result.PassAs<base::debug::ConvertableToTraceFormat>(); |
26 } | 26 } |
27 | 27 |
28 void TracedPicture::AppendAsTraceFormat(std::string* out) const { | 28 void TracedPicture::AppendAsTraceFormat(std::string* out) const { |
29 std::string encoded_picture; | 29 std::string encoded_picture; |
30 picture_->AsBase64String(&encoded_picture); | 30 picture_->AsBase64String(&encoded_picture); |
31 out->append("\""); | 31 out->append("{"); |
32 out->append("\"layer_rect\": ["); | |
33 base::StringAppendF( | |
34 out, "%i,%i,%i,%i", | |
35 picture_->LayerRect().x(), picture_->LayerRect().y(), | |
vmpstr2
2013/05/14 18:16:09
picture's layer rect is encoded as a part of AsBas
| |
36 picture_->LayerRect().width(), picture_->LayerRect().height()); | |
37 out->append("],"); | |
38 out->append("\"data_b64\": \""); | |
32 out->append(encoded_picture); | 39 out->append(encoded_picture); |
33 out->append("\""); | 40 out->append("\"}"); |
34 } | 41 } |
35 | 42 |
36 } // namespace cc | 43 } // namespace cc |
OLD | NEW |