| OLD | NEW |
| 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 "config.h" | 20 #include "config.h" |
| 21 | 21 |
| 22 #include "platform/graphics/GraphicsLayerDebugInfo.h" | 22 #include "platform/graphics/GraphicsLayerDebugInfo.h" |
| 23 #include "public/platform/WebGraphicsLayerDebugInfo.h" |
| 24 #include "public/platform/WebVector.h" |
| 23 | 25 |
| 24 #include "wtf/text/CString.h" | 26 #include "wtf/text/CString.h" |
| 25 | 27 |
| 26 namespace blink { | 28 namespace blink { |
| 27 | 29 |
| 28 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo() | 30 GraphicsLayerDebugInfo::GraphicsLayerDebugInfo() |
| 29 : m_compositingReasons(CompositingReasonNone) | 31 : m_compositingReasons(CompositingReasonNone) |
| 30 { | 32 { |
| 31 } | 33 } |
| 32 | 34 |
| 33 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { } | 35 GraphicsLayerDebugInfo::~GraphicsLayerDebugInfo() { } |
| 34 | 36 |
| 35 void GraphicsLayerDebugInfo::appendAsTraceFormat(WebString* out) const | 37 void GraphicsLayerDebugInfo::appendAsTraceFormat(WebString* out) const |
| 36 { | 38 { |
| 37 RefPtr<JSONObject> jsonObject = JSONObject::create(); | 39 RefPtr<JSONObject> jsonObject = JSONObject::create(); |
| 38 appendLayoutRects(jsonObject.get()); | 40 appendLayoutRects(jsonObject.get()); |
| 39 appendCompositingReasons(jsonObject.get()); | 41 appendCompositingReasons(jsonObject.get()); |
| 40 appendDebugName(jsonObject.get()); | 42 appendDebugName(jsonObject.get()); |
| 41 appendOwnerNodeId(jsonObject.get()); | 43 appendOwnerNodeId(jsonObject.get()); |
| 42 *out = jsonObject->toJSONString(); | 44 *out = jsonObject->toJSONString(); |
| 43 } | 45 } |
| 44 | 46 |
| 47 void GraphicsLayerDebugInfo::getAnnotatedInvalidationRects(WebVector<WebAnnotate
dInvalidationRect>& result) const |
| 48 { |
| 49 result.assign(m_invalidations.data(), m_invalidations.size()); |
| 50 } |
| 51 |
| 45 GraphicsLayerDebugInfo* GraphicsLayerDebugInfo::clone() const | 52 GraphicsLayerDebugInfo* GraphicsLayerDebugInfo::clone() const |
| 46 { | 53 { |
| 47 GraphicsLayerDebugInfo* toReturn = new GraphicsLayerDebugInfo(); | 54 GraphicsLayerDebugInfo* toReturn = new GraphicsLayerDebugInfo(); |
| 48 for (size_t i = 0; i < m_currentLayoutRects.size(); ++i) | 55 for (size_t i = 0; i < m_currentLayoutRects.size(); ++i) |
| 49 toReturn->currentLayoutRects().append(m_currentLayoutRects[i]); | 56 toReturn->currentLayoutRects().append(m_currentLayoutRects[i]); |
| 50 toReturn->setCompositingReasons(m_compositingReasons); | 57 toReturn->setCompositingReasons(m_compositingReasons); |
| 51 toReturn->setOwnerNodeId(m_ownerNodeId); | 58 toReturn->setOwnerNodeId(m_ownerNodeId); |
| 59 toReturn->m_invalidations = m_invalidations; |
| 52 return toReturn; | 60 return toReturn; |
| 53 } | 61 } |
| 54 | 62 |
| 55 void GraphicsLayerDebugInfo::appendLayoutRects(JSONObject* jsonObject) const | 63 void GraphicsLayerDebugInfo::appendLayoutRects(JSONObject* jsonObject) const |
| 56 { | 64 { |
| 57 RefPtr<JSONArray> jsonArray = JSONArray::create(); | 65 RefPtr<JSONArray> jsonArray = JSONArray::create(); |
| 58 for (size_t i = 0; i < m_currentLayoutRects.size(); i++) { | 66 for (size_t i = 0; i < m_currentLayoutRects.size(); i++) { |
| 59 const LayoutRect& rect = m_currentLayoutRects[i]; | 67 const LayoutRect& rect = m_currentLayoutRects[i]; |
| 60 RefPtr<JSONObject> rectContainer = JSONObject::create(); | 68 RefPtr<JSONObject> rectContainer = JSONObject::create(); |
| 61 RefPtr<JSONArray> rectArray = JSONArray::create(); | 69 RefPtr<JSONArray> rectArray = JSONArray::create(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 89 } | 97 } |
| 90 | 98 |
| 91 void GraphicsLayerDebugInfo::appendOwnerNodeId(JSONObject* jsonObject) const | 99 void GraphicsLayerDebugInfo::appendOwnerNodeId(JSONObject* jsonObject) const |
| 92 { | 100 { |
| 93 if (!m_ownerNodeId) | 101 if (!m_ownerNodeId) |
| 94 return; | 102 return; |
| 95 | 103 |
| 96 jsonObject->setNumber("owner_node", m_ownerNodeId); | 104 jsonObject->setNumber("owner_node", m_ownerNodeId); |
| 97 } | 105 } |
| 98 | 106 |
| 107 void GraphicsLayerDebugInfo::appendAnnotatedInvalidateRect(const FloatRect& rect
, WebInvalidationDebugAnnotations annotations) |
| 108 { |
| 109 WebAnnotatedInvalidationRect annotatedRect = { |
| 110 WebFloatRect(rect), |
| 111 annotations |
| 112 }; |
| 113 m_invalidations.append(annotatedRect); |
| 114 } |
| 115 |
| 116 void GraphicsLayerDebugInfo::clearAnnotatedInvalidateRects() |
| 117 { |
| 118 m_invalidations.clear(); |
| 119 } |
| 120 |
| 99 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |