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 24 matching lines...) Expand all Loading... | |
35 #include "cc/trees/layer_tree_host_impl.h" | 35 #include "cc/trees/layer_tree_host_impl.h" |
36 #include "cc/trees/layer_tree_impl.h" | 36 #include "cc/trees/layer_tree_impl.h" |
37 #include "cc/trees/occlusion_tracker.h" | 37 #include "cc/trees/occlusion_tracker.h" |
38 #include "cc/trees/single_thread_proxy.h" | 38 #include "cc/trees/single_thread_proxy.h" |
39 #include "cc/trees/thread_proxy.h" | 39 #include "cc/trees/thread_proxy.h" |
40 #include "cc/trees/tree_synchronizer.h" | 40 #include "cc/trees/tree_synchronizer.h" |
41 #include "ui/gfx/size_conversions.h" | 41 #include "ui/gfx/size_conversions.h" |
42 | 42 |
43 namespace { | 43 namespace { |
44 static int s_num_layer_tree_instances; | 44 static int s_num_layer_tree_instances; |
45 const size_t kMaxQueuedSwapPromiseSize = 100; | |
jamesr
2013/11/12 03:15:04
where does this number come from?
Yufeng Shen (Slow to review)
2013/11/13 21:05:04
see comments below.
| |
45 } | 46 } |
46 | 47 |
47 namespace cc { | 48 namespace cc { |
48 | 49 |
49 RendererCapabilities::RendererCapabilities() | 50 RendererCapabilities::RendererCapabilities() |
50 : best_texture_format(RGBA_8888), | 51 : best_texture_format(RGBA_8888), |
51 using_partial_swap(false), | 52 using_partial_swap(false), |
52 using_set_visibility(false), | 53 using_set_visibility(false), |
53 using_egl_image(false), | 54 using_egl_image(false), |
54 allow_partial_texture_updates(false), | 55 allow_partial_texture_updates(false), |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 sync_tree->set_sent_page_scale_delta(1.f); | 392 sync_tree->set_sent_page_scale_delta(1.f); |
392 } | 393 } |
393 | 394 |
394 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, | 395 sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, |
395 min_page_scale_factor_, | 396 min_page_scale_factor_, |
396 max_page_scale_factor_); | 397 max_page_scale_factor_); |
397 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); | 398 sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); |
398 sync_tree->SetLatencyInfo(latency_info_); | 399 sync_tree->SetLatencyInfo(latency_info_); |
399 latency_info_.Clear(); | 400 latency_info_.Clear(); |
400 | 401 |
402 sync_tree->TakeSwapPromise(&swap_promise_list_); | |
403 | |
401 host_impl->SetViewportSize(device_viewport_size_); | 404 host_impl->SetViewportSize(device_viewport_size_); |
402 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); | 405 host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); |
403 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 406 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
404 host_impl->SetDebugState(debug_state_); | 407 host_impl->SetDebugState(debug_state_); |
405 if (pending_page_scale_animation_) { | 408 if (pending_page_scale_animation_) { |
406 host_impl->StartPageScaleAnimation( | 409 host_impl->StartPageScaleAnimation( |
407 pending_page_scale_animation_->target_offset, | 410 pending_page_scale_animation_->target_offset, |
408 pending_page_scale_animation_->use_anchor, | 411 pending_page_scale_animation_->use_anchor, |
409 pending_page_scale_animation_->scale, | 412 pending_page_scale_animation_->scale, |
410 pending_page_scale_animation_->duration); | 413 pending_page_scale_animation_->duration); |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 } | 1286 } |
1284 | 1287 |
1285 bool LayerTreeHost::ScheduleMicroBenchmark( | 1288 bool LayerTreeHost::ScheduleMicroBenchmark( |
1286 const std::string& benchmark_name, | 1289 const std::string& benchmark_name, |
1287 scoped_ptr<base::Value> value, | 1290 scoped_ptr<base::Value> value, |
1288 const MicroBenchmark::DoneCallback& callback) { | 1291 const MicroBenchmark::DoneCallback& callback) { |
1289 return micro_benchmark_controller_.ScheduleRun( | 1292 return micro_benchmark_controller_.ScheduleRun( |
1290 benchmark_name, value.Pass(), callback); | 1293 benchmark_name, value.Pass(), callback); |
1291 } | 1294 } |
1292 | 1295 |
1296 void LayerTreeHost::QueueSwapPromise(const SwapPromise& swap_promise) { | |
1297 if (proxy_->HasImplThread()) { | |
1298 DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); | |
1299 } | |
1300 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseSize) { | |
1301 NOTREACHED() << "LayerTreeHost::swap_promise_list overflows"; | |
jamesr
2013/11/12 03:15:04
i don't understand this. why have this limit?
doe
Yufeng Shen (Slow to review)
2013/11/13 21:05:04
If SwapPromise is supposed to be used by different
| |
1302 swap_promise_list_.clear(); | |
1303 } | |
1304 swap_promise_list_.push_back(swap_promise); | |
1305 } | |
1306 | |
1307 bool LayerTreeHost::HasQueuedSwapPromise() { | |
1308 return !swap_promise_list_.empty(); | |
1309 } | |
1310 | |
1311 void LayerTreeHost::FinishSwapPromise() { | |
1312 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
1313 swap_promise_list_[i].did_swap_callback.Run(); | |
1314 } | |
1315 swap_promise_list_.clear(); | |
1316 } | |
1317 | |
1318 void LayerTreeHost::BreakSwapPromise(const std::string& msg) { | |
1319 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
1320 swap_promise_list_[i].swap_aborted_callback.Run(msg); | |
1321 } | |
1322 swap_promise_list_.clear(); | |
1323 } | |
1324 | |
1293 } // namespace cc | 1325 } // namespace cc |
OLD | NEW |