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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: comments Created 6 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 Rasterizer* rasterizer, 232 Rasterizer* rasterizer,
233 RenderingStatsInstrumentation* rendering_stats_instrumentation, 233 RenderingStatsInstrumentation* rendering_stats_instrumentation,
234 size_t scheduled_raster_task_limit) 234 size_t scheduled_raster_task_limit)
235 : client_(client), 235 : client_(client),
236 task_runner_(task_runner), 236 task_runner_(task_runner),
237 resource_pool_(resource_pool), 237 resource_pool_(resource_pool),
238 rasterizer_(rasterizer), 238 rasterizer_(rasterizer),
239 scheduled_raster_task_limit_(scheduled_raster_task_limit), 239 scheduled_raster_task_limit_(scheduled_raster_task_limit),
240 all_tiles_that_need_to_be_rasterized_are_scheduled_(true), 240 all_tiles_that_need_to_be_rasterized_are_scheduled_(true),
241 rendering_stats_instrumentation_(rendering_stats_instrumentation), 241 rendering_stats_instrumentation_(rendering_stats_instrumentation),
242 did_initialize_visible_tile_(false),
243 did_check_for_completed_tasks_since_last_schedule_tasks_(true), 242 did_check_for_completed_tasks_since_last_schedule_tasks_(true),
244 did_oom_on_last_assign_(false), 243 did_oom_on_last_assign_(false),
245 ready_to_activate_check_notifier_( 244 ready_to_activate_check_notifier_(
246 task_runner_.get(), 245 task_runner_.get(),
247 base::Bind(&TileManager::CheckIfReadyToActivate, 246 base::Bind(&TileManager::CheckIfReadyToActivate,
248 base::Unretained(this))), 247 base::Unretained(this))),
249 ready_to_draw_check_notifier_(task_runner_.get(), 248 ready_to_draw_check_notifier_(task_runner_.get(),
250 base::Bind(&TileManager::CheckIfReadyToDraw, 249 base::Bind(&TileManager::CheckIfReadyToDraw,
251 base::Unretained(this))) { 250 base::Unretained(this))) {
252 rasterizer_->SetClient(this); 251 rasterizer_->SetClient(this);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 "state", 434 "state",
436 BasicStateAsValue()); 435 BasicStateAsValue());
437 436
438 TRACE_COUNTER_ID1("cc", 437 TRACE_COUNTER_ID1("cc",
439 "unused_memory_bytes", 438 "unused_memory_bytes",
440 this, 439 this,
441 resource_pool_->total_memory_usage_bytes() - 440 resource_pool_->total_memory_usage_bytes() -
442 resource_pool_->acquired_memory_usage_bytes()); 441 resource_pool_->acquired_memory_usage_bytes());
443 } 442 }
444 443
445 bool TileManager::UpdateVisibleTiles() { 444 void TileManager::UpdateVisibleTiles() {
446 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles"); 445 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles");
447 446
448 rasterizer_->CheckForCompletedTasks(); 447 rasterizer_->CheckForCompletedTasks();
449 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 448 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
450 449
451 TRACE_EVENT_INSTANT1( 450 TRACE_EVENT_INSTANT1(
452 "cc", 451 "cc",
453 "DidUpdateVisibleTiles", 452 "DidUpdateVisibleTiles",
454 TRACE_EVENT_SCOPE_THREAD, 453 TRACE_EVENT_SCOPE_THREAD,
455 "stats", 454 "stats",
456 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_)); 455 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_));
457 update_visible_tiles_stats_ = RasterTaskCompletionStats(); 456 update_visible_tiles_stats_ = RasterTaskCompletionStats();
458
459 bool did_initialize_visible_tile = did_initialize_visible_tile_;
460 did_initialize_visible_tile_ = false;
461 return did_initialize_visible_tile;
462 } 457 }
463 458
464 scoped_refptr<base::debug::ConvertableToTraceFormat> 459 scoped_refptr<base::debug::ConvertableToTraceFormat>
465 TileManager::BasicStateAsValue() const { 460 TileManager::BasicStateAsValue() const {
466 scoped_refptr<base::debug::TracedValue> value = 461 scoped_refptr<base::debug::TracedValue> value =
467 new base::debug::TracedValue(); 462 new base::debug::TracedValue();
468 BasicStateAsValueInto(value.get()); 463 BasicStateAsValueInto(value.get());
469 return value; 464 return value;
470 } 465 }
471 466
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 ++update_visible_tiles_stats_.completed_count; 824 ++update_visible_tiles_stats_.completed_count;
830 825
831 if (analysis.is_solid_color) { 826 if (analysis.is_solid_color) {
832 mts.draw_info.set_solid_color(analysis.solid_color); 827 mts.draw_info.set_solid_color(analysis.solid_color);
833 resource_pool_->ReleaseResource(resource.Pass()); 828 resource_pool_->ReleaseResource(resource.Pass());
834 } else { 829 } else {
835 mts.draw_info.set_use_resource(); 830 mts.draw_info.set_use_resource();
836 mts.draw_info.resource_ = resource.Pass(); 831 mts.draw_info.resource_ = resource.Pass();
837 } 832 }
838 833
839 if (tile->priority(ACTIVE_TREE).distance_to_visible == 0.f)
840 did_initialize_visible_tile_ = true;
841
842 client_->NotifyTileStateChanged(tile); 834 client_->NotifyTileStateChanged(tile);
843 } 835 }
844 836
845 scoped_refptr<Tile> TileManager::CreateTile(RasterSource* raster_source, 837 scoped_refptr<Tile> TileManager::CreateTile(RasterSource* raster_source,
846 const gfx::Size& tile_size, 838 const gfx::Size& tile_size,
847 const gfx::Rect& content_rect, 839 const gfx::Rect& content_rect,
848 float contents_scale, 840 float contents_scale,
849 int layer_id, 841 int layer_id,
850 int source_frame_number, 842 int source_frame_number,
851 int flags) { 843 int flags) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 result -= other; 951 result -= other;
960 return result; 952 return result;
961 } 953 }
962 954
963 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 955 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
964 return memory_bytes_ > limit.memory_bytes_ || 956 return memory_bytes_ > limit.memory_bytes_ ||
965 resource_count_ > limit.resource_count_; 957 resource_count_ > limit.resource_count_;
966 } 958 }
967 959
968 } // namespace cc 960 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698