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