| 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 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
| 1172 } |
| 1173 |
| 1174 completion->Signal(); |
| 1175 } |
| 1176 |
| 1177 void ThreadProxy::DidTryInitializeRendererOnImplThread( |
| 1178 bool success, |
| 1179 scoped_refptr<ContextProvider> offscreen_context_provider) { |
| 1180 DCHECK(IsImplThread()); |
| 1181 DCHECK(!inside_draw_); |
| 1182 |
| 1167 if (offscreen_context_provider.get()) | 1183 if (offscreen_context_provider.get()) |
| 1168 offscreen_context_provider->BindToCurrentThread(); | 1184 offscreen_context_provider->BindToCurrentThread(); |
| 1169 | 1185 |
| 1170 if (*success) { | 1186 if (success) { |
| 1171 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | |
| 1172 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( | 1187 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( |
| 1173 capabilities->using_swap_complete_callback); | 1188 layer_tree_host_impl_->GetRendererCapabilities() |
| 1189 .using_swap_complete_callback); |
| 1174 | 1190 |
| 1175 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); | 1191 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
| 1176 DCHECK(output_surface_ptr); | 1192 DCHECK(output_surface_ptr); |
| 1177 int max_frames_pending = | 1193 int max_frames_pending = |
| 1178 output_surface_ptr->capabilities().max_frames_pending; | 1194 output_surface_ptr->capabilities().max_frames_pending; |
| 1179 if (max_frames_pending <= 0) | 1195 if (max_frames_pending <= 0) |
| 1180 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1196 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1181 if (output_surface_ptr->capabilities().has_parent_compositor) | 1197 if (output_surface_ptr->capabilities().has_parent_compositor) |
| 1182 max_frames_pending = 1; | 1198 max_frames_pending = 1; |
| 1183 | 1199 |
| 1184 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); | 1200 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
| 1185 | 1201 |
| 1186 if (layer_tree_host_impl_->resource_provider()) | 1202 if (layer_tree_host_impl_->resource_provider()) { |
| 1187 layer_tree_host_impl_->resource_provider()-> | 1203 layer_tree_host_impl_->resource_provider()-> |
| 1188 set_offscreen_context_provider(offscreen_context_provider); | 1204 set_offscreen_context_provider(offscreen_context_provider); |
| 1189 | 1205 } |
| 1190 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | |
| 1191 } else if (offscreen_context_provider.get()) { | 1206 } else if (offscreen_context_provider.get()) { |
| 1192 offscreen_context_provider->VerifyContexts(); | 1207 offscreen_context_provider->VerifyContexts(); |
| 1193 } | 1208 } |
| 1194 | |
| 1195 completion->Signal(); | |
| 1196 } | 1209 } |
| 1197 | 1210 |
| 1198 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1211 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
| 1199 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1212 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
| 1200 DCHECK(IsImplThread()); | 1213 DCHECK(IsImplThread()); |
| 1201 if (layer_tree_host_impl_->resource_provider()) | 1214 if (layer_tree_host_impl_->resource_provider()) |
| 1202 layer_tree_host_impl_->resource_provider()->Finish(); | 1215 layer_tree_host_impl_->resource_provider()->Finish(); |
| 1203 completion->Signal(); | 1216 completion->Signal(); |
| 1204 } | 1217 } |
| 1205 | 1218 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 !layer_tree_host_impl_->pending_tree()) { | 1390 !layer_tree_host_impl_->pending_tree()) { |
| 1378 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1391 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
| 1379 TRACE_EVENT_SCOPE_THREAD); | 1392 TRACE_EVENT_SCOPE_THREAD); |
| 1380 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1393 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1381 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1394 completion_event_for_commit_held_on_tree_activation_->Signal(); |
| 1382 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1395 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1383 } | 1396 } |
| 1384 } | 1397 } |
| 1385 | 1398 |
| 1386 } // namespace cc | 1399 } // namespace cc |
| OLD | NEW |