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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 sync_tree->set_sent_page_scale_delta(1.f); | 378 sync_tree->set_sent_page_scale_delta(1.f); |
| 379 } | 379 } |
| 380 | 380 |
| 381 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, | 381 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, |
| 382 min_page_scale_factor_, | 382 min_page_scale_factor_, |
| 383 max_page_scale_factor_); | 383 max_page_scale_factor_); |
| 384 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); | 384 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); |
| 385 sync_tree->SetLatencyInfo(latency_info_); | 385 sync_tree->SetLatencyInfo(latency_info_); |
| 386 latency_info_.Clear(); | 386 latency_info_.Clear(); |
| 387 | 387 |
| 388 sync_tree->PassSwapPromises(&swap_promise_list_); | |
| 389 | |
| 388 host_impl->SetViewportSize(device_viewport_size_); | 390 host_impl->SetViewportSize(device_viewport_size_); |
| 389 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); | 391 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); |
| 390 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 392 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
| 391 host_impl->SetDebugState(debug_state_); | 393 host_impl->SetDebugState(debug_state_); |
| 392 if (pending_page_scale_animation_) { | 394 if (pending_page_scale_animation_) { |
| 393 host_impl->StartPageScaleAnimation( | 395 host_impl->StartPageScaleAnimation( |
| 394 pending_page_scale_animation_->target_offset, | 396 pending_page_scale_animation_->target_offset, |
| 395 pending_page_scale_animation_->use_anchor, | 397 pending_page_scale_animation_->use_anchor, |
| 396 pending_page_scale_animation_->scale, | 398 pending_page_scale_animation_->scale, |
| 397 pending_page_scale_animation_->duration); | 399 pending_page_scale_animation_->duration); |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1261 } | 1263 } |
| 1262 | 1264 |
| 1263 bool LayerTreeHost::ScheduleMicroBenchmark( | 1265 bool LayerTreeHost::ScheduleMicroBenchmark( |
| 1264 const std::string& benchmark_name, | 1266 const std::string& benchmark_name, |
| 1265 scoped_ptr<base::Value> value, | 1267 scoped_ptr<base::Value> value, |
| 1266 const MicroBenchmark::DoneCallback& callback) { | 1268 const MicroBenchmark::DoneCallback& callback) { |
| 1267 return micro_benchmark_controller_.ScheduleRun( | 1269 return micro_benchmark_controller_.ScheduleRun( |
| 1268 benchmark_name, value.Pass(), callback); | 1270 benchmark_name, value.Pass(), callback); |
| 1269 } | 1271 } |
| 1270 | 1272 |
| 1273 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | |
| 1274 if (proxy_->HasImplThread()) { | |
| 1275 DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); | |
| 1276 } | |
| 1277 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
| 1278 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
| 1279 swap_promise_list_.push_back(swap_promise.Pass()); | |
| 1280 } | |
| 1281 | |
| 1282 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | |
| 1283 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
| 1284 DCHECK(swap_promise_list_[i]); | |
|
danakj
2013/11/26 16:24:37
Can you DCHECK this when they are added (QueueSwap
Yufeng Shen (Slow to review)
2013/11/26 17:30:34
Done.
| |
| 1285 swap_promise_list_[i]->DidNotSwap(reason); | |
| 1286 } | |
| 1287 swap_promise_list_.clear(); | |
| 1288 } | |
| 1289 | |
| 1271 } // namespace cc | 1290 } // namespace cc |
| OLD | NEW |