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 <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 return compositor; | 208 return compositor; |
209 } | 209 } |
210 | 210 |
211 RenderWidgetCompositor::RenderWidgetCompositor( | 211 RenderWidgetCompositor::RenderWidgetCompositor( |
212 RenderWidget* widget, | 212 RenderWidget* widget, |
213 CompositorDependencies* compositor_deps) | 213 CompositorDependencies* compositor_deps) |
214 : num_failed_recreate_attempts_(0), | 214 : num_failed_recreate_attempts_(0), |
215 widget_(widget), | 215 widget_(widget), |
216 compositor_deps_(compositor_deps), | 216 compositor_deps_(compositor_deps), |
217 layout_and_paint_async_callback_(nullptr), | 217 layout_and_paint_async_callback_(nullptr), |
218 weak_factory_(this) { | 218 did_give_back_output_surface_(false), |
219 } | 219 weak_factory_(this) {} |
220 | 220 |
221 void RenderWidgetCompositor::Initialize() { | 221 void RenderWidgetCompositor::Initialize() { |
222 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 222 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
223 | 223 |
224 cc::LayerTreeSettings settings; | 224 cc::LayerTreeSettings settings; |
225 | 225 |
226 // For web contents, layer transforms should scale up the contents of layers | 226 // For web contents, layer transforms should scale up the contents of layers |
227 // to keep content always crisp when possible. | 227 // to keep content always crisp when possible. |
228 settings.layer_transforms_should_scale_layer_contents = true; | 228 settings.layer_transforms_should_scale_layer_contents = true; |
229 | 229 |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 // Tolerate a certain number of recreation failures to work around races | 949 // Tolerate a certain number of recreation failures to work around races |
950 // in the output-surface-lost machinery. | 950 // in the output-surface-lost machinery. |
951 LOG_IF(FATAL, (num_failed_recreate_attempts_ >= MAX_OUTPUT_SURFACE_RETRIES)) | 951 LOG_IF(FATAL, (num_failed_recreate_attempts_ >= MAX_OUTPUT_SURFACE_RETRIES)) |
952 << "Failed to create a fallback OutputSurface."; | 952 << "Failed to create a fallback OutputSurface."; |
953 | 953 |
954 base::ThreadTaskRunnerHandle::Get()->PostTask( | 954 base::ThreadTaskRunnerHandle::Get()->PostTask( |
955 FROM_HERE, base::Bind(&RenderWidgetCompositor::RequestNewOutputSurface, | 955 FROM_HERE, base::Bind(&RenderWidgetCompositor::RequestNewOutputSurface, |
956 weak_factory_.GetWeakPtr())); | 956 weak_factory_.GetWeakPtr())); |
957 } | 957 } |
958 | 958 |
959 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::GiveBackOutputSurface() { | |
960 did_give_back_output_surface_ = true; | |
sohanjg
2015/08/12 10:50:29
i have added this member to reflect the compositor
| |
961 num_failed_recreate_attempts_ = 0; | |
962 layer_tree_host_->SetVisible(false); | |
963 return layer_tree_host_->GetOutputSurface().Pass(); | |
964 } | |
965 | |
959 void RenderWidgetCompositor::WillCommit() { | 966 void RenderWidgetCompositor::WillCommit() { |
960 InvokeLayoutAndPaintCallback(); | 967 InvokeLayoutAndPaintCallback(); |
961 } | 968 } |
962 | 969 |
963 void RenderWidgetCompositor::DidCommit() { | 970 void RenderWidgetCompositor::DidCommit() { |
964 DCHECK(!temporary_copy_output_request_); | 971 DCHECK(!temporary_copy_output_request_); |
965 widget_->DidCommitCompositorFrame(); | 972 widget_->DidCommitCompositorFrame(); |
966 compositor_deps_->GetRendererScheduler()->DidCommitFrameToCompositor(); | 973 compositor_deps_->GetRendererScheduler()->DidCommitFrameToCompositor(); |
967 } | 974 } |
968 | 975 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1034 return; | 1041 return; |
1035 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 1042 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
1036 } | 1043 } |
1037 | 1044 |
1038 void RenderWidgetCompositor::SetSurfaceIdNamespace( | 1045 void RenderWidgetCompositor::SetSurfaceIdNamespace( |
1039 uint32_t surface_id_namespace) { | 1046 uint32_t surface_id_namespace) { |
1040 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); | 1047 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); |
1041 } | 1048 } |
1042 | 1049 |
1043 } // namespace content | 1050 } // namespace content |
OLD | NEW |