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

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

Issue 1730653002: Move squash preventing reasons out of compositing reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug and test fixes. Created 4 years, 9 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 23
24 namespace blink { 24 namespace blink {
25 25
26 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo() 26 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo()
27 : m_compositingReasons(CompositingReasonNone) 27 : m_compositingReasons(CompositingReasonNone)
28 , m_squashingDisallowedReasons(SquashingDisallowedReasonsNone)
28 , m_ownerNodeId(0) 29 , m_ownerNodeId(0)
29 { 30 {
30 } 31 }
31 32
32 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { } 33 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { }
33 34
34 scoped_refptr<base::trace_event::TracedValue> GraphicsLayerDebugInfo::asTracedVa lue() const 35 scoped_refptr<base::trace_event::TracedValue> GraphicsLayerDebugInfo::asTracedVa lue() const
35 { 36 {
36 scoped_refptr<base::trace_event::TracedValue> tracedValue = new base::trace_ event::TracedValue; 37 scoped_refptr<base::trace_event::TracedValue> tracedValue = new base::trace_ event::TracedValue;
37 appendAnnotatedInvalidateRects(tracedValue.get()); 38 appendAnnotatedInvalidateRects(tracedValue.get());
38 appendCompositingReasons(tracedValue.get()); 39 appendCompositingReasons(tracedValue.get());
40 appendSquashingDisallowedReasons(tracedValue.get());
39 appendOwnerNodeId(tracedValue.get()); 41 appendOwnerNodeId(tracedValue.get());
40 return tracedValue; 42 return tracedValue;
41 } 43 }
42 44
43 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRects(base::trace_event::T racedValue* tracedValue) const 45 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRects(base::trace_event::T racedValue* tracedValue) const
44 { 46 {
45 tracedValue->BeginArray("annotated_invalidation_rects"); 47 tracedValue->BeginArray("annotated_invalidation_rects");
46 for (const auto& annotatedRect : m_previousInvalidations) { 48 for (const auto& annotatedRect : m_previousInvalidations) {
47 const FloatRect& rect = annotatedRect.rect; 49 const FloatRect& rect = annotatedRect.rect;
48 tracedValue->BeginDictionary(); 50 tracedValue->BeginDictionary();
(...skipping 13 matching lines...) Expand all
62 { 64 {
63 tracedValue->BeginArray("compositing_reasons"); 65 tracedValue->BeginArray("compositing_reasons");
64 for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) { 66 for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) {
65 if (!(m_compositingReasons & kCompositingReasonStringMap[i].reason)) 67 if (!(m_compositingReasons & kCompositingReasonStringMap[i].reason))
66 continue; 68 continue;
67 tracedValue->AppendString(kCompositingReasonStringMap[i].description); 69 tracedValue->AppendString(kCompositingReasonStringMap[i].description);
68 } 70 }
69 tracedValue->EndArray(); 71 tracedValue->EndArray();
70 } 72 }
71 73
74 void GraphicsLayerDebugInfo::appendSquashingDisallowedReasons(base::trace_event: :TracedValue* tracedValue) const
75 {
76 tracedValue->BeginArray("squashing_disallowed_reasons");
77 for (size_t i = 0; i < kNumberOfSquashingDisallowedReasons; ++i) {
78 if (!(m_compositingReasons & kSquashingDisallowedReasonStringMap[i].reas on))
79 continue;
80 tracedValue->AppendString(kSquashingDisallowedReasonStringMap[i].descrip tion);
81 }
82 tracedValue->EndArray();
83 }
84
72 void GraphicsLayerDebugInfo::appendOwnerNodeId(base::trace_event::TracedValue* t racedValue) const 85 void GraphicsLayerDebugInfo::appendOwnerNodeId(base::trace_event::TracedValue* t racedValue) const
73 { 86 {
74 if (!m_ownerNodeId) 87 if (!m_ownerNodeId)
75 return; 88 return;
76 89
77 tracedValue->SetInteger("owner_node", m_ownerNodeId); 90 tracedValue->SetInteger("owner_node", m_ownerNodeId);
78 } 91 }
79 92
80 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRect(const FloatRect& rect , PaintInvalidationReason invalidationReason) 93 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRect(const FloatRect& rect , PaintInvalidationReason invalidationReason)
81 { 94 {
82 AnnotatedInvalidationRect annotatedRect = { 95 AnnotatedInvalidationRect annotatedRect = {
83 rect, 96 rect,
84 invalidationReason 97 invalidationReason
85 }; 98 };
86 m_invalidations.append(annotatedRect); 99 m_invalidations.append(annotatedRect);
87 } 100 }
88 101
89 void GraphicsLayerDebugInfo::clearAnnotatedInvalidateRects() 102 void GraphicsLayerDebugInfo::clearAnnotatedInvalidateRects()
90 { 103 {
91 m_previousInvalidations.clear(); 104 m_previousInvalidations.clear();
92 m_previousInvalidations.swap(m_invalidations); 105 m_previousInvalidations.swap(m_invalidations);
93 } 106 }
94 107
95 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698