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..a99d8fc1a8901b29b0b276606b5ef848721f596f 100644 |
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
@@ -618,27 +618,27 @@ 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(); |
+ std::unique_ptr<JSONArray> array = JSONArray::create(); |
array->pushNumber(point.x()); |
array->pushNumber(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(); |
+ std::unique_ptr<JSONArray> array = JSONArray::create(); |
array->pushNumber(size.width()); |
array->pushNumber(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(); |
+ std::unique_ptr<JSONArray> array = JSONArray::create(); |
array->pushNumber(rect.x()); |
array->pushNumber(rect.y()); |
array->pushNumber(rect.width()); |
@@ -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(); |
+ std::unique_ptr<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); |
+ array->pushArray(std::move(row)); |
} |
{ |
- RefPtr<JSONArray> row = JSONArray::create(); |
+ std::unique_ptr<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); |
+ array->pushArray(std::move(row)); |
} |
{ |
- RefPtr<JSONArray> row = JSONArray::create(); |
+ std::unique_ptr<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); |
+ array->pushArray(std::move(row)); |
} |
{ |
- RefPtr<JSONArray> row = JSONArray::create(); |
+ std::unique_ptr<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); |
+ 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)); |
@@ -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(); |
+ std::unique_ptr<JSONObject> underPaintInvalidationJSON = JSONObject::create(); |
underPaintInvalidationJSON->setNumber("x", underPaintInvalidation.x); |
underPaintInvalidationJSON->setNumber("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; |