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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayerDebugInfo.cpp

Issue 2015433004: Add main thread scrolling reasons to GraphicsLayer::layerTreeAsJSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: main thread scrlling reasons added to GraphicsLayerDebugInfo. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "platform/graphics/GraphicsLayerDebugInfo.h" 20 #include "platform/graphics/GraphicsLayerDebugInfo.h"
21 21
22 #include "base/trace_event/trace_event_argument.h" 22 #include "base/trace_event/trace_event_argument.h"
23 #include "platform/scroll/MainThreadScrollingReason.h"
24
25 #include <vector>
23 26
24 namespace blink { 27 namespace blink {
25 28
26 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo() 29 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo()
27 : m_compositingReasons(CompositingReasonNone) 30 : m_compositingReasons(CompositingReasonNone)
28 , m_squashingDisallowedReasons(SquashingDisallowedReasonsNone) 31 , m_squashingDisallowedReasons(SquashingDisallowedReasonsNone)
29 , m_ownerNodeId(0) 32 , m_ownerNodeId(0)
33 , m_mainThreadScrollingReasons(0)
30 { 34 {
31 } 35 }
32 36
33 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { } 37 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { }
34 38
35 std::unique_ptr<base::trace_event::TracedValue> GraphicsLayerDebugInfo::asTraced Value() const 39 std::unique_ptr<base::trace_event::TracedValue> GraphicsLayerDebugInfo::asTraced Value() const
36 { 40 {
37 std::unique_ptr<base::trace_event::TracedValue> tracedValue( 41 std::unique_ptr<base::trace_event::TracedValue> tracedValue(
38 new base::trace_event::TracedValue()); 42 new base::trace_event::TracedValue());
39 appendAnnotatedInvalidateRects(tracedValue.get()); 43 appendAnnotatedInvalidateRects(tracedValue.get());
40 appendCompositingReasons(tracedValue.get()); 44 appendCompositingReasons(tracedValue.get());
41 appendSquashingDisallowedReasons(tracedValue.get()); 45 appendSquashingDisallowedReasons(tracedValue.get());
42 appendOwnerNodeId(tracedValue.get()); 46 appendOwnerNodeId(tracedValue.get());
47 appendMainThreadScrollingReasons(tracedValue.get());
43 return tracedValue; 48 return tracedValue;
44 } 49 }
45 50
46 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRects(base::trace_event::T racedValue* tracedValue) const 51 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRects(base::trace_event::T racedValue* tracedValue) const
47 { 52 {
48 tracedValue->BeginArray("annotated_invalidation_rects"); 53 tracedValue->BeginArray("annotated_invalidation_rects");
49 for (const auto& annotatedRect : m_previousInvalidations) { 54 for (const auto& annotatedRect : m_previousInvalidations) {
50 const FloatRect& rect = annotatedRect.rect; 55 const FloatRect& rect = annotatedRect.rect;
51 tracedValue->BeginDictionary(); 56 tracedValue->BeginDictionary();
52 tracedValue->BeginArray("geometry_rect"); 57 tracedValue->BeginArray("geometry_rect");
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 }; 104 };
100 m_invalidations.append(annotatedRect); 105 m_invalidations.append(annotatedRect);
101 } 106 }
102 107
103 void GraphicsLayerDebugInfo::clearAnnotatedInvalidateRects() 108 void GraphicsLayerDebugInfo::clearAnnotatedInvalidateRects()
104 { 109 {
105 m_previousInvalidations.clear(); 110 m_previousInvalidations.clear();
106 m_previousInvalidations.swap(m_invalidations); 111 m_previousInvalidations.swap(m_invalidations);
107 } 112 }
108 113
114 void GraphicsLayerDebugInfo::appendMainThreadScrollingReasons(base::trace_event: :TracedValue* tracedValue) const
115 {
116 std::vector<std::string> reasons = MainThreadScrollingReason::mainThreadScro llingReasonsAsStringArray(m_mainThreadScrollingReasons);
117 size_t arraySize = reasons.size();
118 tracedValue->BeginArray("main_thread_scrolling_reasons");
119 for (size_t i = 0; i < arraySize; ++i) {
120 tracedValue->AppendString(reasons[i]);
121 }
122 tracedValue->EndArray();
123 }
124
109 } // namespace blink 125 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698