Chromium Code Reviews| 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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1155 DCHECK(IsImplThread()); | 1155 DCHECK(IsImplThread()); |
| 1156 DCHECK(IsMainThreadBlocked()); | 1156 DCHECK(IsMainThreadBlocked()); |
| 1157 DCHECK(success); | 1157 DCHECK(success); |
| 1158 DCHECK(capabilities); | 1158 DCHECK(capabilities); |
| 1159 | 1159 |
| 1160 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 1160 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 1161 layer_tree_host_impl_->resource_provider()); | 1161 layer_tree_host_impl_->resource_provider()); |
| 1162 | 1162 |
| 1163 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 1163 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
| 1164 | 1164 |
| 1165 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider); | |
| 1166 | |
| 1167 if (*success) { | |
| 1168 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | |
| 1169 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | |
|
aelias_OOO_until_Jul13
2013/05/30 06:42:44
This scheduler change looks to be the other loose
boliu
2013/05/30 16:24:34
I didn't think this as a problem. As far as the sc
| |
| 1170 } | |
| 1171 | |
| 1172 completion->Signal(); | |
| 1173 } | |
| 1174 | |
| 1175 void ThreadProxy::DidTryInitializeRendererOnImplThread( | |
| 1176 bool success, | |
| 1177 scoped_refptr<ContextProvider> offscreen_context_provider) { | |
| 1178 DCHECK(IsImplThread()); | |
| 1179 | |
| 1165 if (offscreen_context_provider) | 1180 if (offscreen_context_provider) |
| 1166 offscreen_context_provider->BindToCurrentThread(); | 1181 offscreen_context_provider->BindToCurrentThread(); |
| 1167 | 1182 |
| 1168 if (*success) { | 1183 if (success) { |
| 1169 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | 1184 RendererCapabilities capabilities = |
| 1185 layer_tree_host_impl_->GetRendererCapabilities(); | |
| 1170 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( | 1186 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( |
| 1171 capabilities->using_swap_complete_callback); | 1187 capabilities.using_swap_complete_callback); |
| 1172 | 1188 |
| 1173 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); | 1189 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
| 1174 DCHECK(output_surface_ptr); | 1190 DCHECK(output_surface_ptr); |
| 1175 int max_frames_pending = | 1191 int max_frames_pending = |
| 1176 output_surface_ptr->capabilities().max_frames_pending; | 1192 output_surface_ptr->capabilities().max_frames_pending; |
| 1177 if (max_frames_pending <= 0) | 1193 if (max_frames_pending <= 0) |
| 1178 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1194 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
| 1179 if (output_surface_ptr->capabilities().has_parent_compositor) | 1195 if (output_surface_ptr->capabilities().has_parent_compositor) |
| 1180 max_frames_pending = 1; | 1196 max_frames_pending = 1; |
| 1181 | 1197 |
| 1182 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); | 1198 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
| 1183 | 1199 |
| 1184 if (layer_tree_host_impl_->resource_provider()) | 1200 if (layer_tree_host_impl_->resource_provider()) { |
| 1185 layer_tree_host_impl_->resource_provider()-> | 1201 layer_tree_host_impl_->resource_provider()-> |
| 1186 set_offscreen_context_provider(offscreen_context_provider); | 1202 set_offscreen_context_provider(offscreen_context_provider); |
| 1187 | 1203 } |
| 1188 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | |
| 1189 } else if (offscreen_context_provider) { | 1204 } else if (offscreen_context_provider) { |
| 1190 offscreen_context_provider->VerifyContexts(); | 1205 offscreen_context_provider->VerifyContexts(); |
| 1191 } | 1206 } |
| 1192 | |
| 1193 completion->Signal(); | |
| 1194 } | 1207 } |
| 1195 | 1208 |
| 1196 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1209 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
| 1197 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1210 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
| 1198 DCHECK(IsImplThread()); | 1211 DCHECK(IsImplThread()); |
| 1199 if (layer_tree_host_impl_->resource_provider()) | 1212 if (layer_tree_host_impl_->resource_provider()) |
| 1200 layer_tree_host_impl_->resource_provider()->Finish(); | 1213 layer_tree_host_impl_->resource_provider()->Finish(); |
| 1201 completion->Signal(); | 1214 completion->Signal(); |
| 1202 } | 1215 } |
| 1203 | 1216 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1384 !layer_tree_host_impl_->pending_tree()) { | 1397 !layer_tree_host_impl_->pending_tree()) { |
| 1385 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1398 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
| 1386 TRACE_EVENT_SCOPE_THREAD); | 1399 TRACE_EVENT_SCOPE_THREAD); |
| 1387 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1400 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1388 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1401 completion_event_for_commit_held_on_tree_activation_->Signal(); |
| 1389 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1402 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1390 } | 1403 } |
| 1391 } | 1404 } |
| 1392 | 1405 |
| 1393 } // namespace cc | 1406 } // namespace cc |
| OLD | NEW |