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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11446076: Added LayerTreeHostImpl::layerTreeAsJson which serializes a layer tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/json/json_writer.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "cc/append_quads_data.h" 13 #include "cc/append_quads_data.h"
13 #include "cc/damage_tracker.h" 14 #include "cc/damage_tracker.h"
14 #include "cc/debug_rect_history.h" 15 #include "cc/debug_rect_history.h"
15 #include "cc/delay_based_time_source.h" 16 #include "cc/delay_based_time_source.h"
16 #include "cc/frame_rate_counter.h" 17 #include "cc/frame_rate_counter.h"
17 #include "cc/gl_renderer.h" 18 #include "cc/gl_renderer.h"
18 #include "cc/heads_up_display_layer_impl.h" 19 #include "cc/heads_up_display_layer_impl.h"
19 #include "cc/layer_iterator.h" 20 #include "cc/layer_iterator.h"
20 #include "cc/layer_tree_host.h" 21 #include "cc/layer_tree_host.h"
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 { 1546 {
1546 std::string str; 1547 std::string str;
1547 if (rootLayer()) { 1548 if (rootLayer()) {
1548 str = rootLayer()->layerTreeAsText(); 1549 str = rootLayer()->layerTreeAsText();
1549 str += "RenderSurfaces:\n"; 1550 str += "RenderSurfaces:\n";
1550 dumpRenderSurfaces(&str, 1, rootLayer()); 1551 dumpRenderSurfaces(&str, 1, rootLayer());
1551 } 1552 }
1552 return str; 1553 return str;
1553 } 1554 }
1554 1555
1556 std::string LayerTreeHostImpl::layerTreeAsJson() const
1557 {
1558 std::string str;
1559 if (rootLayer()) {
1560 scoped_ptr<base::Value> json(rootLayer()->layerTreeAsJson());
1561 base::JSONWriter::WriteWithOptions(
1562 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str);
1563 }
1564 return str;
1565 }
1566
1555 void LayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const L ayerImpl* layer) const 1567 void LayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const L ayerImpl* layer) const
1556 { 1568 {
1557 if (layer->renderSurface()) 1569 if (layer->renderSurface())
1558 layer->renderSurface()->dumpSurface(str, indent); 1570 layer->renderSurface()->dumpSurface(str, indent);
1559 1571
1560 for (size_t i = 0; i < layer->children().size(); ++i) 1572 for (size_t i = 0; i < layer->children().size(); ++i)
1561 dumpRenderSurfaces(str, indent, layer->children()[i]); 1573 dumpRenderSurfaces(str, indent, layer->children()[i]);
1562 } 1574 }
1563 1575
1564 int LayerTreeHostImpl::sourceAnimationFrameNumber() const 1576 int LayerTreeHostImpl::sourceAnimationFrameNumber() const
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 1626
1615 void LayerTreeHostImpl::UnregisterAnimationController(LayerAnimationController* controller) { 1627 void LayerTreeHostImpl::UnregisterAnimationController(LayerAnimationController* controller) {
1616 #if !defined(NDEBUG) 1628 #if !defined(NDEBUG)
1617 if (ContainsKey(m_allAnimationControllers, controller)) 1629 if (ContainsKey(m_allAnimationControllers, controller))
1618 m_allAnimationControllers.erase(controller); 1630 m_allAnimationControllers.erase(controller);
1619 #endif 1631 #endif
1620 DidDeactivateAnimationController(controller); 1632 DidDeactivateAnimationController(controller);
1621 } 1633 }
1622 1634
1623 } // namespace cc 1635 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698