| Index: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
|
| index 1675ae9184734d9bb0cbfc90707de1c7d20e1afc..e2d09012d4db17d375a4159054a3af6ff608ed3a 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
|
| @@ -618,31 +618,31 @@ static bool comparePaintInvalidationInfo(const PaintInvalidationInfo& a, const P
|
| }
|
|
|
| template <typename T>
|
| -static PassRefPtr<JSONArray> pointAsJSONArray(const T& point)
|
| +static std::unique_ptr<JSONArray> pointAsJSONArray(const T& point)
|
| {
|
| - RefPtr<JSONArray> array = JSONArray::create();
|
| - array->pushNumber(point.x());
|
| - array->pushNumber(point.y());
|
| + std::unique_ptr<JSONArray> array = JSONArray::create();
|
| + array->pushDouble(point.x());
|
| + array->pushDouble(point.y());
|
| return array;
|
| }
|
|
|
| template <typename T>
|
| -static PassRefPtr<JSONArray> sizeAsJSONArray(const T& size)
|
| +static std::unique_ptr<JSONArray> sizeAsJSONArray(const T& size)
|
| {
|
| - RefPtr<JSONArray> array = JSONArray::create();
|
| - array->pushNumber(size.width());
|
| - array->pushNumber(size.height());
|
| + std::unique_ptr<JSONArray> array = JSONArray::create();
|
| + array->pushDouble(size.width());
|
| + array->pushDouble(size.height());
|
| return array;
|
| }
|
|
|
| template <typename T>
|
| -static PassRefPtr<JSONArray> rectAsJSONArray(const T& rect)
|
| +static std::unique_ptr<JSONArray> rectAsJSONArray(const T& rect)
|
| {
|
| - RefPtr<JSONArray> array = JSONArray::create();
|
| - array->pushNumber(rect.x());
|
| - array->pushNumber(rect.y());
|
| - array->pushNumber(rect.width());
|
| - array->pushNumber(rect.height());
|
| + std::unique_ptr<JSONArray> array = JSONArray::create();
|
| + array->pushDouble(rect.x());
|
| + array->pushDouble(rect.y());
|
| + array->pushDouble(rect.width());
|
| + array->pushDouble(rect.height());
|
| return array;
|
| }
|
|
|
| @@ -651,40 +651,40 @@ static double roundCloseToZero(double number)
|
| return std::abs(number) < 1e-7 ? 0 : number;
|
| }
|
|
|
| -static PassRefPtr<JSONArray> transformAsJSONArray(const TransformationMatrix& t)
|
| +static std::unique_ptr<JSONArray> transformAsJSONArray(const TransformationMatrix& t)
|
| {
|
| - RefPtr<JSONArray> array = JSONArray::create();
|
| + std::unique_ptr<JSONArray> array = JSONArray::create();
|
| {
|
| - RefPtr<JSONArray> row = JSONArray::create();
|
| - row->pushNumber(roundCloseToZero(t.m11()));
|
| - row->pushNumber(roundCloseToZero(t.m12()));
|
| - row->pushNumber(roundCloseToZero(t.m13()));
|
| - row->pushNumber(roundCloseToZero(t.m14()));
|
| - array->pushArray(row);
|
| + std::unique_ptr<JSONArray> row = JSONArray::create();
|
| + row->pushDouble(roundCloseToZero(t.m11()));
|
| + row->pushDouble(roundCloseToZero(t.m12()));
|
| + row->pushDouble(roundCloseToZero(t.m13()));
|
| + row->pushDouble(roundCloseToZero(t.m14()));
|
| + array->pushArray(std::move(row));
|
| }
|
| {
|
| - RefPtr<JSONArray> row = JSONArray::create();
|
| - row->pushNumber(roundCloseToZero(t.m21()));
|
| - row->pushNumber(roundCloseToZero(t.m22()));
|
| - row->pushNumber(roundCloseToZero(t.m23()));
|
| - row->pushNumber(roundCloseToZero(t.m24()));
|
| - array->pushArray(row);
|
| + std::unique_ptr<JSONArray> row = JSONArray::create();
|
| + row->pushDouble(roundCloseToZero(t.m21()));
|
| + row->pushDouble(roundCloseToZero(t.m22()));
|
| + row->pushDouble(roundCloseToZero(t.m23()));
|
| + row->pushDouble(roundCloseToZero(t.m24()));
|
| + array->pushArray(std::move(row));
|
| }
|
| {
|
| - RefPtr<JSONArray> row = JSONArray::create();
|
| - row->pushNumber(roundCloseToZero(t.m31()));
|
| - row->pushNumber(roundCloseToZero(t.m32()));
|
| - row->pushNumber(roundCloseToZero(t.m33()));
|
| - row->pushNumber(roundCloseToZero(t.m34()));
|
| - array->pushArray(row);
|
| + std::unique_ptr<JSONArray> row = JSONArray::create();
|
| + row->pushDouble(roundCloseToZero(t.m31()));
|
| + row->pushDouble(roundCloseToZero(t.m32()));
|
| + row->pushDouble(roundCloseToZero(t.m33()));
|
| + row->pushDouble(roundCloseToZero(t.m34()));
|
| + array->pushArray(std::move(row));
|
| }
|
| {
|
| - RefPtr<JSONArray> row = JSONArray::create();
|
| - row->pushNumber(roundCloseToZero(t.m41()));
|
| - row->pushNumber(roundCloseToZero(t.m42()));
|
| - row->pushNumber(roundCloseToZero(t.m43()));
|
| - row->pushNumber(roundCloseToZero(t.m44()));
|
| - array->pushArray(row);
|
| + std::unique_ptr<JSONArray> row = JSONArray::create();
|
| + row->pushDouble(roundCloseToZero(t.m41()));
|
| + row->pushDouble(roundCloseToZero(t.m42()));
|
| + row->pushDouble(roundCloseToZero(t.m43()));
|
| + row->pushDouble(roundCloseToZero(t.m44()));
|
| + array->pushArray(std::move(row));
|
| }
|
| return array;
|
| }
|
| @@ -696,15 +696,15 @@ static String pointerAsString(const void* ptr)
|
| return ts.release();
|
| }
|
|
|
| -PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags) const
|
| +std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags) const
|
| {
|
| RenderingContextMap renderingContextMap;
|
| return layerTreeAsJSONInternal(flags, renderingContextMap);
|
| }
|
|
|
| -PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const
|
| +std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const
|
| {
|
| - RefPtr<JSONObject> json = JSONObject::create();
|
| + std::unique_ptr<JSONObject> json = JSONObject::create();
|
|
|
| if (flags & LayerTreeIncludesDebugInfo)
|
| json->setString("this", pointerAsString(this));
|
| @@ -721,7 +721,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags fla
|
| json->setArray("bounds", sizeAsJSONArray(m_size));
|
|
|
| if (m_opacity != 1)
|
| - json->setNumber("opacity", m_opacity);
|
| + json->setDouble("opacity", m_opacity);
|
|
|
| if (m_blendMode != WebBlendModeNormal)
|
| json->setString("blendMode", compositeOperatorName(CompositeSourceOver, m_blendMode));
|
| @@ -743,7 +743,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags fla
|
| else
|
| contextId = it->value;
|
|
|
| - json->setNumber("3dRenderingContext", contextId);
|
| + json->setInteger("3dRenderingContext", contextId);
|
| }
|
|
|
| if (m_drawsContent)
|
| @@ -776,37 +776,37 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags fla
|
| Vector<PaintInvalidationInfo>& infos = it->value.trackedPaintInvalidations;
|
| if (!infos.isEmpty()) {
|
| std::sort(infos.begin(), infos.end(), &comparePaintInvalidationInfo);
|
| - RefPtr<JSONArray> paintInvalidationsJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> paintInvalidationsJSON = JSONArray::create();
|
| for (auto& info : infos) {
|
| - RefPtr<JSONObject> infoJSON = JSONObject::create();
|
| + std::unique_ptr<JSONObject> infoJSON = JSONObject::create();
|
| infoJSON->setString("object", info.clientDebugName);
|
| if (!info.rect.isEmpty())
|
| infoJSON->setArray("rect", rectAsJSONArray(info.rect));
|
| infoJSON->setString("reason", paintInvalidationReasonToString(info.reason));
|
| - paintInvalidationsJSON->pushObject(infoJSON);
|
| + paintInvalidationsJSON->pushObject(std::move(infoJSON));
|
| }
|
| - json->setArray("paintInvalidations", paintInvalidationsJSON);
|
| + json->setArray("paintInvalidations", std::move(paintInvalidationsJSON));
|
| }
|
| #if DCHECK_IS_ON()
|
| Vector<UnderPaintInvalidation>& underPaintInvalidations = it->value.underPaintInvalidations;
|
| if (!underPaintInvalidations.isEmpty()) {
|
| - RefPtr<JSONArray> underPaintInvalidationsJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> underPaintInvalidationsJSON = JSONArray::create();
|
| for (auto& underPaintInvalidation : underPaintInvalidations) {
|
| - RefPtr<JSONObject> underPaintInvalidationJSON = JSONObject::create();
|
| - underPaintInvalidationJSON->setNumber("x", underPaintInvalidation.x);
|
| - underPaintInvalidationJSON->setNumber("y", underPaintInvalidation.x);
|
| + std::unique_ptr<JSONObject> underPaintInvalidationJSON = JSONObject::create();
|
| + underPaintInvalidationJSON->setDouble("x", underPaintInvalidation.x);
|
| + underPaintInvalidationJSON->setDouble("y", underPaintInvalidation.x);
|
| underPaintInvalidationJSON->setString("oldPixel", Color(underPaintInvalidation.oldPixel).nameForLayoutTreeAsText());
|
| underPaintInvalidationJSON->setString("newPixel", Color(underPaintInvalidation.newPixel).nameForLayoutTreeAsText());
|
| - underPaintInvalidationsJSON->pushObject(underPaintInvalidationJSON);
|
| + underPaintInvalidationsJSON->pushObject(std::move(underPaintInvalidationJSON));
|
| }
|
| - json->setArray("underPaintInvalidations", underPaintInvalidationsJSON);
|
| + json->setArray("underPaintInvalidations", std::move(underPaintInvalidationsJSON));
|
| }
|
| #endif
|
| }
|
| }
|
|
|
| if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) {
|
| - RefPtr<JSONArray> paintingPhasesJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> paintingPhasesJSON = JSONArray::create();
|
| if (m_paintingPhase & GraphicsLayerPaintBackground)
|
| paintingPhasesJSON->pushString("GraphicsLayerPaintBackground");
|
| if (m_paintingPhase & GraphicsLayerPaintForeground)
|
| @@ -819,7 +819,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags fla
|
| paintingPhasesJSON->pushString("GraphicsLayerPaintOverflowContents");
|
| if (m_paintingPhase & GraphicsLayerPaintCompositedScroll)
|
| paintingPhasesJSON->pushString("GraphicsLayerPaintCompositedScroll");
|
| - json->setArray("paintingPhases", paintingPhasesJSON);
|
| + json->setArray("paintingPhases", std::move(paintingPhasesJSON));
|
| }
|
|
|
| if (flags & LayerTreeIncludesClipAndScrollParents) {
|
| @@ -831,26 +831,26 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags fla
|
|
|
| if (flags & (LayerTreeIncludesDebugInfo | LayerTreeIncludesCompositingReasons)) {
|
| bool debug = flags & LayerTreeIncludesDebugInfo;
|
| - RefPtr<JSONArray> compositingReasonsJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> compositingReasonsJSON = JSONArray::create();
|
| for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) {
|
| if (m_debugInfo.getCompositingReasons() & kCompositingReasonStringMap[i].reason)
|
| compositingReasonsJSON->pushString(debug ? kCompositingReasonStringMap[i].description : kCompositingReasonStringMap[i].shortName);
|
| }
|
| - json->setArray("compositingReasons", compositingReasonsJSON);
|
| + json->setArray("compositingReasons", std::move(compositingReasonsJSON));
|
|
|
| - RefPtr<JSONArray> squashingDisallowedReasonsJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> squashingDisallowedReasonsJSON = JSONArray::create();
|
| for (size_t i = 0; i < kNumberOfSquashingDisallowedReasons; ++i) {
|
| if (m_debugInfo.getSquashingDisallowedReasons() & kSquashingDisallowedReasonStringMap[i].reason)
|
| squashingDisallowedReasonsJSON->pushString(debug ? kSquashingDisallowedReasonStringMap[i].description : kSquashingDisallowedReasonStringMap[i].shortName);
|
| }
|
| - json->setArray("squashingDisallowedReasons", squashingDisallowedReasonsJSON);
|
| + json->setArray("squashingDisallowedReasons", std::move(squashingDisallowedReasonsJSON));
|
| }
|
|
|
| if (m_children.size()) {
|
| - RefPtr<JSONArray> childrenJSON = JSONArray::create();
|
| + std::unique_ptr<JSONArray> childrenJSON = JSONArray::create();
|
| for (size_t i = 0; i < m_children.size(); i++)
|
| childrenJSON->pushObject(m_children[i]->layerTreeAsJSONInternal(flags, renderingContextMap));
|
| - json->setArray("children", childrenJSON);
|
| + json->setArray("children", std::move(childrenJSON));
|
| }
|
|
|
| return json;
|
|
|