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 uint32_t RenderWidgetCompositor::GetSurfaceClientId() const { |
| 1129 return layer_tree_host_->surface_client_id(); |
| 1130 } |
| 1131 |
1128 void RenderWidgetCompositor::SetSurfaceClientId(uint32_t surface_client_id) { | 1132 void RenderWidgetCompositor::SetSurfaceClientId(uint32_t surface_client_id) { |
1129 layer_tree_host_->set_surface_client_id(surface_client_id); | 1133 layer_tree_host_->set_surface_client_id(surface_client_id); |
1130 } | 1134 } |
1131 | 1135 |
1132 void RenderWidgetCompositor::OnHandleCompositorProto( | 1136 void RenderWidgetCompositor::OnHandleCompositorProto( |
1133 const std::vector<uint8_t>& proto) { | 1137 const std::vector<uint8_t>& proto) { |
1134 DCHECK(remote_proto_channel_receiver_); | 1138 DCHECK(remote_proto_channel_receiver_); |
1135 | 1139 |
1136 std::unique_ptr<cc::proto::CompositorMessage> deserialized( | 1140 std::unique_ptr<cc::proto::CompositorMessage> deserialized( |
1137 new cc::proto::CompositorMessage); | 1141 new cc::proto::CompositorMessage); |
1138 int signed_size = base::checked_cast<int>(proto.size()); | 1142 int signed_size = base::checked_cast<int>(proto.size()); |
1139 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { | 1143 if (!deserialized->ParseFromArray(proto.data(), signed_size)) { |
1140 LOG(ERROR) << "Unable to parse compositor proto."; | 1144 LOG(ERROR) << "Unable to parse compositor proto."; |
1141 return; | 1145 return; |
1142 } | 1146 } |
1143 | 1147 |
1144 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1148 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
1145 } | 1149 } |
1146 | 1150 |
1147 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1151 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
1148 float device_scale) { | 1152 float device_scale) { |
1149 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1153 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
1150 } | 1154 } |
1151 | 1155 |
1152 } // namespace content | 1156 } // namespace content |
OLD | NEW |