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

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

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_priority.h » ('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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/debug/trace_event_argument.h"
13 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
16 #include "cc/debug/devtools_instrumentation.h" 15 #include "cc/debug/devtools_instrumentation.h"
17 #include "cc/debug/frame_viewer_instrumentation.h" 16 #include "cc/debug/frame_viewer_instrumentation.h"
18 #include "cc/debug/traced_value.h" 17 #include "cc/debug/traced_value.h"
19 #include "cc/layers/picture_layer_impl.h" 18 #include "cc/layers/picture_layer_impl.h"
20 #include "cc/resources/raster_worker_pool.h" 19 #include "cc/resources/raster_worker_pool.h"
21 #include "cc/resources/tile.h" 20 #include "cc/resources/tile.h"
22 #include "skia/ext/paint_simplifier.h" 21 #include "skia/ext/paint_simplifier.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return NEVER_BIN; 329 return NEVER_BIN;
331 330
332 return EVENTUALLY_BIN; 331 return EVENTUALLY_BIN;
333 } 332 }
334 333
335 } // namespace 334 } // namespace
336 335
337 RasterTaskCompletionStats::RasterTaskCompletionStats() 336 RasterTaskCompletionStats::RasterTaskCompletionStats()
338 : completed_count(0u), canceled_count(0u) {} 337 : completed_count(0u), canceled_count(0u) {}
339 338
340 scoped_refptr<base::debug::ConvertableToTraceFormat> 339 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue(
341 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats) { 340 const RasterTaskCompletionStats& stats) {
342 scoped_refptr<base::debug::TracedValue> state = 341 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
343 new base::debug::TracedValue();
344 state->SetInteger("completed_count", stats.completed_count); 342 state->SetInteger("completed_count", stats.completed_count);
345 state->SetInteger("canceled_count", stats.canceled_count); 343 state->SetInteger("canceled_count", stats.canceled_count);
346 return state; 344 return state.PassAs<base::Value>();
347 } 345 }
348 346
349 // static 347 // static
350 scoped_ptr<TileManager> TileManager::Create( 348 scoped_ptr<TileManager> TileManager::Create(
351 TileManagerClient* client, 349 TileManagerClient* client,
352 base::SequencedTaskRunner* task_runner, 350 base::SequencedTaskRunner* task_runner,
353 ResourcePool* resource_pool, 351 ResourcePool* resource_pool,
354 Rasterizer* rasterizer, 352 Rasterizer* rasterizer,
355 RenderingStatsInstrumentation* rendering_stats_instrumentation) { 353 RenderingStatsInstrumentation* rendering_stats_instrumentation) {
356 return make_scoped_ptr(new TileManager(client, 354 return make_scoped_ptr(new TileManager(client,
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 AssignGpuMemoryToTiles(&prioritized_tiles_, 660 AssignGpuMemoryToTiles(&prioritized_tiles_,
663 &tiles_that_need_to_be_rasterized); 661 &tiles_that_need_to_be_rasterized);
664 662
665 // Finally, schedule rasterizer tasks. 663 // Finally, schedule rasterizer tasks.
666 ScheduleTasks(tiles_that_need_to_be_rasterized); 664 ScheduleTasks(tiles_that_need_to_be_rasterized);
667 665
668 TRACE_EVENT_INSTANT1("cc", 666 TRACE_EVENT_INSTANT1("cc",
669 "DidManage", 667 "DidManage",
670 TRACE_EVENT_SCOPE_THREAD, 668 TRACE_EVENT_SCOPE_THREAD,
671 "state", 669 "state",
672 BasicStateAsValue()); 670 TracedValue::FromValue(BasicStateAsValue().release()));
673 671
674 TRACE_COUNTER_ID1("cc", 672 TRACE_COUNTER_ID1("cc",
675 "unused_memory_bytes", 673 "unused_memory_bytes",
676 this, 674 this,
677 resource_pool_->total_memory_usage_bytes() - 675 resource_pool_->total_memory_usage_bytes() -
678 resource_pool_->acquired_memory_usage_bytes()); 676 resource_pool_->acquired_memory_usage_bytes());
679 } 677 }
680 678
681 bool TileManager::UpdateVisibleTiles() { 679 bool TileManager::UpdateVisibleTiles() {
682 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles"); 680 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles");
683 681
684 rasterizer_->CheckForCompletedTasks(); 682 rasterizer_->CheckForCompletedTasks();
685 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 683 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
686 684
687 TRACE_EVENT_INSTANT1( 685 TRACE_EVENT_INSTANT1(
688 "cc", 686 "cc",
689 "DidUpdateVisibleTiles", 687 "DidUpdateVisibleTiles",
690 TRACE_EVENT_SCOPE_THREAD, 688 TRACE_EVENT_SCOPE_THREAD,
691 "stats", 689 "stats",
692 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_)); 690 TracedValue::FromValue(RasterTaskCompletionStatsAsValue(
691 update_visible_tiles_stats_).release()));
693 update_visible_tiles_stats_ = RasterTaskCompletionStats(); 692 update_visible_tiles_stats_ = RasterTaskCompletionStats();
694 693
695 bool did_initialize_visible_tile = did_initialize_visible_tile_; 694 bool did_initialize_visible_tile = did_initialize_visible_tile_;
696 did_initialize_visible_tile_ = false; 695 did_initialize_visible_tile_ = false;
697 return did_initialize_visible_tile; 696 return did_initialize_visible_tile;
698 } 697 }
699 698
700 scoped_refptr<base::debug::ConvertableToTraceFormat> 699 scoped_ptr<base::Value> TileManager::BasicStateAsValue() const {
701 TileManager::BasicStateAsValue() const { 700 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
702 scoped_refptr<base::debug::TracedValue> value = 701 state->SetInteger("tile_count", tiles_.size());
703 new base::debug::TracedValue(); 702 state->Set("global_state", global_state_.AsValue().release());
704 BasicStateAsValueInto(value.get()); 703 return state.PassAs<base::Value>();
705 return value;
706 } 704 }
707 705
708 void TileManager::BasicStateAsValueInto(base::debug::TracedValue* state) const { 706 scoped_ptr<base::Value> TileManager::AllTilesAsValue() const {
709 state->SetInteger("tile_count", tiles_.size()); 707 scoped_ptr<base::ListValue> state(new base::ListValue());
710 state->BeginDictionary("global_state"); 708 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
711 global_state_.AsValueInto(state); 709 state->Append(it->second->AsValue().release());
712 state->EndDictionary();
713 }
714 710
715 void TileManager::AllTilesAsValueInto(base::debug::TracedValue* state) const { 711 return state.PassAs<base::Value>();
716 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
717 state->BeginDictionary();
718 it->second->AsValueInto(state);
719 state->EndDictionary();
720 }
721 } 712 }
722 713
723 void TileManager::AssignGpuMemoryToTiles( 714 void TileManager::AssignGpuMemoryToTiles(
724 PrioritizedTileSet* tiles, 715 PrioritizedTileSet* tiles,
725 TileVector* tiles_that_need_to_be_rasterized) { 716 TileVector* tiles_that_need_to_be_rasterized) {
726 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); 717 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles");
727 718
728 // Maintain the list of released resources that can potentially be re-used 719 // Maintain the list of released resources that can potentially be re-used
729 // or deleted. 720 // or deleted.
730 // If this operation becomes expensive too, only do this after some 721 // If this operation becomes expensive too, only do this after some
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); 1158 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate");
1168 1159
1169 rasterizer_->CheckForCompletedTasks(); 1160 rasterizer_->CheckForCompletedTasks();
1170 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 1161 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
1171 1162
1172 if (IsReadyToActivate()) 1163 if (IsReadyToActivate())
1173 client_->NotifyReadyToActivate(); 1164 client_->NotifyReadyToActivate();
1174 } 1165 }
1175 1166
1176 } // namespace cc 1167 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_priority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698