| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 LayerTreeHostImpl::FrameData::FrameData() | 134 LayerTreeHostImpl::FrameData::FrameData() |
| 135 : render_surface_layer_list(nullptr), has_no_damage(false) {} | 135 : render_surface_layer_list(nullptr), has_no_damage(false) {} |
| 136 | 136 |
| 137 LayerTreeHostImpl::FrameData::~FrameData() {} | 137 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 138 | 138 |
| 139 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 139 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 140 const LayerTreeSettings& settings, | 140 const LayerTreeSettings& settings, |
| 141 LayerTreeHostImplClient* client, | 141 LayerTreeHostImplClient* client, |
| 142 Proxy* proxy, | 142 ThreadVerifier* thread_verifier, |
| 143 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 143 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 144 SharedBitmapManager* shared_bitmap_manager, | 144 SharedBitmapManager* shared_bitmap_manager, |
| 145 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 145 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 146 TaskGraphRunner* task_graph_runner, | 146 TaskGraphRunner* task_graph_runner, |
| 147 int id) { | 147 int id) { |
| 148 return make_scoped_ptr(new LayerTreeHostImpl( | 148 return make_scoped_ptr(new LayerTreeHostImpl( |
| 149 settings, client, proxy, rendering_stats_instrumentation, | 149 settings, client, thread_verifier, rendering_stats_instrumentation, |
| 150 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id)); | 150 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 LayerTreeHostImpl::LayerTreeHostImpl( | 153 LayerTreeHostImpl::LayerTreeHostImpl( |
| 154 const LayerTreeSettings& settings, | 154 const LayerTreeSettings& settings, |
| 155 LayerTreeHostImplClient* client, | 155 LayerTreeHostImplClient* client, |
| 156 Proxy* proxy, | 156 ThreadVerifier* thread_verifier, |
| 157 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 157 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 158 SharedBitmapManager* shared_bitmap_manager, | 158 SharedBitmapManager* shared_bitmap_manager, |
| 159 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 159 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 160 TaskGraphRunner* task_graph_runner, | 160 TaskGraphRunner* task_graph_runner, |
| 161 int id) | 161 int id) |
| 162 : client_(client), | 162 : client_(client), |
| 163 proxy_(proxy), | 163 thread_verifier_(thread_verifier), |
| 164 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 164 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
| 165 output_surface_(nullptr), | 165 output_surface_(nullptr), |
| 166 content_is_suitable_for_gpu_rasterization_(true), | 166 content_is_suitable_for_gpu_rasterization_(true), |
| 167 has_gpu_rasterization_trigger_(false), | 167 has_gpu_rasterization_trigger_(false), |
| 168 use_gpu_rasterization_(false), | 168 use_gpu_rasterization_(false), |
| 169 use_msaa_(false), | 169 use_msaa_(false), |
| 170 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 170 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
| 171 tree_resources_for_gpu_rasterization_dirty_(false), | 171 tree_resources_for_gpu_rasterization_dirty_(false), |
| 172 input_handler_client_(NULL), | 172 input_handler_client_(NULL), |
| 173 did_lock_scrolling_layer_(false), | 173 did_lock_scrolling_layer_(false), |
| 174 wheel_scrolling_(false), | 174 wheel_scrolling_(false), |
| 175 scroll_affects_scroll_handler_(false), | 175 scroll_affects_scroll_handler_(false), |
| 176 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), | 176 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), |
| 177 tile_priorities_dirty_(false), | 177 tile_priorities_dirty_(false), |
| 178 settings_(settings), | 178 settings_(settings), |
| 179 visible_(false), | 179 visible_(false), |
| 180 cached_managed_memory_policy_(settings.memory_policy_), | 180 cached_managed_memory_policy_(settings.memory_policy_), |
| 181 is_synchronous_single_threaded_(!proxy->HasImplThread() && | 181 is_synchronous_single_threaded_(!thread_verifier->HasImplThread() && |
| 182 !settings.single_thread_proxy_scheduler), | 182 !settings.single_thread_proxy_scheduler), |
| 183 // Must be initialized after is_synchronous_single_threaded_ and proxy_. | 183 // Must be initialized after is_synchronous_single_threaded_ and |
| 184 // thread_verifier_. |
| 184 tile_manager_( | 185 tile_manager_( |
| 185 TileManager::Create(this, | 186 TileManager::Create(this, |
| 186 GetTaskRunner(), | 187 GetTaskRunner(), |
| 187 is_synchronous_single_threaded_ | 188 is_synchronous_single_threaded_ |
| 188 ? std::numeric_limits<size_t>::max() | 189 ? std::numeric_limits<size_t>::max() |
| 189 : settings.scheduled_raster_task_limit)), | 190 : settings.scheduled_raster_task_limit)), |
| 190 pinch_gesture_active_(false), | 191 pinch_gesture_active_(false), |
| 191 pinch_gesture_end_should_clear_scrolling_layer_(false), | 192 pinch_gesture_end_should_clear_scrolling_layer_(false), |
| 192 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), | 193 fps_counter_(FrameRateCounter::Create(thread_verifier_->HasImplThread())), |
| 193 memory_history_(MemoryHistory::Create()), | 194 memory_history_(MemoryHistory::Create()), |
| 194 debug_rect_history_(DebugRectHistory::Create()), | 195 debug_rect_history_(DebugRectHistory::Create()), |
| 195 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), | 196 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), |
| 196 max_memory_needed_bytes_(0), | 197 max_memory_needed_bytes_(0), |
| 197 resourceless_software_draw_(false), | 198 resourceless_software_draw_(false), |
| 198 animation_registrar_(), | 199 animation_registrar_(), |
| 199 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 200 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 200 micro_benchmark_controller_(this), | 201 micro_benchmark_controller_(this), |
| 201 shared_bitmap_manager_(shared_bitmap_manager), | 202 shared_bitmap_manager_(shared_bitmap_manager), |
| 202 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 203 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 203 task_graph_runner_(task_graph_runner), | 204 task_graph_runner_(task_graph_runner), |
| 204 id_(id), | 205 id_(id), |
| 205 requires_high_res_to_draw_(false), | 206 requires_high_res_to_draw_(false), |
| 206 is_likely_to_require_a_draw_(false), | 207 is_likely_to_require_a_draw_(false), |
| 207 frame_timing_tracker_(FrameTimingTracker::Create(this)) { | 208 frame_timing_tracker_(FrameTimingTracker::Create(this)) { |
| 208 if (settings.use_compositor_animation_timelines) { | 209 if (settings.use_compositor_animation_timelines) { |
| 209 if (settings.accelerated_animation_enabled) { | 210 if (settings.accelerated_animation_enabled) { |
| 210 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); | 211 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); |
| 211 animation_host_->SetMutatorHostClient(this); | 212 animation_host_->SetMutatorHostClient(this); |
| 212 animation_host_->SetSupportsScrollAnimations( | 213 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling()); |
| 213 proxy_->SupportsImplScrolling()); | |
| 214 } | 214 } |
| 215 } else { | 215 } else { |
| 216 animation_registrar_ = AnimationRegistrar::Create(); | 216 animation_registrar_ = AnimationRegistrar::Create(); |
| 217 animation_registrar_->set_supports_scroll_animations( | 217 animation_registrar_->set_supports_scroll_animations( |
| 218 proxy_->SupportsImplScrolling()); | 218 SupportsImplScrolling()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 DCHECK(proxy_->IsImplThread()); | 221 DCHECK(thread_verifier_->IsImplThread()); |
| 222 DidVisibilityChange(this, visible_); | 222 DidVisibilityChange(this, visible_); |
| 223 | 223 |
| 224 SetDebugState(settings.initial_debug_state); | 224 SetDebugState(settings.initial_debug_state); |
| 225 | 225 |
| 226 // LTHI always has an active tree. | 226 // LTHI always has an active tree. |
| 227 active_tree_ = | 227 active_tree_ = |
| 228 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), | 228 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), |
| 229 new SyncedTopControls, new SyncedElasticOverscroll); | 229 new SyncedTopControls, new SyncedElasticOverscroll); |
| 230 | 230 |
| 231 viewport_ = Viewport::Create(this); | 231 viewport_ = Viewport::Create(this); |
| 232 | 232 |
| 233 TRACE_EVENT_OBJECT_CREATED_WITH_ID( | 233 TRACE_EVENT_OBJECT_CREATED_WITH_ID( |
| 234 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 234 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 235 | 235 |
| 236 top_controls_manager_ = | 236 top_controls_manager_ = |
| 237 TopControlsManager::Create(this, | 237 TopControlsManager::Create(this, |
| 238 settings.top_controls_show_threshold, | 238 settings.top_controls_show_threshold, |
| 239 settings.top_controls_hide_threshold); | 239 settings.top_controls_hide_threshold); |
| 240 } | 240 } |
| 241 | 241 |
| 242 LayerTreeHostImpl::~LayerTreeHostImpl() { | 242 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 243 DCHECK(proxy_->IsImplThread()); | 243 DCHECK(thread_verifier_->IsImplThread()); |
| 244 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 244 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 245 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 245 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 246 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 246 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 247 | 247 |
| 248 if (input_handler_client_) { | 248 if (input_handler_client_) { |
| 249 input_handler_client_->WillShutdown(); | 249 input_handler_client_->WillShutdown(); |
| 250 input_handler_client_ = NULL; | 250 input_handler_client_ = NULL; |
| 251 } | 251 } |
| 252 if (scroll_elasticity_helper_) | 252 if (scroll_elasticity_helper_) |
| 253 scroll_elasticity_helper_.reset(); | 253 scroll_elasticity_helper_.reset(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 // Ensure all textures are returned so partial texture updates can happen | 293 // Ensure all textures are returned so partial texture updates can happen |
| 294 // during the commit. | 294 // during the commit. |
| 295 // TODO(ericrk): We should not need to ForceReclaimResources when using | 295 // TODO(ericrk): We should not need to ForceReclaimResources when using |
| 296 // Impl-side-painting as it doesn't upload during commits. However, | 296 // Impl-side-painting as it doesn't upload during commits. However, |
| 297 // Display::Draw currently relies on resource being reclaimed to block drawing | 297 // Display::Draw currently relies on resource being reclaimed to block drawing |
| 298 // between BeginCommit / Swap. See crbug.com/489515. | 298 // between BeginCommit / Swap. See crbug.com/489515. |
| 299 if (output_surface_) | 299 if (output_surface_) |
| 300 output_surface_->ForceReclaimResources(); | 300 output_surface_->ForceReclaimResources(); |
| 301 | 301 |
| 302 if (!proxy_->CommitToActiveTree()) | 302 if (!CommitToActiveTree()) |
| 303 CreatePendingTree(); | 303 CreatePendingTree(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void LayerTreeHostImpl::CommitComplete() { | 306 void LayerTreeHostImpl::CommitComplete() { |
| 307 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 307 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 308 | 308 |
| 309 if (proxy_->CommitToActiveTree()) { | 309 if (CommitToActiveTree()) { |
| 310 // We have to activate animations here or "IsActive()" is true on the layers | 310 // We have to activate animations here or "IsActive()" is true on the layers |
| 311 // but the animations aren't activated yet so they get ignored by | 311 // but the animations aren't activated yet so they get ignored by |
| 312 // UpdateDrawProperties. | 312 // UpdateDrawProperties. |
| 313 ActivateAnimations(); | 313 ActivateAnimations(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // Start animations before UpdateDrawProperties and PrepareTiles, as they can | 316 // Start animations before UpdateDrawProperties and PrepareTiles, as they can |
| 317 // change the results. When doing commit to the active tree, this must happen | 317 // change the results. When doing commit to the active tree, this must happen |
| 318 // after ActivateAnimations() in order for this ticking to be propogated to | 318 // after ActivateAnimations() in order for this ticking to be propogated to |
| 319 // layers on the active tree. | 319 // layers on the active tree. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 334 // TODO(vmpstr): Investigate always having PrepareTiles issue | 334 // TODO(vmpstr): Investigate always having PrepareTiles issue |
| 335 // NotifyReadyToActivate, instead of handling it here. | 335 // NotifyReadyToActivate, instead of handling it here. |
| 336 bool did_prepare_tiles = PrepareTiles(); | 336 bool did_prepare_tiles = PrepareTiles(); |
| 337 if (!did_prepare_tiles) { | 337 if (!did_prepare_tiles) { |
| 338 NotifyReadyToActivate(); | 338 NotifyReadyToActivate(); |
| 339 | 339 |
| 340 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This | 340 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This |
| 341 // is important for SingleThreadProxy and impl-side painting case. For | 341 // is important for SingleThreadProxy and impl-side painting case. For |
| 342 // STP, we commit to active tree and RequiresHighResToDraw, and set | 342 // STP, we commit to active tree and RequiresHighResToDraw, and set |
| 343 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. | 343 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. |
| 344 if (proxy_->CommitToActiveTree()) | 344 if (CommitToActiveTree()) |
| 345 NotifyReadyToDraw(); | 345 NotifyReadyToDraw(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 micro_benchmark_controller_.DidCompleteCommit(); | 348 micro_benchmark_controller_.DidCompleteCommit(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 bool LayerTreeHostImpl::CanDraw() const { | 351 bool LayerTreeHostImpl::CanDraw() const { |
| 352 // Note: If you are changing this function or any other function that might | 352 // Note: If you are changing this function or any other function that might |
| 353 // affect the result of CanDraw, make sure to call | 353 // affect the result of CanDraw, make sure to call |
| 354 // client_->OnCanDrawStateChanged in the proper places and update the | 354 // client_->OnCanDrawStateChanged in the proper places and update the |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (EvictedUIResourcesExist()) { | 388 if (EvictedUIResourcesExist()) { |
| 389 TRACE_EVENT_INSTANT0( | 389 TRACE_EVENT_INSTANT0( |
| 390 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 390 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
| 391 TRACE_EVENT_SCOPE_THREAD); | 391 TRACE_EVENT_SCOPE_THREAD); |
| 392 return false; | 392 return false; |
| 393 } | 393 } |
| 394 return true; | 394 return true; |
| 395 } | 395 } |
| 396 | 396 |
| 397 void LayerTreeHostImpl::Animate() { | 397 void LayerTreeHostImpl::Animate() { |
| 398 DCHECK(proxy_->IsImplThread()); | 398 DCHECK(thread_verifier_->IsImplThread()); |
| 399 base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time; | 399 base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time; |
| 400 | 400 |
| 401 // mithro(TODO): Enable these checks. | 401 // mithro(TODO): Enable these checks. |
| 402 // DCHECK(!current_begin_frame_tracker_.HasFinished()); | 402 // DCHECK(!current_begin_frame_tracker_.HasFinished()); |
| 403 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time) | 403 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time) |
| 404 // << "Called animate with unknown frame time!?"; | 404 // << "Called animate with unknown frame time!?"; |
| 405 | 405 |
| 406 if (input_handler_client_) { | 406 if (input_handler_client_) { |
| 407 // This animates fling scrolls. But on Android WebView root flings are | 407 // This animates fling scrolls. But on Android WebView root flings are |
| 408 // controlled by the application, so the compositor does not animate them. | 408 // controlled by the application, so the compositor does not animate them. |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 // destroyed. | 1347 // destroyed. |
| 1348 NotifyAllTileTasksCompleted(); | 1348 NotifyAllTileTasksCompleted(); |
| 1349 | 1349 |
| 1350 CreateTileManagerResources(); | 1350 CreateTileManagerResources(); |
| 1351 RecreateTreeResources(); | 1351 RecreateTreeResources(); |
| 1352 } | 1352 } |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 void LayerTreeHostImpl::SetTreeActivationCallback( | 1355 void LayerTreeHostImpl::SetTreeActivationCallback( |
| 1356 const base::Closure& callback) { | 1356 const base::Closure& callback) { |
| 1357 DCHECK(proxy_->IsImplThread()); | 1357 DCHECK(thread_verifier_->IsImplThread()); |
| 1358 tree_activation_callback_ = callback; | 1358 tree_activation_callback_ = callback; |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 void LayerTreeHostImpl::SetManagedMemoryPolicy( | 1361 void LayerTreeHostImpl::SetManagedMemoryPolicy( |
| 1362 const ManagedMemoryPolicy& policy) { | 1362 const ManagedMemoryPolicy& policy) { |
| 1363 if (cached_managed_memory_policy_ == policy) | 1363 if (cached_managed_memory_policy_ == policy) |
| 1364 return; | 1364 return; |
| 1365 | 1365 |
| 1366 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); | 1366 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); |
| 1367 | 1367 |
| 1368 cached_managed_memory_policy_ = policy; | 1368 cached_managed_memory_policy_ = policy; |
| 1369 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); | 1369 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); |
| 1370 | 1370 |
| 1371 if (old_policy == actual_policy) | 1371 if (old_policy == actual_policy) |
| 1372 return; | 1372 return; |
| 1373 | 1373 |
| 1374 if (!proxy_->HasImplThread()) { | 1374 if (!thread_verifier_->HasImplThread()) { |
| 1375 // In single-thread mode, this can be called on the main thread by | 1375 // In single-thread mode, this can be called on the main thread by |
| 1376 // GLRenderer::OnMemoryAllocationChanged. | 1376 // GLRenderer::OnMemoryAllocationChanged. |
| 1377 DebugScopedSetImplThread impl_thread(proxy_); | 1377 DebugScopedSetImplThread impl_thread(thread_verifier_); |
| 1378 UpdateTileManagerMemoryPolicy(actual_policy); | 1378 UpdateTileManagerMemoryPolicy(actual_policy); |
| 1379 } else { | 1379 } else { |
| 1380 DCHECK(proxy_->IsImplThread()); | 1380 DCHECK(thread_verifier_->IsImplThread()); |
| 1381 UpdateTileManagerMemoryPolicy(actual_policy); | 1381 UpdateTileManagerMemoryPolicy(actual_policy); |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 // If there is already enough memory to draw everything imaginable and the | 1384 // If there is already enough memory to draw everything imaginable and the |
| 1385 // new memory limit does not change this, then do not re-commit. Don't bother | 1385 // new memory limit does not change this, then do not re-commit. Don't bother |
| 1386 // skipping commits if this is not visible (commits don't happen when not | 1386 // skipping commits if this is not visible (commits don't happen when not |
| 1387 // visible, there will almost always be a commit when this becomes visible). | 1387 // visible, there will almost always be a commit when this becomes visible). |
| 1388 bool needs_commit = true; | 1388 bool needs_commit = true; |
| 1389 if (visible() && | 1389 if (visible() && |
| 1390 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && | 1390 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 pending_page_scale_animation->use_anchor, | 1948 pending_page_scale_animation->use_anchor, |
| 1949 pending_page_scale_animation->scale, | 1949 pending_page_scale_animation->scale, |
| 1950 pending_page_scale_animation->duration); | 1950 pending_page_scale_animation->duration); |
| 1951 } | 1951 } |
| 1952 // Activation can change the root scroll offset, so inform the synchronous | 1952 // Activation can change the root scroll offset, so inform the synchronous |
| 1953 // input handler. | 1953 // input handler. |
| 1954 UpdateRootLayerStateForSynchronousInputHandler(); | 1954 UpdateRootLayerStateForSynchronousInputHandler(); |
| 1955 } | 1955 } |
| 1956 | 1956 |
| 1957 void LayerTreeHostImpl::SetVisible(bool visible) { | 1957 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1958 DCHECK(proxy_->IsImplThread()); | 1958 DCHECK(thread_verifier_->IsImplThread()); |
| 1959 | 1959 |
| 1960 if (visible_ == visible) | 1960 if (visible_ == visible) |
| 1961 return; | 1961 return; |
| 1962 visible_ = visible; | 1962 visible_ = visible; |
| 1963 DidVisibilityChange(this, visible_); | 1963 DidVisibilityChange(this, visible_); |
| 1964 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1964 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| 1965 | 1965 |
| 1966 // If we just became visible, we have to ensure that we draw high res tiles, | 1966 // If we just became visible, we have to ensure that we draw high res tiles, |
| 1967 // to prevent checkerboard/low res flashes. | 1967 // to prevent checkerboard/low res flashes. |
| 1968 if (visible_) | 1968 if (visible_) |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 if (!output_surface->BindToClient(this)) { | 2201 if (!output_surface->BindToClient(this)) { |
| 2202 // Avoid recreating tree resources because we might not have enough | 2202 // Avoid recreating tree resources because we might not have enough |
| 2203 // information to do this yet (eg. we don't have a TileManager at this | 2203 // information to do this yet (eg. we don't have a TileManager at this |
| 2204 // point). | 2204 // point). |
| 2205 return false; | 2205 return false; |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 output_surface_ = output_surface; | 2208 output_surface_ = output_surface; |
| 2209 resource_provider_ = ResourceProvider::Create( | 2209 resource_provider_ = ResourceProvider::Create( |
| 2210 output_surface_, shared_bitmap_manager_, gpu_memory_buffer_manager_, | 2210 output_surface_, shared_bitmap_manager_, gpu_memory_buffer_manager_, |
| 2211 proxy_->blocking_main_thread_task_runner(), | 2211 thread_verifier_->blocking_main_thread_task_runner(), |
| 2212 settings_.renderer_settings.highp_threshold_min, | 2212 settings_.renderer_settings.highp_threshold_min, |
| 2213 settings_.renderer_settings.texture_id_allocation_chunk_size, | 2213 settings_.renderer_settings.texture_id_allocation_chunk_size, |
| 2214 settings_.use_image_texture_targets); | 2214 settings_.use_image_texture_targets); |
| 2215 | 2215 |
| 2216 CreateAndSetRenderer(); | 2216 CreateAndSetRenderer(); |
| 2217 | 2217 |
| 2218 // Since the new renderer may be capable of MSAA, update status here. | 2218 // Since the new renderer may be capable of MSAA, update status here. |
| 2219 UpdateGpuRasterizationStatus(); | 2219 UpdateGpuRasterizationStatus(); |
| 2220 | 2220 |
| 2221 CreateTileManagerResources(); | 2221 CreateTileManagerResources(); |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3595 int layer_id) const { | 3595 int layer_id) const { |
| 3596 if (active_tree()) { | 3596 if (active_tree()) { |
| 3597 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3597 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
| 3598 if (layer) | 3598 if (layer) |
| 3599 return layer->ScrollOffsetForAnimation(); | 3599 return layer->ScrollOffsetForAnimation(); |
| 3600 } | 3600 } |
| 3601 | 3601 |
| 3602 return gfx::ScrollOffset(); | 3602 return gfx::ScrollOffset(); |
| 3603 } | 3603 } |
| 3604 | 3604 |
| 3605 bool LayerTreeHostImpl::SupportsImplScrolling() const { |
| 3606 // Supported in threaded mode. |
| 3607 return thread_verifier_->HasImplThread(); |
| 3608 } |
| 3609 |
| 3610 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3611 // In single threaded mode we skip the pending tree and commit directly to the |
| 3612 // active tree. |
| 3613 return !thread_verifier_->HasImplThread(); |
| 3614 } |
| 3615 |
| 3605 } // namespace cc | 3616 } // namespace cc |
| OLD | NEW |