Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2361)

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12096112: [cc] Trace detailed tile info when --trace-all-rendered-frames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dont expose to extension yet Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/math_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 607a50c2344ce9bc1810702f5238d2507b535de4..e357999dcb264deb268a5c190e8f2662127359c6 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -11,6 +11,7 @@
#include "base/json/json_writer.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
+#include "base/stringprintf.h"
#include "cc/append_quads_data.h"
#include "cc/compositor_frame_metadata.h"
#include "cc/damage_tracker.h"
@@ -29,6 +30,7 @@
#include "cc/overdraw_metrics.h"
#include "cc/page_scale_animation.h"
#include "cc/paint_time_counter.h"
+#include "cc/picture_layer_tiling.h"
#include "cc/prioritized_resource_manager.h"
#include "cc/quad_culler.h"
#include "cc/render_pass_draw_quad.h"
@@ -58,6 +60,13 @@ void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible)
TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::setVisible", id);
}
+std::string ValueToString(scoped_ptr<base::Value> value)
+{
+ std::string str;
+ base::JSONWriter::Write(value.get(), &str);
+ return str;
+}
+
} // namespace
namespace cc {
@@ -163,6 +172,8 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
DCHECK(m_proxy->isImplThread());
didVisibilityChange(this, m_visible);
+ setDebugState(settings.initialDebugState);
+
if (settings.calculateTopControlsPosition)
m_topControlsManager = TopControlsManager::Create(this, settings.topControlsHeight);
@@ -801,6 +812,11 @@ void LayerTreeHostImpl::drawLayers(FrameData& frame)
if (m_debugState.showHudRects())
m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenSpaceRects, m_debugState);
+ if (m_debugState.traceAllRenderedFrames) {
+ TRACE_EVENT_INSTANT1("cc.debug", "Frame",
+ "frame", ValueToString(frameStateAsValue()));
+ }
+
// Because the contents of the HUD depend on everything else in the frame, the contents
// of its texture are updated as the last thing before the frame is drawn.
if (m_activeTree->hud_layer())
@@ -928,6 +944,8 @@ void LayerTreeHostImpl::createPendingTree()
m_client->onCanDrawStateChanged(canDraw());
m_client->onHasPendingTreeStateChanged(pendingTree());
TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", m_pendingTree.get());
+ TRACE_EVENT_ASYNC_STEP0("cc",
+ "PendingTree", m_pendingTree.get(), "waiting");
}
void LayerTreeHostImpl::checkForCompletedTileUploads()
@@ -937,25 +955,6 @@ void LayerTreeHostImpl::checkForCompletedTileUploads()
m_tileManager->CheckForCompletedTileUploads();
}
-scoped_ptr<base::Value> LayerTreeHostImpl::activationStateAsValue() const
-{
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->SetBoolean("visible_resources_ready", pendingTree()->AreVisibleResourcesReady());
- state->Set("tile_manager", m_tileManager->AsValue().release());
- return state.PassAs<base::Value>();
-}
-
-namespace {
-
-std::string ValueToString(scoped_ptr<base::Value> value)
-{
- std::string str;
- base::JSONWriter::Write(value.get(), &str);
- return str;
-}
-
-}
-
void LayerTreeHostImpl::activatePendingTreeIfNeeded()
{
if (!pendingTree())
@@ -974,8 +973,11 @@ void LayerTreeHostImpl::activatePendingTreeIfNeeded()
// or tile manager has no work scheduled for pending tree.
if (activeTree()->RootLayer() &&
!pendingTree()->AreVisibleResourcesReady() &&
- m_tileManager->HasPendingWorkScheduled(PENDING_TREE))
+ m_tileManager->HasPendingWorkScheduled(PENDING_TREE)) {
+ TRACE_EVENT_ASYNC_STEP0("cc",
+ "PendingTree", m_pendingTree.get(), "waiting");
return;
+ }
activatePendingTree();
}
@@ -1695,6 +1697,33 @@ base::TimeTicks LayerTreeHostImpl::currentFrameTime()
return m_currentFrameTime;
}
+scoped_ptr<base::Value> LayerTreeHostImpl::asValue() const
+{
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->Set("activation_state", activationStateAsValue().release());
+ state->Set("frame_state", frameStateAsValue().release());
+ return state.PassAs<base::Value>();
+}
+
+scoped_ptr<base::Value> LayerTreeHostImpl::activationStateAsValue() const
+{
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->SetString("lthi_id", StringPrintf("%p", this));
+ state->SetBoolean("visible_resources_ready", pendingTree()->AreVisibleResourcesReady());
+ state->Set("tile_manager", m_tileManager->BasicStateAsValue().release());
+ return state.PassAs<base::Value>();
+}
+
+scoped_ptr<base::Value> LayerTreeHostImpl::frameStateAsValue() const
+{
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->SetString("lthi_id", StringPrintf("%p", this));
+ state->Set("device_viewport_size", MathUtil::asValue(m_deviceViewportSize).release());
+ if (m_tileManager)
+ state->Set("tiles", m_tileManager->AllTilesAsValue().release());
+ return state.PassAs<base::Value>();
+}
+
// static
LayerImpl* LayerTreeHostImpl::getNonCompositedContentLayerRecursive(LayerImpl* layer)
{
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/math_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698