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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 static base::LazyInstance<base::Lock>::Leaky | 46 static base::LazyInstance<base::Lock>::Leaky |
| 47 s_next_tree_id_lock = LAZY_INSTANCE_INITIALIZER; | 47 s_next_tree_id_lock = LAZY_INSTANCE_INITIALIZER; |
| 48 | 48 |
| 49 inline int GetNextTreeId() { | 49 inline int GetNextTreeId() { |
| 50 static int s_next_tree_id = 1; | 50 static int s_next_tree_id = 1; |
| 51 base::AutoLock lock(s_next_tree_id_lock.Get()); | 51 base::AutoLock lock(s_next_tree_id_lock.Get()); |
| 52 return s_next_tree_id++; | 52 return s_next_tree_id++; |
| 53 } | 53 } |
| 54 } | 54 |
| 55 const size_t kMaxQueuedSwapPromiseSize = 100; | |
| 56 } // namespace | |
| 55 | 57 |
| 56 namespace cc { | 58 namespace cc { |
| 57 | 59 |
| 58 RendererCapabilities::RendererCapabilities() | 60 RendererCapabilities::RendererCapabilities() |
| 59 : best_texture_format(RGBA_8888), | 61 : best_texture_format(RGBA_8888), |
| 60 using_partial_swap(false), | 62 using_partial_swap(false), |
| 61 using_set_visibility(false), | 63 using_set_visibility(false), |
| 62 using_egl_image(false), | 64 using_egl_image(false), |
| 63 allow_partial_texture_updates(false), | 65 allow_partial_texture_updates(false), |
| 64 using_offscreen_context3d(false), | 66 using_offscreen_context3d(false), |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 sync_tree->set_sent_page_scale_delta(1.f); | 380 sync_tree->set_sent_page_scale_delta(1.f); |
| 379 } | 381 } |
| 380 | 382 |
| 381 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, | 383 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, |
| 382 min_page_scale_factor_, | 384 min_page_scale_factor_, |
| 383 max_page_scale_factor_); | 385 max_page_scale_factor_); |
| 384 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); | 386 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); |
| 385 sync_tree->SetLatencyInfo(latency_info_); | 387 sync_tree->SetLatencyInfo(latency_info_); |
| 386 latency_info_.Clear(); | 388 latency_info_.Clear(); |
| 387 | 389 |
| 390 sync_tree->TakeSwapPromise(&swap_promise_list_); | |
|
danakj
2013/11/13 23:22:09
This sounds like we're taking the swap promises fr
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
hmmm, "take" reads more correctly to me than "pass
danakj
2013/11/20 03:00:55
I think insert_and_take() says "insert these thing
Yufeng Shen (Slow to review)
2013/11/20 19:15:41
Done.
| |
| 391 | |
| 388 host_impl->SetViewportSize(device_viewport_size_); | 392 host_impl->SetViewportSize(device_viewport_size_); |
| 389 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); | 393 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); |
| 390 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 394 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
| 391 host_impl->SetDebugState(debug_state_); | 395 host_impl->SetDebugState(debug_state_); |
| 392 if (pending_page_scale_animation_) { | 396 if (pending_page_scale_animation_) { |
| 393 host_impl->StartPageScaleAnimation( | 397 host_impl->StartPageScaleAnimation( |
| 394 pending_page_scale_animation_->target_offset, | 398 pending_page_scale_animation_->target_offset, |
| 395 pending_page_scale_animation_->use_anchor, | 399 pending_page_scale_animation_->use_anchor, |
| 396 pending_page_scale_animation_->scale, | 400 pending_page_scale_animation_->scale, |
| 397 pending_page_scale_animation_->duration); | 401 pending_page_scale_animation_->duration); |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1257 } | 1261 } |
| 1258 | 1262 |
| 1259 bool LayerTreeHost::ScheduleMicroBenchmark( | 1263 bool LayerTreeHost::ScheduleMicroBenchmark( |
| 1260 const std::string& benchmark_name, | 1264 const std::string& benchmark_name, |
| 1261 scoped_ptr<base::Value> value, | 1265 scoped_ptr<base::Value> value, |
| 1262 const MicroBenchmark::DoneCallback& callback) { | 1266 const MicroBenchmark::DoneCallback& callback) { |
| 1263 return micro_benchmark_controller_.ScheduleRun( | 1267 return micro_benchmark_controller_.ScheduleRun( |
| 1264 benchmark_name, value.Pass(), callback); | 1268 benchmark_name, value.Pass(), callback); |
| 1265 } | 1269 } |
| 1266 | 1270 |
| 1271 void LayerTreeHost::QueueSwapPromise(SwapPromise* swap_promise) { | |
| 1272 if (proxy_->HasImplThread()) { | |
| 1273 DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); | |
| 1274 } | |
| 1275 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseSize) { | |
| 1276 NOTREACHED() << "LayerTreeHost::swap_promise_list overflows"; | |
|
danakj
2013/11/13 23:22:09
If you expect this to be hit validly, then don't N
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
| 1277 BreakSwapPromise(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
| 1278 } | |
| 1279 swap_promise_list_.push_back(swap_promise); | |
| 1280 } | |
| 1281 | |
| 1282 bool LayerTreeHost::HasQueuedSwapPromise() { | |
| 1283 return !swap_promise_list_.empty(); | |
| 1284 } | |
| 1285 | |
| 1286 void LayerTreeHost::FinishSwapPromise() { | |
|
danakj
2013/11/13 23:22:09
FinishSwapPromises?
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
| 1287 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
| 1288 swap_promise_list_[i]->DidSwap(); | |
| 1289 } | |
| 1290 swap_promise_list_.clear(); | |
| 1291 } | |
| 1292 | |
| 1293 void LayerTreeHost::BreakSwapPromise(SwapPromise::DidNotSwapReason reason) { | |
|
danakj
2013/11/13 23:22:09
BreakSwapPromises?
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
| |
| 1294 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
| 1295 swap_promise_list_[i]->DidNotSwap(reason); | |
| 1296 } | |
| 1297 swap_promise_list_.clear(); | |
| 1298 } | |
| 1299 | |
| 1267 } // namespace cc | 1300 } // namespace cc |
| OLD | NEW |