| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/compositing/ContentLayerClientImpl.h" | 5 #include "platform/graphics/compositing/ContentLayerClientImpl.h" |
| 6 | 6 |
| 7 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" | 7 #include "platform/graphics/compositing/PaintChunksToCcLayer.h" |
| 8 #include "platform/graphics/paint/GeometryMapper.h" | 8 #include "platform/graphics/paint/GeometryMapper.h" |
| 9 #include "platform/graphics/paint/PaintArtifact.h" | 9 #include "platform/graphics/paint/PaintArtifact.h" |
| 10 #include "platform/graphics/paint/PaintChunk.h" | 10 #include "platform/graphics/paint/PaintChunk.h" |
| 11 #include "platform/graphics/paint/RasterInvalidationTracking.h" | 11 #include "platform/graphics/paint/RasterInvalidationTracking.h" |
| 12 #include "platform/json/JSONValues.h" | 12 #include "platform/json/JSONValues.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 template <typename T> | 16 template <typename T> |
| 17 static std::unique_ptr<JSONArray> PointAsJSONArray(const T& point) { | 17 static std::unique_ptr<JSONArray> PointAsJSONArray2(const T& point) { |
| 18 std::unique_ptr<JSONArray> array = JSONArray::Create(); | 18 std::unique_ptr<JSONArray> array = JSONArray::Create(); |
| 19 array->PushDouble(point.X()); | 19 array->PushDouble(point.X()); |
| 20 array->PushDouble(point.Y()); | 20 array->PushDouble(point.Y()); |
| 21 return array; | 21 return array; |
| 22 } | 22 } |
| 23 | 23 |
| 24 template <typename T> | 24 template <typename T> |
| 25 static std::unique_ptr<JSONArray> SizeAsJSONArray(const T& size) { | 25 static std::unique_ptr<JSONArray> SizeAsJSONArray2(const T& size) { |
| 26 std::unique_ptr<JSONArray> array = JSONArray::Create(); | 26 std::unique_ptr<JSONArray> array = JSONArray::Create(); |
| 27 array->PushDouble(size.Width()); | 27 array->PushDouble(size.Width()); |
| 28 array->PushDouble(size.Height()); | 28 array->PushDouble(size.Height()); |
| 29 return array; | 29 return array; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ContentLayerClientImpl::SetTracksRasterInvalidations(bool should_track) { | 32 void ContentLayerClientImpl::SetTracksRasterInvalidations(bool should_track) { |
| 33 if (should_track) { | 33 if (should_track) { |
| 34 raster_invalidation_tracking_info_ = | 34 raster_invalidation_tracking_info_ = |
| 35 WTF::MakeUnique<RasterInvalidationTrackingInfo>(); | 35 WTF::MakeUnique<RasterInvalidationTrackingInfo>(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 std::unique_ptr<JSONObject> ContentLayerClientImpl::LayerAsJSON( | 53 std::unique_ptr<JSONObject> ContentLayerClientImpl::LayerAsJSON( |
| 54 LayerTreeFlags flags) { | 54 LayerTreeFlags flags) { |
| 55 std::unique_ptr<JSONObject> json = JSONObject::Create(); | 55 std::unique_ptr<JSONObject> json = JSONObject::Create(); |
| 56 json->SetString("name", debug_name_); | 56 json->SetString("name", debug_name_); |
| 57 | 57 |
| 58 FloatPoint position(cc_picture_layer_->offset_to_transform_parent().x(), | 58 FloatPoint position(cc_picture_layer_->offset_to_transform_parent().x(), |
| 59 cc_picture_layer_->offset_to_transform_parent().y()); | 59 cc_picture_layer_->offset_to_transform_parent().y()); |
| 60 if (position != FloatPoint()) | 60 if (position != FloatPoint()) |
| 61 json->SetArray("position", PointAsJSONArray(position)); | 61 json->SetArray("position", PointAsJSONArray2(position)); |
| 62 | 62 |
| 63 IntSize bounds(cc_picture_layer_->bounds().width(), | 63 IntSize bounds(cc_picture_layer_->bounds().width(), |
| 64 cc_picture_layer_->bounds().height()); | 64 cc_picture_layer_->bounds().height()); |
| 65 if (!bounds.IsEmpty()) | 65 if (!bounds.IsEmpty()) |
| 66 json->SetArray("bounds", SizeAsJSONArray(bounds)); | 66 json->SetArray("bounds", SizeAsJSONArray2(bounds)); |
| 67 | 67 |
| 68 json->SetBoolean("contentsOpaque", cc_picture_layer_->contents_opaque()); | 68 json->SetBoolean("contentsOpaque", cc_picture_layer_->contents_opaque()); |
| 69 json->SetBoolean("drawsContent", cc_picture_layer_->DrawsContent()); | 69 json->SetBoolean("drawsContent", cc_picture_layer_->DrawsContent()); |
| 70 | 70 |
| 71 if (flags & kLayerTreeIncludesDebugInfo) { | 71 if (flags & kLayerTreeIncludesDebugInfo) { |
| 72 std::unique_ptr<JSONArray> paint_chunk_contents_array = JSONArray::Create(); | 72 std::unique_ptr<JSONArray> paint_chunk_contents_array = JSONArray::Create(); |
| 73 for (const auto& debug_data : paint_chunk_debug_data_) { | 73 for (const auto& debug_data : paint_chunk_debug_data_) { |
| 74 paint_chunk_contents_array->PushValue(debug_data->Clone()); | 74 paint_chunk_contents_array->PushValue(debug_data->Clone()); |
| 75 } | 75 } |
| 76 json->SetArray("paintChunkContents", std::move(paint_chunk_contents_array)); | 76 json->SetArray("paintChunkContents", std::move(paint_chunk_contents_array)); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (raster_invalidation_tracking_info_) { | 316 if (raster_invalidation_tracking_info_) { |
| 317 raster_invalidation_tracking_info_->old_client_debug_names.clear(); | 317 raster_invalidation_tracking_info_->old_client_debug_names.clear(); |
| 318 std::swap(raster_invalidation_tracking_info_->old_client_debug_names, | 318 std::swap(raster_invalidation_tracking_info_->old_client_debug_names, |
| 319 raster_invalidation_tracking_info_->new_client_debug_names); | 319 raster_invalidation_tracking_info_->new_client_debug_names); |
| 320 } | 320 } |
| 321 | 321 |
| 322 return cc_picture_layer_; | 322 return cc_picture_layer_; |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace blink | 325 } // namespace blink |
| OLD | NEW |