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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1118 |
1119 void RenderWidgetCompositor::SendCompositorProto( | 1119 void RenderWidgetCompositor::SendCompositorProto( |
1120 const cc::proto::CompositorMessage& proto) { | 1120 const cc::proto::CompositorMessage& proto) { |
1121 int signed_size = proto.ByteSize(); | 1121 int signed_size = proto.ByteSize(); |
1122 size_t unsigned_size = base::checked_cast<size_t>(signed_size); | 1122 size_t unsigned_size = base::checked_cast<size_t>(signed_size); |
1123 std::vector<uint8_t> serialized(unsigned_size); | 1123 std::vector<uint8_t> serialized(unsigned_size); |
1124 proto.SerializeToArray(serialized.data(), signed_size); | 1124 proto.SerializeToArray(serialized.data(), signed_size); |
1125 delegate_->ForwardCompositorProto(serialized); | 1125 delegate_->ForwardCompositorProto(serialized); |
1126 } | 1126 } |
1127 | 1127 |
1128 void RenderWidgetCompositor::SetSurfaceIdNamespace( | 1128 void RenderWidgetCompositor::SetSurfaceClientId(uint32_t surface_client_id) { |
1129 uint32_t surface_id_namespace) { | 1129 layer_tree_host_->set_surface_client_id(surface_client_id); |
1130 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); | |
1131 } | 1130 } |
1132 | 1131 |
1133 void RenderWidgetCompositor::OnHandleCompositorProto( | 1132 void RenderWidgetCompositor::OnHandleCompositorProto( |
1134 const std::vector<uint8_t>& proto) { | 1133 const std::vector<uint8_t>& proto) { |
1135 DCHECK(remote_proto_channel_receiver_); | 1134 DCHECK(remote_proto_channel_receiver_); |
1136 | 1135 |
1137 std::unique_ptr<cc::proto::CompositorMessage> deserialized( | 1136 std::unique_ptr<cc::proto::CompositorMessage> deserialized( |
1138 new cc::proto::CompositorMessage); | 1137 new cc::proto::CompositorMessage); |
1139 int signed_size = base::checked_cast<int>(proto.size()); | 1138 int signed_size = base::checked_cast<int>(proto.size()); |
1140 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { | 1139 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { |
1141 LOG(ERROR) << "Unable to parse compositor proto."; | 1140 LOG(ERROR) << "Unable to parse compositor proto."; |
1142 return; | 1141 return; |
1143 } | 1142 } |
1144 | 1143 |
1145 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1144 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
1146 } | 1145 } |
1147 | 1146 |
1148 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1147 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1149 float device_scale) { | 1148 float device_scale) { |
1150 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1149 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1151 } | 1150 } |
1152 | 1151 |
1153 } // namespace content | 1152 } // namespace content |
OLD | NEW |