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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 | 1082 |
1083 void RenderWidgetCompositor::SendCompositorProto( | 1083 void RenderWidgetCompositor::SendCompositorProto( |
1084 const cc::proto::CompositorMessage& proto) { | 1084 const cc::proto::CompositorMessage& proto) { |
1085 int signed_size = proto.ByteSize(); | 1085 int signed_size = proto.ByteSize(); |
1086 size_t unsigned_size = base::checked_cast<size_t>(signed_size); | 1086 size_t unsigned_size = base::checked_cast<size_t>(signed_size); |
1087 std::vector<uint8_t> serialized(unsigned_size); | 1087 std::vector<uint8_t> serialized(unsigned_size); |
1088 proto.SerializeToArray(serialized.data(), signed_size); | 1088 proto.SerializeToArray(serialized.data(), signed_size); |
1089 delegate_->ForwardCompositorProto(serialized); | 1089 delegate_->ForwardCompositorProto(serialized); |
1090 } | 1090 } |
1091 | 1091 |
1092 void RenderWidgetCompositor::SetSurfaceClientId(uint32_t surface_client_id) { | 1092 void RenderWidgetCompositor::SetFrameSinkId( |
1093 layer_tree_host_->SetSurfaceClientId(surface_client_id); | 1093 const cc::FrameSinkId& frame_sink_id) { |
| 1094 layer_tree_host_->SetFrameSinkId(frame_sink_id); |
1094 } | 1095 } |
1095 | 1096 |
1096 void RenderWidgetCompositor::OnHandleCompositorProto( | 1097 void RenderWidgetCompositor::OnHandleCompositorProto( |
1097 const std::vector<uint8_t>& proto) { | 1098 const std::vector<uint8_t>& proto) { |
1098 DCHECK(remote_proto_channel_receiver_); | 1099 DCHECK(remote_proto_channel_receiver_); |
1099 | 1100 |
1100 std::unique_ptr<cc::proto::CompositorMessage> deserialized( | 1101 std::unique_ptr<cc::proto::CompositorMessage> deserialized( |
1101 new cc::proto::CompositorMessage); | 1102 new cc::proto::CompositorMessage); |
1102 int signed_size = base::checked_cast<int>(proto.size()); | 1103 int signed_size = base::checked_cast<int>(proto.size()); |
1103 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { | 1104 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { |
1104 LOG(ERROR) << "Unable to parse compositor proto."; | 1105 LOG(ERROR) << "Unable to parse compositor proto."; |
1105 return; | 1106 return; |
1106 } | 1107 } |
1107 | 1108 |
1108 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1109 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
1109 } | 1110 } |
1110 | 1111 |
1111 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1112 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1112 float device_scale) { | 1113 float device_scale) { |
1113 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1114 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1114 } | 1115 } |
1115 | 1116 |
1116 void RenderWidgetCompositor::SetDeviceColorSpace( | 1117 void RenderWidgetCompositor::SetDeviceColorSpace( |
1117 const gfx::ColorSpace& color_space) { | 1118 const gfx::ColorSpace& color_space) { |
1118 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1119 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1119 } | 1120 } |
1120 | 1121 |
1121 } // namespace content | 1122 } // namespace content |
OLD | NEW |