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

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

Issue 380763002: 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
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"
12 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "cc/debug/devtools_instrumentation.h" 16 #include "cc/debug/devtools_instrumentation.h"
16 #include "cc/debug/frame_viewer_instrumentation.h" 17 #include "cc/debug/frame_viewer_instrumentation.h"
17 #include "cc/debug/traced_value.h" 18 #include "cc/debug/traced_value.h"
18 #include "cc/layers/picture_layer_impl.h" 19 #include "cc/layers/picture_layer_impl.h"
19 #include "cc/resources/raster_worker_pool.h" 20 #include "cc/resources/raster_worker_pool.h"
20 #include "cc/resources/tile.h" 21 #include "cc/resources/tile.h"
21 #include "skia/ext/paint_simplifier.h" 22 #include "skia/ext/paint_simplifier.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 AssignGpuMemoryToTiles(&prioritized_tiles_, 661 AssignGpuMemoryToTiles(&prioritized_tiles_,
661 &tiles_that_need_to_be_rasterized); 662 &tiles_that_need_to_be_rasterized);
662 663
663 // Finally, schedule rasterizer tasks. 664 // Finally, schedule rasterizer tasks.
664 ScheduleTasks(tiles_that_need_to_be_rasterized); 665 ScheduleTasks(tiles_that_need_to_be_rasterized);
665 666
666 TRACE_EVENT_INSTANT1("cc", 667 TRACE_EVENT_INSTANT1("cc",
667 "DidManage", 668 "DidManage",
668 TRACE_EVENT_SCOPE_THREAD, 669 TRACE_EVENT_SCOPE_THREAD,
669 "state", 670 "state",
670 TracedValue::FromValue(BasicStateAsValue().release())); 671 BasicStateAsValue());
671 672
672 TRACE_COUNTER_ID1("cc", 673 TRACE_COUNTER_ID1("cc",
673 "unused_memory_bytes", 674 "unused_memory_bytes",
674 this, 675 this,
675 resource_pool_->total_memory_usage_bytes() - 676 resource_pool_->total_memory_usage_bytes() -
676 resource_pool_->acquired_memory_usage_bytes()); 677 resource_pool_->acquired_memory_usage_bytes());
677 } 678 }
678 679
679 bool TileManager::UpdateVisibleTiles() { 680 bool TileManager::UpdateVisibleTiles() {
680 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles"); 681 TRACE_EVENT0("cc", "TileManager::UpdateVisibleTiles");
681 682
682 rasterizer_->CheckForCompletedTasks(); 683 rasterizer_->CheckForCompletedTasks();
683 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 684 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
684 685
685 TRACE_EVENT_INSTANT1( 686 TRACE_EVENT_INSTANT1(
686 "cc", 687 "cc",
687 "DidUpdateVisibleTiles", 688 "DidUpdateVisibleTiles",
688 TRACE_EVENT_SCOPE_THREAD, 689 TRACE_EVENT_SCOPE_THREAD,
689 "stats", 690 "stats",
690 TracedValue::FromValue(RasterTaskCompletionStatsAsValue( 691 TracedValue::FromValue(RasterTaskCompletionStatsAsValue(
691 update_visible_tiles_stats_).release())); 692 update_visible_tiles_stats_).release()));
692 update_visible_tiles_stats_ = RasterTaskCompletionStats(); 693 update_visible_tiles_stats_ = RasterTaskCompletionStats();
693 694
694 bool did_initialize_visible_tile = did_initialize_visible_tile_; 695 bool did_initialize_visible_tile = did_initialize_visible_tile_;
695 did_initialize_visible_tile_ = false; 696 did_initialize_visible_tile_ = false;
696 return did_initialize_visible_tile; 697 return did_initialize_visible_tile;
697 } 698 }
698 699
699 scoped_ptr<base::Value> TileManager::BasicStateAsValue() const { 700 scoped_refptr<base::debug::ConvertableToTraceFormat>
700 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 701 TileManager::BasicStateAsValue() const {
701 state->SetInteger("tile_count", tiles_.size()); 702 scoped_refptr<base::debug::TracedValue> value =
702 state->Set("global_state", global_state_.AsValue().release()); 703 new base::debug::TracedValue();
703 return state.PassAs<base::Value>(); 704 BasicStateAsValueInto(value.get());
705 return value;
704 } 706 }
705 707
706 scoped_ptr<base::Value> TileManager::AllTilesAsValue() const { 708 void TileManager::BasicStateAsValueInto(base::debug::TracedValue* state) const {
707 scoped_ptr<base::ListValue> state(new base::ListValue()); 709 state->SetInteger("tile_count", tiles_.size());
708 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) 710 state->BeginDictionary("global_state");
709 state->Append(it->second->AsValue().release()); 711 global_state_.AsValueInto(state);
712 state->EndDictionary();
713 }
710 714
711 return state.PassAs<base::Value>(); 715 void TileManager::AllTilesAsValueInto(base::debug::TracedValue* state) const {
716 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
717 state->BeginDictionary();
718 it->second->AsValueInto(state);
719 state->EndDictionary();
720 }
712 } 721 }
713 722
714 void TileManager::AssignGpuMemoryToTiles( 723 void TileManager::AssignGpuMemoryToTiles(
715 PrioritizedTileSet* tiles, 724 PrioritizedTileSet* tiles,
716 TileVector* tiles_that_need_to_be_rasterized) { 725 TileVector* tiles_that_need_to_be_rasterized) {
717 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); 726 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles");
718 727
719 // Maintain the list of released resources that can potentially be re-used 728 // Maintain the list of released resources that can potentially be re-used
720 // or deleted. 729 // or deleted.
721 // If this operation becomes expensive too, only do this after some 730 // If this operation becomes expensive too, only do this after some
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); 1167 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate");
1159 1168
1160 rasterizer_->CheckForCompletedTasks(); 1169 rasterizer_->CheckForCompletedTasks();
1161 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 1170 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
1162 1171
1163 if (IsReadyToActivate()) 1172 if (IsReadyToActivate())
1164 client_->NotifyReadyToActivate(); 1173 client_->NotifyReadyToActivate();
1165 } 1174 }
1166 1175
1167 } // namespace cc 1176 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698