summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-04 01:14:12 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-04 01:14:12 +0000
commit054b11c1b32a3e1ba482aad93596a2975f918607 (patch)
tree6174522fe25fe21c2887c47ec1430bbc741a0692 /cc
parent546b002fe0366420c08fc8c2426271a7ed894ae6 (diff)
downloadchromium_src-054b11c1b32a3e1ba482aad93596a2975f918607.zip
chromium_src-054b11c1b32a3e1ba482aad93596a2975f918607.tar.gz
chromium_src-054b11c1b32a3e1ba482aad93596a2975f918607.tar.bz2
cc: Changed picture clones to emit an alias trace.
This patch changes the tracing snapshot code for pictures to emit a much smaller message for picture clones. The regular picture message looks like the following: { params: { layer_rect: { ... }, opaque_rect: { ... }, }, skp64: { /* large chunk here */ } } That message is generated for both the original picture and its clones. The format for the original picture stays the same, but the clone message becomes the following: { alias: { id_ref: { /* id of the original */ } } } This change has to be accompanied by a small change to trace-viewer to handle the new message correctly. Note this also includes a trace-viewer DEPS roll. R=nduca@chromium.org Review URL: https://chromiumcodereview.appspot.com/23717012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221102 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/debug/traced_picture.cc30
-rw-r--r--cc/debug/traced_picture.h7
-rw-r--r--cc/resources/picture.cc10
-rw-r--r--cc/resources/picture.h1
4 files changed, 46 insertions, 2 deletions
diff --git a/cc/debug/traced_picture.cc b/cc/debug/traced_picture.cc
index 7f04d0d..0cc2148 100644
--- a/cc/debug/traced_picture.cc
+++ b/cc/debug/traced_picture.cc
@@ -12,7 +12,8 @@
namespace cc {
TracedPicture::TracedPicture(scoped_refptr<Picture> picture)
- : picture_(picture) {
+ : picture_(picture),
+ is_alias_(false) {
}
TracedPicture::~TracedPicture() {
@@ -25,7 +26,34 @@ scoped_ptr<base::debug::ConvertableToTraceFormat>
return result.PassAs<base::debug::ConvertableToTraceFormat>();
}
+scoped_ptr<base::debug::ConvertableToTraceFormat>
+ TracedPicture::AsTraceablePictureAlias(Picture* original) {
+ TracedPicture* ptr = new TracedPicture(original);
+ ptr->is_alias_ = true;
+ scoped_ptr<TracedPicture> result(ptr);
+ return result.PassAs<base::debug::ConvertableToTraceFormat>();
+}
+
void TracedPicture::AppendAsTraceFormat(std::string* out) const {
+ if (is_alias_)
+ AppendPictureAlias(out);
+ else
+ AppendPicture(out);
+}
+
+void TracedPicture::AppendPictureAlias(std::string* out) const {
+ scoped_ptr<base::DictionaryValue> alias(new base::DictionaryValue());
+ alias->SetString("id_ref", base::StringPrintf("%p", picture_.get()));
+
+ scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue());
+ res->Set("alias", alias.release());
+
+ std::string tmp;
+ base::JSONWriter::Write(res.get(), &tmp);
+ out->append(tmp);
+}
+
+void TracedPicture::AppendPicture(std::string* out) const {
scoped_ptr<base::Value> value = picture_->AsValue();
std::string tmp;
base::JSONWriter::Write(value.get(), &tmp);
diff --git a/cc/debug/traced_picture.h b/cc/debug/traced_picture.h
index 9137d8f..50511f2 100644
--- a/cc/debug/traced_picture.h
+++ b/cc/debug/traced_picture.h
@@ -22,10 +22,17 @@ class TracedPicture : public base::debug::ConvertableToTraceFormat {
static scoped_ptr<base::debug::ConvertableToTraceFormat>
AsTraceablePicture(Picture* picture);
+ static scoped_ptr<base::debug::ConvertableToTraceFormat>
+ AsTraceablePictureAlias(Picture* original);
+
virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE;
private:
+ void AppendPicture(std::string* out) const;
+ void AppendPictureAlias(std::string* out) const;
+
scoped_refptr<Picture> picture_;
+ bool is_alias_;
DISALLOW_COPY_AND_ASSIGN(TracedPicture);
};
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 4927623..f9afca9 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -199,7 +199,7 @@ void Picture::CloneForDrawing(int num_threads) {
pixel_refs_));
clones_.push_back(clone);
- clone->EmitTraceSnapshot();
+ clone->EmitTraceSnapshotAlias(this);
}
}
@@ -369,6 +369,14 @@ void Picture::EmitTraceSnapshot() {
"cc::Picture", this, TracedPicture::AsTraceablePicture(this));
}
+void Picture::EmitTraceSnapshotAlias(Picture* original) {
+ TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
+ TRACE_DISABLED_BY_DEFAULT("cc.debug"),
+ "cc::Picture",
+ this,
+ TracedPicture::AsTraceablePictureAlias(original));
+}
+
base::LazyInstance<Picture::PixelRefs>
Picture::PixelRefIterator::empty_pixel_refs_;
diff --git a/cc/resources/picture.h b/cc/resources/picture.h
index 90df190..2386477 100644
--- a/cc/resources/picture.h
+++ b/cc/resources/picture.h
@@ -116,6 +116,7 @@ class CC_EXPORT Picture
};
void EmitTraceSnapshot();
+ void EmitTraceSnapshotAlias(Picture* original);
private:
explicit Picture(gfx::Rect layer_rect);