OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 void RenderWidgetCompositor::SendCompositorProto( | 1099 void RenderWidgetCompositor::SendCompositorProto( |
1100 const cc::proto::CompositorMessage& proto) { | 1100 const cc::proto::CompositorMessage& proto) { |
1101 int signed_size = proto.ByteSize(); | 1101 int signed_size = proto.ByteSize(); |
1102 size_t unsigned_size = base::checked_cast<size_t>(signed_size); | 1102 size_t unsigned_size = base::checked_cast<size_t>(signed_size); |
1103 std::vector<uint8_t> serialized(unsigned_size); | 1103 std::vector<uint8_t> serialized(unsigned_size); |
1104 proto.SerializeToArray(serialized.data(), signed_size); | 1104 proto.SerializeToArray(serialized.data(), signed_size); |
1105 delegate_->ForwardCompositorProto(serialized); | 1105 delegate_->ForwardCompositorProto(serialized); |
1106 } | 1106 } |
1107 | 1107 |
1108 void RenderWidgetCompositor::SetSurfaceClientId(uint32_t surface_client_id) { | 1108 void RenderWidgetCompositor::SetFrameSinkId( |
1109 layer_tree_host_->SetSurfaceClientId(surface_client_id); | 1109 const cc::FrameSinkId& frame_sink_id) { |
| 1110 layer_tree_host_->SetFrameSinkId(frame_sink_id); |
1110 } | 1111 } |
1111 | 1112 |
1112 void RenderWidgetCompositor::OnHandleCompositorProto( | 1113 void RenderWidgetCompositor::OnHandleCompositorProto( |
1113 const std::vector<uint8_t>& proto) { | 1114 const std::vector<uint8_t>& proto) { |
1114 DCHECK(remote_proto_channel_receiver_); | 1115 DCHECK(remote_proto_channel_receiver_); |
1115 | 1116 |
1116 std::unique_ptr<cc::proto::CompositorMessage> deserialized( | 1117 std::unique_ptr<cc::proto::CompositorMessage> deserialized( |
1117 new cc::proto::CompositorMessage); | 1118 new cc::proto::CompositorMessage); |
1118 int signed_size = base::checked_cast<int>(proto.size()); | 1119 int signed_size = base::checked_cast<int>(proto.size()); |
1119 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { | 1120 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { |
1120 LOG(ERROR) << "Unable to parse compositor proto."; | 1121 LOG(ERROR) << "Unable to parse compositor proto."; |
1121 return; | 1122 return; |
1122 } | 1123 } |
1123 | 1124 |
1124 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1125 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
1125 } | 1126 } |
1126 | 1127 |
1127 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1128 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1128 float device_scale) { | 1129 float device_scale) { |
1129 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1130 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1130 } | 1131 } |
1131 | 1132 |
1132 void RenderWidgetCompositor::SetDeviceColorSpace( | 1133 void RenderWidgetCompositor::SetDeviceColorSpace( |
1133 const gfx::ColorSpace& color_space) { | 1134 const gfx::ColorSpace& color_space) { |
1134 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1135 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1135 } | 1136 } |
1136 | 1137 |
1137 } // namespace content | 1138 } // namespace content |
OLD | NEW |