summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorcaseq@google.com <caseq@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 16:01:29 +0000
committercaseq@google.com <caseq@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 16:01:29 +0000
commitdf41c04462f91108f29eb75a02caf7844e131e32 (patch)
tree16dabbc874217569af162c917c5422e01092d108 /cc
parentfc72ceb305d5ef030e7e69cce8223927353cf52e (diff)
downloadchromium_src-df41c04462f91108f29eb75a02caf7844e131e32.zip
chromium_src-df41c04462f91108f29eb75a02caf7844e131e32.tar.gz
chromium_src-df41c04462f91108f29eb75a02caf7844e131e32.tar.bz2
Emit trace events during layer update and tile rasterization that are processed by DevTools to show time spent in rasterization.
WebKit side processing: https://bugs.webkit.org/show_bug.cgi?id=105851 BUG=none TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=184923 Review URL: https://codereview.chromium.org/12220019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.gyp1
-rw-r--r--cc/devtools_instrumentation.h57
-rw-r--r--cc/picture_layer.cc3
-rw-r--r--cc/picture_layer.h3
-rw-r--r--cc/picture_layer_impl.cc3
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc3
-rw-r--r--cc/tile.cc6
-rw-r--r--cc/tile.h6
-rw-r--r--cc/tile_manager.cc3
-rw-r--r--cc/tile_manager.h1
10 files changed, 81 insertions, 5 deletions
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 82bbedc..b94b394 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -56,6 +56,7 @@
'delegated_renderer_layer_impl.h',
'delegating_renderer.cc',
'delegating_renderer.h',
+ 'devtools_instrumentation.h',
'direct_renderer.cc',
'direct_renderer.h',
'draw_properties.h',
diff --git a/cc/devtools_instrumentation.h b/cc/devtools_instrumentation.h
new file mode 100644
index 0000000..04b6ef8
--- /dev/null
+++ b/cc/devtools_instrumentation.h
@@ -0,0 +1,57 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_DEVTOOLS_INSTRUMENTATION_H_
+#define CC_DEVTOOLS_INSTRUMENTATION_H_
+
+#include "base/debug/trace_event.h"
+
+namespace cc {
+namespace devtools_instrumentation {
+
+namespace internal {
+const char kCategory[] = "cc,devtools";
+const char kLayerId[] = "layerId";
+const char kPaintLayer[] = "PaintLayer";
+const char kRasterTask[] = "RasterTask";
+}
+
+struct ScopedPaintLayer
+{
+ ScopedPaintLayer(int layer_id) {
+ TRACE_EVENT_BEGIN1(internal::kCategory, internal::kPaintLayer,
+ internal::kLayerId, layer_id);
+ }
+ ~ScopedPaintLayer() {
+ TRACE_EVENT_END0(internal::kCategory, internal::kPaintLayer);
+ }
+};
+
+struct ScopedRasterTask
+{
+ ScopedRasterTask(int layer_id) {
+ TRACE_EVENT_BEGIN1(internal::kCategory, internal::kRasterTask,
+ internal::kLayerId, layer_id);
+ }
+ ~ScopedRasterTask() {
+ TRACE_EVENT_END0(internal::kCategory, internal::kRasterTask);
+ }
+};
+
+struct ScopedLayerObjectTracker
+ : public base::debug::TraceScopedTrackableObject<int>
+{
+ ScopedLayerObjectTracker(int layer_id)
+ : base::debug::TraceScopedTrackableObject<int>(
+ internal::kCategory,
+ internal::kLayerId,
+ layer_id) {
+ }
+};
+
+}
+}
+
+#endif
+
diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc
index b9ce65a..8c5bc91 100644
--- a/cc/picture_layer.cc
+++ b/cc/picture_layer.cc
@@ -4,6 +4,7 @@
#include "cc/picture_layer.h"
+#include "cc/devtools_instrumentation.h"
#include "cc/layer_tree_impl.h"
#include "cc/picture_layer_impl.h"
#include "ui/gfx/rect_conversions.h"
@@ -17,6 +18,7 @@ scoped_refptr<PictureLayer> PictureLayer::create(ContentLayerClient* client) {
PictureLayer::PictureLayer(ContentLayerClient* client) :
client_(client),
pile_(make_scoped_refptr(new PicturePile())),
+ instrumentation_object_tracker_(id()),
is_mask_(false) {
}
@@ -74,6 +76,7 @@ void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
gfx::Rect visible_layer_rect = gfx::ToEnclosingRect(
gfx::ScaleRect(visibleContentRect(), 1.f / contentsScaleX()));
+ devtools_instrumentation::ScopedPaintLayer paint_layer(id());
pile_->Update(client_, pile_invalidation_, visible_layer_rect, stats);
}
diff --git a/cc/picture_layer.h b/cc/picture_layer.h
index a0739d9..ff756bc 100644
--- a/cc/picture_layer.h
+++ b/cc/picture_layer.h
@@ -6,6 +6,7 @@
#define CC_PICTURE_LAYER_H_
#include "cc/contents_scaling_layer.h"
+#include "cc/devtools_instrumentation.h"
#include "cc/layer.h"
#include "cc/picture_pile.h"
#include "cc/occlusion_tracker.h"
@@ -42,6 +43,8 @@ class CC_EXPORT PictureLayer : public ContentsScalingLayer {
private:
ContentLayerClient* client_;
scoped_refptr<PicturePile> pile_;
+ devtools_instrumentation::
+ ScopedLayerObjectTracker instrumentation_object_tracker_;
// Invalidation to use the next time update is called.
Region pending_invalidation_;
// Invalidation from the last time update was called.
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index 007302e..f0ce9ad 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -333,7 +333,8 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
GL_RGBA,
content_rect,
contentsOpaque() ? content_rect : gfx::Rect(),
- tiling->contents_scale()));
+ tiling->contents_scale(),
+ id()));
}
void PictureLayerImpl::UpdatePile(Tile* tile) {
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index 129f965..e3c2f6b 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -37,7 +37,8 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
GL_RGBA,
rect,
gfx::Rect(),
- 1));
+ 1,
+ 0));
}
void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) {
diff --git a/cc/tile.cc b/cc/tile.cc
index ec25b0e..8185791 100644
--- a/cc/tile.cc
+++ b/cc/tile.cc
@@ -16,13 +16,15 @@ Tile::Tile(TileManager* tile_manager,
GLenum format,
gfx::Rect content_rect,
gfx::Rect opaque_rect,
- float contents_scale)
+ float contents_scale,
+ int layer_id)
: tile_manager_(tile_manager),
tile_size_(tile_size),
format_(format),
content_rect_(content_rect),
opaque_rect_(opaque_rect),
- contents_scale_(contents_scale) {
+ contents_scale_(contents_scale),
+ layer_id_(layer_id) {
set_picture_pile(picture_pile);
tile_manager_->RegisterTile(this);
}
diff --git a/cc/tile.h b/cc/tile.h
index f8b40d0..1c988c2dc 100644
--- a/cc/tile.h
+++ b/cc/tile.h
@@ -28,7 +28,8 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
GLenum format,
gfx::Rect content_rect,
gfx::Rect opaque_rect,
- float contents_scale);
+ float contents_scale,
+ int layer_id);
PicturePileImpl* picture_pile() {
return picture_pile_.get();
@@ -67,6 +68,8 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
float contents_scale() const { return contents_scale_; }
gfx::Rect content_rect() const { return content_rect_; }
+ int layer_id() const { return layer_id_; }
+
void set_picture_pile(scoped_refptr<PicturePileImpl> pile) {
DCHECK(pile->CanRaster(contents_scale_, content_rect_));
picture_pile_ = pile;
@@ -101,6 +104,7 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> {
TilePriority priority_[NUM_BIN_PRIORITIES];
ManagedTileState managed_state_;
+ int layer_id_;
};
} // namespace cc
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index 580759f..054b5e5 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -11,6 +11,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "cc/devtools_instrumentation.h"
#include "cc/math_util.h"
#include "cc/platform_color.h"
#include "cc/raster_worker_pool.h"
@@ -820,6 +821,7 @@ TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata(
metadata.is_tile_in_pending_tree_now_bin =
mts.tree_bin[PENDING_TREE] == NOW_BIN;
metadata.tile_resolution = mts.resolution;
+ metadata.layer_id = tile.layer_id();
return metadata;
}
@@ -922,6 +924,7 @@ void TileManager::RunRasterTask(uint8* buffer,
metadata.is_tile_in_pending_tree_now_bin,
"is_low_res",
metadata.tile_resolution == LOW_RESOLUTION);
+ devtools_instrumentation::ScopedRasterTask raster_task(metadata.layer_id);
DCHECK(picture_pile);
DCHECK(buffer);
diff --git a/cc/tile_manager.h b/cc/tile_manager.h
index 3d2d4b3..6d2c621 100644
--- a/cc/tile_manager.h
+++ b/cc/tile_manager.h
@@ -151,6 +151,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
bool use_cheapness_estimator;
bool is_tile_in_pending_tree_now_bin;
TileResolution tile_resolution;
+ int layer_id;
};
RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const;