diff options
author | hendrikw <hendrikw@chromium.org> | 2014-12-03 13:48:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-03 21:48:50 +0000 |
commit | 699655243cf97aac9e8b859c49f5fe710b0d0e0c (patch) | |
tree | cf9e4f06db1c1ad2f15d7855c3072bad549360a3 | |
parent | d653e4129275d63deef1c4167350962b1eb862fe (diff) | |
download | chromium_src-699655243cf97aac9e8b859c49f5fe710b0d0e0c.zip chromium_src-699655243cf97aac9e8b859c49f5fe710b0d0e0c.tar.gz chromium_src-699655243cf97aac9e8b859c49f5fe710b0d0e0c.tar.bz2 |
cc: Trace event for veto reason
Allow a pointer to a |reason| string to be passed through the
|Picture| to the |SkPicture|.
Create an instant event when the gpu rasterization veto
is hit.
BUG=434613
Review URL: https://codereview.chromium.org/780683002
Cr-Commit-Position: refs/heads/master@{#306683}
-rw-r--r-- | cc/resources/picture.cc | 14 | ||||
-rw-r--r-- | cc/resources/picture.h | 2 | ||||
-rw-r--r-- | cc/resources/picture_pile.cc | 12 |
3 files changed, 16 insertions, 12 deletions
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index 5b90571..6530866 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -175,17 +175,13 @@ Picture::~Picture() { TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this); } -bool Picture::IsSuitableForGpuRasterization() const { +bool Picture::IsSuitableForGpuRasterization(const char** reason) const { DCHECK(picture_); - // TODO(alokp): SkPicture::suitableForGpuRasterization needs a GrContext. - // Ideally this GrContext should be the same as that for rasterizing this - // picture. But we are on the main thread while the rasterization context - // may be on the compositor or raster thread. - // SkPicture::suitableForGpuRasterization is not implemented yet. - // Pass a NULL context for now and discuss with skia folks if the context - // is really needed. - return picture_->suitableForGpuRasterization(NULL); + // TODO(hendrikw): SkPicture::suitableForGpuRasterization takes a GrContext. + // Currently the GrContext isn't used, and should probably be removed from + // skia. + return picture_->suitableForGpuRasterization(nullptr, reason); } int Picture::ApproximateOpCount() const { diff --git a/cc/resources/picture.h b/cc/resources/picture.h index 771d715..ec2ff4b 100644 --- a/cc/resources/picture.h +++ b/cc/resources/picture.h @@ -65,7 +65,7 @@ class CC_EXPORT Picture // Has Record() been called yet? bool HasRecording() const { return picture_.get() != NULL; } - bool IsSuitableForGpuRasterization() const; + bool IsSuitableForGpuRasterization(const char** reason) const; int ApproximateOpCount() const; size_t ApproximateMemoryUsage() const; diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc index d94ce7c..c3050c3 100644 --- a/cc/resources/picture_pile.cc +++ b/cc/resources/picture_pile.cc @@ -556,8 +556,16 @@ void PicturePile::CreatePictures(ContentLayerClient* painter, // even if that content is replaced by gpu-friendly content. // This is an optimization to avoid iterating though all pictures in // the pile after each invalidation. - is_suitable_for_gpu_rasterization_ &= - picture->IsSuitableForGpuRasterization(); + if (is_suitable_for_gpu_rasterization_) { + const char* reason = nullptr; + is_suitable_for_gpu_rasterization_ &= + picture->IsSuitableForGpuRasterization(&reason); + + if (!is_suitable_for_gpu_rasterization_) { + TRACE_EVENT_INSTANT1("cc", "GPU Rasterization Veto", + TRACE_EVENT_SCOPE_THREAD, "reason", reason); + } + } } bool found_tile_for_recorded_picture = false; |