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

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

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Rasterizer* rasterizer, 226 Rasterizer* rasterizer,
227 RenderingStatsInstrumentation* rendering_stats_instrumentation, 227 RenderingStatsInstrumentation* rendering_stats_instrumentation,
228 size_t scheduled_raster_task_limit) 228 size_t scheduled_raster_task_limit)
229 : client_(client), 229 : client_(client),
230 task_runner_(task_runner), 230 task_runner_(task_runner),
231 resource_pool_(resource_pool), 231 resource_pool_(resource_pool),
232 rasterizer_(rasterizer), 232 rasterizer_(rasterizer),
233 scheduled_raster_task_limit_(scheduled_raster_task_limit), 233 scheduled_raster_task_limit_(scheduled_raster_task_limit),
234 all_tiles_that_need_to_be_rasterized_are_scheduled_(true), 234 all_tiles_that_need_to_be_rasterized_are_scheduled_(true),
235 rendering_stats_instrumentation_(rendering_stats_instrumentation), 235 rendering_stats_instrumentation_(rendering_stats_instrumentation),
236 did_initialize_visible_tile_(false),
237 did_check_for_completed_tasks_since_last_schedule_tasks_(true), 236 did_check_for_completed_tasks_since_last_schedule_tasks_(true),
238 did_oom_on_last_assign_(false), 237 did_oom_on_last_assign_(false),
239 ready_to_activate_check_notifier_( 238 ready_to_activate_check_notifier_(
240 task_runner_.get(), 239 task_runner_.get(),
241 base::Bind(&TileManager::CheckIfReadyToActivate, 240 base::Bind(&TileManager::CheckIfReadyToActivate,
242 base::Unretained(this))), 241 base::Unretained(this))),
243 ready_to_draw_check_notifier_(task_runner_.get(), 242 ready_to_draw_check_notifier_(task_runner_.get(),
244 base::Bind(&TileManager::CheckIfReadyToDraw, 243 base::Bind(&TileManager::CheckIfReadyToDraw,
245 base::Unretained(this))) { 244 base::Unretained(this))) {
246 rasterizer_->SetClient(this); 245 rasterizer_->SetClient(this);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 "state", 425 "state",
427 BasicStateAsValue()); 426 BasicStateAsValue());
428 427
429 TRACE_COUNTER_ID1("cc", 428 TRACE_COUNTER_ID1("cc",
430 "unused_memory_bytes", 429 "unused_memory_bytes",
431 this, 430 this,
432 resource_pool_->total_memory_usage_bytes() - 431 resource_pool_->total_memory_usage_bytes() -
433 resource_pool_->acquired_memory_usage_bytes()); 432 resource_pool_->acquired_memory_usage_bytes());
434 } 433 }
435 434
436 bool TileManager::UpdateVisibleTiles() { 435 void TileManager::UpdateVisibleTiles() {
437 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles"); 436 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles");
438 437
439 rasterizer_->CheckForCompletedTasks(); 438 rasterizer_->CheckForCompletedTasks();
440 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 439 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
441 440
442 TRACE_EVENT_INSTANT1( 441 TRACE_EVENT_INSTANT1(
443 "cc", 442 "cc",
444 "DidUpdateVisibleTiles", 443 "DidUpdateVisibleTiles",
445 TRACE_EVENT_SCOPE_THREAD, 444 TRACE_EVENT_SCOPE_THREAD,
446 "stats", 445 "stats",
447 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_)); 446 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_));
448 update_visible_tiles_stats_ = RasterTaskCompletionStats(); 447 update_visible_tiles_stats_ = RasterTaskCompletionStats();
449
450 bool did_initialize_visible_tile = did_initialize_visible_tile_;
451 did_initialize_visible_tile_ = false;
452 return did_initialize_visible_tile;
453 } 448 }
454 449
455 scoped_refptr<base::debug::ConvertableToTraceFormat> 450 scoped_refptr<base::debug::ConvertableToTraceFormat>
456 TileManager::BasicStateAsValue() const { 451 TileManager::BasicStateAsValue() const {
457 scoped_refptr<base::debug::TracedValue> value = 452 scoped_refptr<base::debug::TracedValue> value =
458 new base::debug::TracedValue(); 453 new base::debug::TracedValue();
459 BasicStateAsValueInto(value.get()); 454 BasicStateAsValueInto(value.get());
460 return value; 455 return value;
461 } 456 }
462 457
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 ++update_visible_tiles_stats_.completed_count; 816 ++update_visible_tiles_stats_.completed_count;
822 817
823 if (analysis.is_solid_color) { 818 if (analysis.is_solid_color) {
824 mts.draw_info.set_solid_color(analysis.solid_color); 819 mts.draw_info.set_solid_color(analysis.solid_color);
825 resource_pool_->ReleaseResource(resource.Pass()); 820 resource_pool_->ReleaseResource(resource.Pass());
826 } else { 821 } else {
827 mts.draw_info.set_use_resource(); 822 mts.draw_info.set_use_resource();
828 mts.draw_info.resource_ = resource.Pass(); 823 mts.draw_info.resource_ = resource.Pass();
829 } 824 }
830 825
831 if (tile->priority(ACTIVE_TREE).distance_to_visible == 0.f)
832 did_initialize_visible_tile_ = true;
833
834 client_->NotifyTileStateChanged(tile); 826 client_->NotifyTileStateChanged(tile);
835 } 827 }
836 828
837 scoped_refptr<Tile> TileManager::CreateTile(RasterSource* raster_source, 829 scoped_refptr<Tile> TileManager::CreateTile(RasterSource* raster_source,
838 const gfx::Size& tile_size, 830 const gfx::Size& tile_size,
839 const gfx::Rect& content_rect, 831 const gfx::Rect& content_rect,
840 float contents_scale, 832 float contents_scale,
841 int layer_id, 833 int layer_id,
842 int source_frame_number, 834 int source_frame_number,
843 int flags) { 835 int flags) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 result -= other; 940 result -= other;
949 return result; 941 return result;
950 } 942 }
951 943
952 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 944 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
953 return memory_bytes_ > limit.memory_bytes_ || 945 return memory_bytes_ > limit.memory_bytes_ ||
954 resource_count_ > limit.resource_count_; 946 resource_count_ > limit.resource_count_;
955 } 947 }
956 948
957 } // namespace cc 949 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698