summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-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
5 files changed, 47 insertions, 3 deletions
diff --git a/DEPS b/DEPS
index dd2f98a..5bdc320 100644
--- a/DEPS
+++ b/DEPS
@@ -69,7 +69,7 @@ deps = {
"/external/angle.git@41159326ab429bb88262f80118e79bb5a108f0db",
"src/third_party/trace-viewer":
- (Var("googlecode_url") % "trace-viewer") + "/trunk@893",
+ (Var("googlecode_url") % "trace-viewer") + "/trunk@942",
"src/third_party/WebKit":
Var("webkit_trunk") + "@" + Var("webkit_revision"),
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);