OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/thread.h" | 10 #include "cc/base/thread.h" |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 DCHECK(success); | 1150 DCHECK(success); |
1151 DCHECK(capabilities); | 1151 DCHECK(capabilities); |
1152 | 1152 |
1153 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 1153 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
1154 layer_tree_host_impl_->resource_provider()); | 1154 layer_tree_host_impl_->resource_provider()); |
1155 | 1155 |
1156 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 1156 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
1157 | 1157 |
1158 if (*success) { | 1158 if (*success) { |
1159 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | 1159 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); |
1160 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( | |
1161 capabilities->using_swap_complete_callback); | |
1162 | 1160 |
1163 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); | 1161 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
1164 DCHECK(output_surface_ptr); | 1162 DCHECK(output_surface_ptr); |
1165 int max_frames_pending = | 1163 int max_frames_pending = |
1166 output_surface_ptr->capabilities().max_frames_pending; | 1164 output_surface_ptr->capabilities().max_frames_pending; |
1167 if (max_frames_pending <= 0) | 1165 if (max_frames_pending <= 0) |
1168 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1166 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
1169 if (output_surface_ptr->capabilities().has_parent_compositor) | |
1170 max_frames_pending = 1; | |
1171 | 1167 |
1172 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); | 1168 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
1173 | 1169 |
1174 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | 1170 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
1175 } | 1171 } |
1176 | 1172 |
1177 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider); | 1173 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider); |
1178 | 1174 |
1179 completion->Signal(); | 1175 completion->Signal(); |
1180 } | 1176 } |
1181 | 1177 |
1182 void ThreadProxy::DidTryInitializeRendererOnImplThread( | 1178 void ThreadProxy::DidTryInitializeRendererOnImplThread( |
1183 bool success, | 1179 bool success, |
1184 scoped_refptr<ContextProvider> offscreen_context_provider) { | 1180 scoped_refptr<ContextProvider> offscreen_context_provider) { |
1185 DCHECK(IsImplThread()); | 1181 DCHECK(IsImplThread()); |
1186 DCHECK(!inside_draw_); | 1182 DCHECK(!inside_draw_); |
1187 | 1183 |
1188 if (offscreen_context_provider.get()) | 1184 if (offscreen_context_provider.get()) |
1189 offscreen_context_provider->BindToCurrentThread(); | 1185 offscreen_context_provider->BindToCurrentThread(); |
1190 | 1186 |
1191 if (success) { | 1187 if (success) { |
1192 DCHECK_EQ(layer_tree_host_impl_->GetRendererCapabilities() | |
1193 .using_swap_complete_callback, | |
1194 scheduler_on_impl_thread_->swap_buffers_complete_supported()); | |
1195 if (layer_tree_host_impl_->resource_provider()) { | 1188 if (layer_tree_host_impl_->resource_provider()) { |
1196 layer_tree_host_impl_->resource_provider()-> | 1189 layer_tree_host_impl_->resource_provider()-> |
1197 set_offscreen_context_provider(offscreen_context_provider); | 1190 set_offscreen_context_provider(offscreen_context_provider); |
1198 } | 1191 } |
1199 } else if (offscreen_context_provider.get()) { | 1192 } else if (offscreen_context_provider.get()) { |
1200 offscreen_context_provider->VerifyContexts(); | 1193 offscreen_context_provider->VerifyContexts(); |
1201 } | 1194 } |
1202 } | 1195 } |
1203 | 1196 |
1204 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1197 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 !layer_tree_host_impl_->pending_tree()) { | 1376 !layer_tree_host_impl_->pending_tree()) { |
1384 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1377 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
1385 TRACE_EVENT_SCOPE_THREAD); | 1378 TRACE_EVENT_SCOPE_THREAD); |
1386 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1379 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1387 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1380 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1388 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1381 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1389 } | 1382 } |
1390 } | 1383 } |
1391 | 1384 |
1392 } // namespace cc | 1385 } // namespace cc |
OLD | NEW |