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

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

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.use_partial_raster,
240 settings.check_tile_priority_inversion), 240 settings.check_tile_priority_inversion,
241 settings.enable_checker_imaging),
enne (OOO) 2017/02/03 23:07:40 Maybe we should just pass settings through at this
enne (OOO) 2017/02/03 23:07:40 Maybe we should just pass settings through at this
vmpstr 2017/02/03 23:42:33 On 2017/02/03 23:07:40, enne wrote: > Maybe we sho
Khushal 2017/02/07 00:25:33 TileManagerSettings for the win!
241 pinch_gesture_active_(false), 242 pinch_gesture_active_(false),
242 pinch_gesture_end_should_clear_scrolling_layer_(false), 243 pinch_gesture_end_should_clear_scrolling_layer_(false),
243 fps_counter_( 244 fps_counter_(
244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), 245 FrameRateCounter::Create(task_runner_provider_->HasImplThread())),
245 memory_history_(MemoryHistory::Create()), 246 memory_history_(MemoryHistory::Create()),
246 debug_rect_history_(DebugRectHistory::Create()), 247 debug_rect_history_(DebugRectHistory::Create()),
247 max_memory_needed_bytes_(0), 248 max_memory_needed_bytes_(0),
248 resourceless_software_draw_(false), 249 resourceless_software_draw_(false),
249 mutator_host_(std::move(mutator_host)), 250 mutator_host_(std::move(mutator_host)),
250 rendering_stats_instrumentation_(rendering_stats_instrumentation), 251 rendering_stats_instrumentation_(rendering_stats_instrumentation),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (compositor_frame_sink_) 346 if (compositor_frame_sink_)
346 compositor_frame_sink_->ForceReclaimResources(); 347 compositor_frame_sink_->ForceReclaimResources();
347 348
348 if (!CommitToActiveTree()) 349 if (!CommitToActiveTree())
349 CreatePendingTree(); 350 CreatePendingTree();
350 } 351 }
351 352
352 void LayerTreeHostImpl::CommitComplete() { 353 void LayerTreeHostImpl::CommitComplete() {
353 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 354 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
354 355
356 AddImplSideInvalidationToSyncTree();
357
355 if (CommitToActiveTree()) { 358 if (CommitToActiveTree()) {
356 // We have to activate animations here or "IsActive()" is true on the layers 359 // 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 360 // but the animations aren't activated yet so they get ignored by
358 // UpdateDrawProperties. 361 // UpdateDrawProperties.
359 ActivateAnimations(); 362 ActivateAnimations();
360 } 363 }
361 364
362 // Start animations before UpdateDrawProperties and PrepareTiles, as they can 365 // Start animations before UpdateDrawProperties and PrepareTiles, as they can
363 // change the results. When doing commit to the active tree, this must happen 366 // 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 367 // after ActivateAnimations() in order for this ticking to be propogated to
(...skipping 682 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::RunImplSideInvalidation() {
vmpstr 2017/02/03 23:42:33 I'm not a fan of this function name... It's doing
Khushal 2017/02/07 00:25:33 Its going to called by STP/ProxyImpl when the sche
1061 DCHECK(!pending_tree_);
1062
1063 if (!CommitToActiveTree())
1064 CreatePendingTree();
1065
1066 AddImplSideInvalidationToSyncTree();
1067
1068 bool did_prepare_tiles = PrepareTiles();
Khushal 2017/02/01 00:16:31 I wasn't sure but I think these should be the only
enne (OOO) 2017/02/03 23:07:40 This does seem a little sketchy, but still could b
Khushal 2017/02/07 00:25:33 There was also the UpdateDrawProperties step which
1069 if (!did_prepare_tiles) {
1070 NotifyReadyToActivate();
1071
1072 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This
1073 // is important for SingleThreadProxy and impl-side painting case. For
1074 // STP, we commit to active tree and RequiresHighResToDraw, and set
1075 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard.
1076 if (CommitToActiveTree())
1077 NotifyReadyToDraw();
1078 }
1079 }
1080
1081 void LayerTreeHostImpl::AddImplSideInvalidationToSyncTree() {
1082 tile_manager_.AddImplSideInvalidations(sync_tree());
1083 }
1084
1057 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) { 1085 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
1058 TRACE_EVENT1("cc", "LayerTreeHostImpl::PrepareToDraw", "SourceFrameNumber", 1086 TRACE_EVENT1("cc", "LayerTreeHostImpl::PrepareToDraw", "SourceFrameNumber",
1059 active_tree_->source_frame_number()); 1087 active_tree_->source_frame_number());
1060 if (input_handler_client_) 1088 if (input_handler_client_)
1061 input_handler_client_->ReconcileElasticOverscrollAndRootScroll(); 1089 input_handler_client_->ReconcileElasticOverscrollAndRootScroll();
1062 1090
1063 if (const char* client_name = GetClientNameForMetrics()) { 1091 if (const char* client_name = GetClientNameForMetrics()) {
1064 size_t total_picture_memory = 0; 1092 size_t total_picture_memory = 0;
1065 for (const PictureLayerImpl* layer : active_tree()->picture_layers()) 1093 for (const PictureLayerImpl* layer : active_tree()->picture_layers())
1066 total_picture_memory += layer->GetRasterSource()->GetPictureMemoryUsage(); 1094 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. 1332 // we intend to draw so it may make worse scheduling decisions.
1305 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw; 1333 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw;
1306 } 1334 }
1307 1335
1308 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const { 1336 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const {
1309 if (!sync_tree()) 1337 if (!sync_tree())
1310 return gfx::ColorSpace(); 1338 return gfx::ColorSpace();
1311 return sync_tree()->device_color_space(); 1339 return sync_tree()->device_color_space();
1312 } 1340 }
1313 1341
1342 void LayerTreeHostImpl::RequestImplSideInvalidation() {
1343 client_->NeedsImplSideInvalidation();
1344 }
1345
1314 void LayerTreeHostImpl::NotifyReadyToActivate() { 1346 void LayerTreeHostImpl::NotifyReadyToActivate() {
1315 client_->NotifyReadyToActivate(); 1347 client_->NotifyReadyToActivate();
1316 } 1348 }
1317 1349
1318 void LayerTreeHostImpl::NotifyReadyToDraw() { 1350 void LayerTreeHostImpl::NotifyReadyToDraw() {
1319 // Tiles that are ready will cause NotifyTileStateChanged() to be called so we 1351 // 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 1352 // don't need to schedule a draw here. Just stop WillBeginImplFrame() from
1321 // causing optimistic requests to draw a frame. 1353 // causing optimistic requests to draw a frame.
1322 is_likely_to_require_a_draw_ = false; 1354 is_likely_to_require_a_draw_ = false;
1323 1355
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 2051
2020 UpdateViewportContainerSizes(); 2052 UpdateViewportContainerSizes();
2021 2053
2022 active_tree_->DidBecomeActive(); 2054 active_tree_->DidBecomeActive();
2023 client_->RenewTreePriority(); 2055 client_->RenewTreePriority();
2024 // If we have any picture layers, then by activating we also modified tile 2056 // If we have any picture layers, then by activating we also modified tile
2025 // priorities. 2057 // priorities.
2026 if (!active_tree_->picture_layers().empty()) 2058 if (!active_tree_->picture_layers().empty())
2027 DidModifyTilePriorities(); 2059 DidModifyTilePriorities();
2028 2060
2061 tile_manager_.DidActivateSyncTree();
2029 client_->OnCanDrawStateChanged(CanDraw()); 2062 client_->OnCanDrawStateChanged(CanDraw());
2030 client_->DidActivateSyncTree(); 2063 client_->DidActivateSyncTree();
2031 if (!tree_activation_callback_.is_null()) 2064 if (!tree_activation_callback_.is_null())
2032 tree_activation_callback_.Run(); 2065 tree_activation_callback_.Run();
2033 2066
2034 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation = 2067 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation =
2035 active_tree_->TakePendingPageScaleAnimation(); 2068 active_tree_->TakePendingPageScaleAnimation();
2036 if (pending_page_scale_animation) { 2069 if (pending_page_scale_animation) {
2037 StartPageScaleAnimation(pending_page_scale_animation->target_offset, 2070 StartPageScaleAnimation(pending_page_scale_animation->target_offset,
2038 pending_page_scale_animation->use_anchor, 2071 pending_page_scale_animation->use_anchor,
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
4086 worker_context_visibility_ = 4119 worker_context_visibility_ =
4087 worker_context->CacheController()->ClientBecameVisible(); 4120 worker_context->CacheController()->ClientBecameVisible();
4088 } else { 4121 } else {
4089 worker_context->CacheController()->ClientBecameNotVisible( 4122 worker_context->CacheController()->ClientBecameNotVisible(
4090 std::move(worker_context_visibility_)); 4123 std::move(worker_context_visibility_));
4091 } 4124 }
4092 } 4125 }
4093 } 4126 }
4094 4127
4095 } // namespace cc 4128 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698