| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 DCHECK(IsImplThread()); | 1157 DCHECK(IsImplThread()); |
| 1158 DCHECK(IsMainThreadBlocked()); | 1158 DCHECK(IsMainThreadBlocked()); |
| 1159 DCHECK(success); | 1159 DCHECK(success); |
| 1160 DCHECK(capabilities); | 1160 DCHECK(capabilities); |
| 1161 | 1161 |
| 1162 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 1162 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 1163 layer_tree_host_impl_->resource_provider()); | 1163 layer_tree_host_impl_->resource_provider()); |
| 1164 | 1164 |
| 1165 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 1165 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
| 1166 | 1166 |
| 1167 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider); |
| 1168 |
| 1169 if (*success) |
| 1170 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); |
| 1171 |
| 1172 completion->Signal(); |
| 1173 } |
| 1174 |
| 1175 void ThreadProxy::DidTryInitializeRendererOnImplThread( |
| 1176 bool success, |
| 1177 scoped_refptr<ContextProvider> offscreen_context_provider) { |
| 1178 DCHECK(IsImplThread()); |
| 1179 |
| 1167 if (offscreen_context_provider.get()) | 1180 if (offscreen_context_provider.get()) |
| 1168 offscreen_context_provider->BindToCurrentThread(); | 1181 offscreen_context_provider->BindToCurrentThread(); |
| 1169 | 1182 |
| 1170 if (*success) { | 1183 if (success) { |
| 1171 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | |
| 1172 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( | 1184 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( |
| 1173 capabilities->using_swap_complete_callback); | 1185 layer_tree_host_impl_->GetRendererCapabilities() |
| 1186 .using_swap_complete_callback); |
| 1174 | 1187 |
| 1175 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); | 1188 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
| 1176 DCHECK(output_surface_ptr); | 1189 DCHECK(output_surface_ptr); |
| 1177 int max_frames_pending = | 1190 int max_frames_pending = |
| 1178 output_surface_ptr->capabilities().max_frames_pending; | 1191 output_surface_ptr->capabilities().max_frames_pending; |
| 1179 if (max_frames_pending <= 0) | 1192 if (max_frames_pending <= 0) |
| 1180 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1193 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1181 if (output_surface_ptr->capabilities().has_parent_compositor) | 1194 if (output_surface_ptr->capabilities().has_parent_compositor) |
| 1182 max_frames_pending = 1; | 1195 max_frames_pending = 1; |
| 1183 | 1196 |
| 1184 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); | 1197 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
| 1185 | 1198 |
| 1186 if (layer_tree_host_impl_->resource_provider()) | 1199 if (layer_tree_host_impl_->resource_provider()) |
| 1187 layer_tree_host_impl_->resource_provider()-> | 1200 layer_tree_host_impl_->resource_provider()-> |
| 1188 set_offscreen_context_provider(offscreen_context_provider); | 1201 set_offscreen_context_provider(offscreen_context_provider); |
| 1189 | 1202 |
| 1190 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | 1203 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
| 1191 } else if (offscreen_context_provider.get()) { | 1204 } else if (offscreen_context_provider.get()) { |
| 1192 offscreen_context_provider->VerifyContexts(); | 1205 offscreen_context_provider->VerifyContexts(); |
| 1193 } | 1206 } |
| 1194 | |
| 1195 completion->Signal(); | |
| 1196 } | 1207 } |
| 1197 | 1208 |
| 1198 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1209 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
| 1199 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1210 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
| 1200 DCHECK(IsImplThread()); | 1211 DCHECK(IsImplThread()); |
| 1201 if (layer_tree_host_impl_->resource_provider()) | 1212 if (layer_tree_host_impl_->resource_provider()) |
| 1202 layer_tree_host_impl_->resource_provider()->Finish(); | 1213 layer_tree_host_impl_->resource_provider()->Finish(); |
| 1203 completion->Signal(); | 1214 completion->Signal(); |
| 1204 } | 1215 } |
| 1205 | 1216 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 !layer_tree_host_impl_->pending_tree()) { | 1397 !layer_tree_host_impl_->pending_tree()) { |
| 1387 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1398 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
| 1388 TRACE_EVENT_SCOPE_THREAD); | 1399 TRACE_EVENT_SCOPE_THREAD); |
| 1389 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1400 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1390 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1401 completion_event_for_commit_held_on_tree_activation_->Signal(); |
| 1391 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1402 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1392 } | 1403 } |
| 1393 } | 1404 } |
| 1394 | 1405 |
| 1395 } // namespace cc | 1406 } // namespace cc |
| OLD | NEW |