Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && 229 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() &&
230 !settings.single_thread_proxy_scheduler), 230 !settings.single_thread_proxy_scheduler),
231 // Must be initialized after is_synchronous_single_threaded_ and 231 // Must be initialized after is_synchronous_single_threaded_ and
232 // task_runner_provider_. 232 // task_runner_provider_.
233 tile_manager_(this, 233 tile_manager_(this,
234 GetTaskRunner(), 234 GetTaskRunner(),
235 std::move(image_worker_task_runner), 235 std::move(image_worker_task_runner),
236 is_synchronous_single_threaded_ 236 is_synchronous_single_threaded_
237 ? std::numeric_limits<size_t>::max() 237 ? std::numeric_limits<size_t>::max()
238 : settings.scheduled_raster_task_limit, 238 : settings.scheduled_raster_task_limit,
239 settings.use_partial_raster, 239 settings.ToTileManagerSettings()),
240 settings.check_tile_priority_inversion),
241 pinch_gesture_active_(false), 240 pinch_gesture_active_(false),
242 pinch_gesture_end_should_clear_scrolling_layer_(false), 241 pinch_gesture_end_should_clear_scrolling_layer_(false),
243 fps_counter_( 242 fps_counter_(
244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), 243 FrameRateCounter::Create(task_runner_provider_->HasImplThread())),
245 memory_history_(MemoryHistory::Create()), 244 memory_history_(MemoryHistory::Create()),
246 debug_rect_history_(DebugRectHistory::Create()), 245 debug_rect_history_(DebugRectHistory::Create()),
247 max_memory_needed_bytes_(0), 246 max_memory_needed_bytes_(0),
248 resourceless_software_draw_(false), 247 resourceless_software_draw_(false),
249 mutator_host_(std::move(mutator_host)), 248 mutator_host_(std::move(mutator_host)),
250 rendering_stats_instrumentation_(rendering_stats_instrumentation), 249 rendering_stats_instrumentation_(rendering_stats_instrumentation),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (compositor_frame_sink_) 344 if (compositor_frame_sink_)
346 compositor_frame_sink_->ForceReclaimResources(); 345 compositor_frame_sink_->ForceReclaimResources();
347 346
348 if (!CommitToActiveTree()) 347 if (!CommitToActiveTree())
349 CreatePendingTree(); 348 CreatePendingTree();
350 } 349 }
351 350
352 void LayerTreeHostImpl::CommitComplete() { 351 void LayerTreeHostImpl::CommitComplete() {
353 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 352 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
354 353
354 UpdateSyncTreeAfterCommitOrImplSideInvalidation();
355 micro_benchmark_controller_.DidCompleteCommit();
vmpstr 2017/02/10 19:25:43 hmm why did you move the micro benchmark controlle
Khushal 2017/02/10 22:09:19 It shouldn't. I took a look at that and there shou
356 }
357
358 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() {
359 AddImplSideInvalidationToSyncTree();
355 if (CommitToActiveTree()) { 360 if (CommitToActiveTree()) {
356 // We have to activate animations here or "IsActive()" is true on the layers 361 // We have to activate animations here or "IsActive()" is true on the layers
357 // but the animations aren't activated yet so they get ignored by 362 // but the animations aren't activated yet so they get ignored by
358 // UpdateDrawProperties. 363 // UpdateDrawProperties.
359 ActivateAnimations(); 364 ActivateAnimations();
360 } 365 }
361 366
362 // Start animations before UpdateDrawProperties and PrepareTiles, as they can 367 // Start animations before UpdateDrawProperties and PrepareTiles, as they can
363 // change the results. When doing commit to the active tree, this must happen 368 // change the results. When doing commit to the active tree, this must happen
364 // after ActivateAnimations() in order for this ticking to be propogated to 369 // after ActivateAnimations() in order for this ticking to be propogated to
(...skipping 21 matching lines...) Expand all
386 if (!did_prepare_tiles) { 391 if (!did_prepare_tiles) {
387 NotifyReadyToActivate(); 392 NotifyReadyToActivate();
388 393
389 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This 394 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This
390 // is important for SingleThreadProxy and impl-side painting case. For 395 // is important for SingleThreadProxy and impl-side painting case. For
391 // STP, we commit to active tree and RequiresHighResToDraw, and set 396 // STP, we commit to active tree and RequiresHighResToDraw, and set
392 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. 397 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard.
393 if (CommitToActiveTree()) 398 if (CommitToActiveTree())
394 NotifyReadyToDraw(); 399 NotifyReadyToDraw();
395 } 400 }
396
397 micro_benchmark_controller_.DidCompleteCommit();
398 } 401 }
399 402
400 bool LayerTreeHostImpl::CanDraw() const { 403 bool LayerTreeHostImpl::CanDraw() const {
401 // Note: If you are changing this function or any other function that might 404 // Note: If you are changing this function or any other function that might
402 // affect the result of CanDraw, make sure to call 405 // affect the result of CanDraw, make sure to call
403 // client_->OnCanDrawStateChanged in the proper places and update the 406 // client_->OnCanDrawStateChanged in the proper places and update the
404 // NotifyIfCanDrawChanged test. 407 // NotifyIfCanDrawChanged test.
405 408
406 if (!compositor_frame_sink_) { 409 if (!compositor_frame_sink_) {
407 TRACE_EVENT_INSTANT0("cc", 410 TRACE_EVENT_INSTANT0("cc",
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1050
1048 void LayerTreeHostImpl::DidAnimateScrollOffset() { 1051 void LayerTreeHostImpl::DidAnimateScrollOffset() {
1049 client_->SetNeedsCommitOnImplThread(); 1052 client_->SetNeedsCommitOnImplThread();
1050 client_->RenewTreePriority(); 1053 client_->RenewTreePriority();
1051 } 1054 }
1052 1055
1053 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { 1056 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) {
1054 viewport_damage_rect_.Union(damage_rect); 1057 viewport_damage_rect_.Union(damage_rect);
1055 } 1058 }
1056 1059
1060 void LayerTreeHostImpl::InvalidateContentOnImplSide() {
1061 DCHECK(!pending_tree_);
1062
1063 if (!CommitToActiveTree())
1064 CreatePendingTree();
1065 UpdateSyncTreeAfterCommitOrImplSideInvalidation();
1066 }
1067
1068 void LayerTreeHostImpl::AddImplSideInvalidationToSyncTree() {
1069 sync_tree()->InvalidateRegionForImages(
vmpstr 2017/02/10 19:25:43 Just inline this call where the function is called
Khushal 2017/02/10 22:09:19 Done.
1070 tile_manager_.TakeImagesToInvalidateOnSyncTree());
1071 }
1072
1057 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) { 1073 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
1058 TRACE_EVENT1("cc", "LayerTreeHostImpl::PrepareToDraw", "SourceFrameNumber", 1074 TRACE_EVENT1("cc", "LayerTreeHostImpl::PrepareToDraw", "SourceFrameNumber",
1059 active_tree_->source_frame_number()); 1075 active_tree_->source_frame_number());
1060 if (input_handler_client_) 1076 if (input_handler_client_)
1061 input_handler_client_->ReconcileElasticOverscrollAndRootScroll(); 1077 input_handler_client_->ReconcileElasticOverscrollAndRootScroll();
1062 1078
1063 if (const char* client_name = GetClientNameForMetrics()) { 1079 if (const char* client_name = GetClientNameForMetrics()) {
1064 size_t total_picture_memory = 0; 1080 size_t total_picture_memory = 0;
1065 for (const PictureLayerImpl* layer : active_tree()->picture_layers()) 1081 for (const PictureLayerImpl* layer : active_tree()->picture_layers())
1066 total_picture_memory += layer->GetRasterSource()->GetPictureMemoryUsage(); 1082 total_picture_memory += layer->GetRasterSource()->GetPictureMemoryUsage();
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 // we intend to draw so it may make worse scheduling decisions. 1320 // we intend to draw so it may make worse scheduling decisions.
1305 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw; 1321 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw;
1306 } 1322 }
1307 1323
1308 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const { 1324 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const {
1309 if (!sync_tree()) 1325 if (!sync_tree())
1310 return gfx::ColorSpace(); 1326 return gfx::ColorSpace();
1311 return sync_tree()->device_color_space(); 1327 return sync_tree()->device_color_space();
1312 } 1328 }
1313 1329
1330 void LayerTreeHostImpl::RequestImplSideInvalidation() {
1331 client_->NeedsImplSideInvalidation();
1332 }
1333
1314 void LayerTreeHostImpl::NotifyReadyToActivate() { 1334 void LayerTreeHostImpl::NotifyReadyToActivate() {
1315 client_->NotifyReadyToActivate(); 1335 client_->NotifyReadyToActivate();
1316 } 1336 }
1317 1337
1318 void LayerTreeHostImpl::NotifyReadyToDraw() { 1338 void LayerTreeHostImpl::NotifyReadyToDraw() {
1319 // Tiles that are ready will cause NotifyTileStateChanged() to be called so we 1339 // Tiles that are ready will cause NotifyTileStateChanged() to be called so we
1320 // don't need to schedule a draw here. Just stop WillBeginImplFrame() from 1340 // don't need to schedule a draw here. Just stop WillBeginImplFrame() from
1321 // causing optimistic requests to draw a frame. 1341 // causing optimistic requests to draw a frame.
1322 is_likely_to_require_a_draw_ = false; 1342 is_likely_to_require_a_draw_ = false;
1323 1343
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 2039
2020 UpdateViewportContainerSizes(); 2040 UpdateViewportContainerSizes();
2021 2041
2022 active_tree_->DidBecomeActive(); 2042 active_tree_->DidBecomeActive();
2023 client_->RenewTreePriority(); 2043 client_->RenewTreePriority();
2024 // If we have any picture layers, then by activating we also modified tile 2044 // If we have any picture layers, then by activating we also modified tile
2025 // priorities. 2045 // priorities.
2026 if (!active_tree_->picture_layers().empty()) 2046 if (!active_tree_->picture_layers().empty())
2027 DidModifyTilePriorities(); 2047 DidModifyTilePriorities();
2028 2048
2049 tile_manager_.DidActivateSyncTree();
2029 client_->OnCanDrawStateChanged(CanDraw()); 2050 client_->OnCanDrawStateChanged(CanDraw());
2030 client_->DidActivateSyncTree(); 2051 client_->DidActivateSyncTree();
2031 if (!tree_activation_callback_.is_null()) 2052 if (!tree_activation_callback_.is_null())
2032 tree_activation_callback_.Run(); 2053 tree_activation_callback_.Run();
2033 2054
2034 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation = 2055 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation =
2035 active_tree_->TakePendingPageScaleAnimation(); 2056 active_tree_->TakePendingPageScaleAnimation();
2036 if (pending_page_scale_animation) { 2057 if (pending_page_scale_animation) {
2037 StartPageScaleAnimation(pending_page_scale_animation->target_offset, 2058 StartPageScaleAnimation(pending_page_scale_animation->target_offset,
2038 pending_page_scale_animation->use_anchor, 2059 pending_page_scale_animation->use_anchor,
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 worker_context_visibility_ = 4106 worker_context_visibility_ =
4086 worker_context->CacheController()->ClientBecameVisible(); 4107 worker_context->CacheController()->ClientBecameVisible();
4087 } else { 4108 } else {
4088 worker_context->CacheController()->ClientBecameNotVisible( 4109 worker_context->CacheController()->ClientBecameNotVisible(
4089 std::move(worker_context_visibility_)); 4110 std::move(worker_context_visibility_));
4090 } 4111 }
4091 } 4112 }
4092 } 4113 }
4093 4114
4094 } // namespace cc 4115 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698