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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 bool fallback = num_failed_recreate_attempts_ >= | 1026 bool fallback = num_failed_recreate_attempts_ >= |
1027 COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK; | 1027 COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK; |
1028 std::unique_ptr<cc::CompositorFrameSink> surface( | 1028 std::unique_ptr<cc::CompositorFrameSink> surface( |
1029 delegate_->CreateCompositorFrameSink(fallback)); | 1029 delegate_->CreateCompositorFrameSink(fallback)); |
1030 | 1030 |
1031 if (!surface) { | 1031 if (!surface) { |
1032 DidFailToInitializeCompositorFrameSink(); | 1032 DidFailToInitializeCompositorFrameSink(); |
1033 return; | 1033 return; |
1034 } | 1034 } |
1035 | 1035 |
1036 DCHECK_EQ(surface->capabilities().max_frames_pending, 1); | |
1037 | |
1038 layer_tree_host_->SetCompositorFrameSink(std::move(surface)); | 1036 layer_tree_host_->SetCompositorFrameSink(std::move(surface)); |
1039 } | 1037 } |
1040 | 1038 |
1041 void RenderWidgetCompositor::DidInitializeCompositorFrameSink() { | 1039 void RenderWidgetCompositor::DidInitializeCompositorFrameSink() { |
1042 num_failed_recreate_attempts_ = 0; | 1040 num_failed_recreate_attempts_ = 0; |
1043 } | 1041 } |
1044 | 1042 |
1045 void RenderWidgetCompositor::DidFailToInitializeCompositorFrameSink() { | 1043 void RenderWidgetCompositor::DidFailToInitializeCompositorFrameSink() { |
1046 ++num_failed_recreate_attempts_; | 1044 ++num_failed_recreate_attempts_; |
1047 // Tolerate a certain number of recreation failures to work around races | 1045 // Tolerate a certain number of recreation failures to work around races |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 float device_scale) { | 1125 float device_scale) { |
1128 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1126 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1129 } | 1127 } |
1130 | 1128 |
1131 void RenderWidgetCompositor::SetDeviceColorSpace( | 1129 void RenderWidgetCompositor::SetDeviceColorSpace( |
1132 const gfx::ColorSpace& color_space) { | 1130 const gfx::ColorSpace& color_space) { |
1133 // TODO(ccameron): Plumb this to the cc compositor. | 1131 // TODO(ccameron): Plumb this to the cc compositor. |
1134 } | 1132 } |
1135 | 1133 |
1136 } // namespace content | 1134 } // namespace content |
OLD | NEW |