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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 : Proxy(impl_thread.Pass()), | 43 : Proxy(impl_thread.Pass()), |
44 animate_requested_(false), | 44 animate_requested_(false), |
45 commit_requested_(false), | 45 commit_requested_(false), |
46 commit_request_sent_to_impl_thread_(false), | 46 commit_request_sent_to_impl_thread_(false), |
47 created_offscreen_context_provider_(false), | 47 created_offscreen_context_provider_(false), |
48 layer_tree_host_(layer_tree_host), | 48 layer_tree_host_(layer_tree_host), |
49 started_(false), | 49 started_(false), |
50 textures_acquired_(true), | 50 textures_acquired_(true), |
51 in_composite_and_readback_(false), | 51 in_composite_and_readback_(false), |
52 manage_tiles_pending_(false), | 52 manage_tiles_pending_(false), |
53 initializing_new_output_surface__on_impl_thread_(false), | |
53 weak_factory_on_impl_thread_(this), | 54 weak_factory_on_impl_thread_(this), |
54 weak_factory_(this), | 55 weak_factory_(this), |
55 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), | 56 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), |
56 readback_request_on_impl_thread_(NULL), | 57 readback_request_on_impl_thread_(NULL), |
57 commit_completion_event_on_impl_thread_(NULL), | 58 commit_completion_event_on_impl_thread_(NULL), |
58 completion_event_for_commit_held_on_tree_activation_(NULL), | 59 completion_event_for_commit_held_on_tree_activation_(NULL), |
59 texture_acquisition_completion_event_on_impl_thread_(NULL), | 60 texture_acquisition_completion_event_on_impl_thread_(NULL), |
60 next_frame_is_newly_committed_frame_on_impl_thread_(false), | 61 next_frame_is_newly_committed_frame_on_impl_thread_(false), |
61 throttle_frame_production_( | 62 throttle_frame_production_( |
62 layer_tree_host->settings().throttle_frame_production), | 63 layer_tree_host->settings().throttle_frame_production), |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); | 1155 TRACE_EVENT0("cc", "ThreadProxy::InitializeOutputSurfaceOnImplThread"); |
1155 DCHECK(IsImplThread()); | 1156 DCHECK(IsImplThread()); |
1156 DCHECK(IsMainThreadBlocked()); | 1157 DCHECK(IsMainThreadBlocked()); |
1157 DCHECK(success); | 1158 DCHECK(success); |
1158 DCHECK(capabilities); | 1159 DCHECK(capabilities); |
1159 | 1160 |
1160 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 1161 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
1161 layer_tree_host_impl_->resource_provider()); | 1162 layer_tree_host_impl_->resource_provider()); |
1162 | 1163 |
1163 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 1164 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
1165 if (*success) | |
1166 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); | |
1167 | |
1168 initializing_new_output_surface__on_impl_thread_ = true; | |
1169 DidUpdateCapabilitiesOnImplThread(*success, offscreen_context_provider); | |
1170 initializing_new_output_surface__on_impl_thread_ = false; | |
1171 | |
1172 completion->Signal(); | |
1173 } | |
1174 | |
1175 void ThreadProxy::DidUpdateCapabilitiesOnImplThread( | |
danakj
2013/05/24 19:02:30
nit: DidInitializeRendererOnImplThread? This funct
| |
1176 bool success, | |
1177 scoped_refptr<ContextProvider> offscreen_context_provider) { | |
1178 DCHECK(IsImplThread()); | |
1164 | 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(); | |
1170 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( | 1184 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( |
1171 capabilities->using_swap_complete_callback); | 1185 layer_tree_host_impl_->GetRendererCapabilities() |
1186 .using_swap_complete_callback); | |
1172 | 1187 |
1173 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); | 1188 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); |
1174 DCHECK(output_surface_ptr); | 1189 DCHECK(output_surface_ptr); |
1175 int max_frames_pending = | 1190 int max_frames_pending = |
1176 output_surface_ptr->capabilities().max_frames_pending; | 1191 output_surface_ptr->capabilities().max_frames_pending; |
1177 if (max_frames_pending <= 0) | 1192 if (max_frames_pending <= 0) |
1178 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; | 1193 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; |
1179 if (output_surface_ptr->capabilities().has_parent_compositor) | 1194 if (output_surface_ptr->capabilities().has_parent_compositor) |
1180 max_frames_pending = 1; | 1195 max_frames_pending = 1; |
1181 | 1196 |
1182 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); | 1197 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); |
1183 | 1198 |
1184 if (layer_tree_host_impl_->resource_provider()) | 1199 if (layer_tree_host_impl_->resource_provider()) |
1185 layer_tree_host_impl_->resource_provider()-> | 1200 layer_tree_host_impl_->resource_provider() |
1186 set_offscreen_context_provider(offscreen_context_provider); | 1201 ->set_offscreen_context_provider(offscreen_context_provider); |
1187 | 1202 |
1188 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | 1203 if (initializing_new_output_surface__on_impl_thread_) { |
1204 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | |
1205 } else { | |
1206 Proxy::MainThread()->PostTask(base::Bind( | |
1207 &ThreadProxy::DidUpdateCapabilities, main_thread_weak_ptr_)); | |
1208 } | |
1189 } else if (offscreen_context_provider) { | 1209 } else if (offscreen_context_provider) { |
1190 offscreen_context_provider->VerifyContexts(); | 1210 offscreen_context_provider->VerifyContexts(); |
1191 } | 1211 } |
1212 } | |
1192 | 1213 |
1193 completion->Signal(); | 1214 void ThreadProxy::DidUpdateCapabilities() { |
danakj
2013/05/24 19:02:30
This needs to take and do something with the caps,
| |
1215 DCHECK(IsMainThread()); | |
1216 if (layer_tree_host_) { | |
1217 layer_tree_host_->DidUpdateCapabilities(); | |
1218 } | |
1194 } | 1219 } |
1195 | 1220 |
1196 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { | 1221 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { |
1197 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); | 1222 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); |
1198 DCHECK(IsImplThread()); | 1223 DCHECK(IsImplThread()); |
1199 if (layer_tree_host_impl_->resource_provider()) | 1224 if (layer_tree_host_impl_->resource_provider()) |
1200 layer_tree_host_impl_->resource_provider()->Finish(); | 1225 layer_tree_host_impl_->resource_provider()->Finish(); |
1201 completion->Signal(); | 1226 completion->Signal(); |
1202 } | 1227 } |
1203 | 1228 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1384 !layer_tree_host_impl_->pending_tree()) { | 1409 !layer_tree_host_impl_->pending_tree()) { |
1385 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1410 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
1386 TRACE_EVENT_SCOPE_THREAD); | 1411 TRACE_EVENT_SCOPE_THREAD); |
1387 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1412 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1388 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1413 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1389 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1414 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1390 } | 1415 } |
1391 } | 1416 } |
1392 | 1417 |
1393 } // namespace cc | 1418 } // namespace cc |
OLD | NEW |