1<!DOCTYPE html> 2<!-- 3Copyright (c) 2015 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/base/event.html"> 9<link rel="import" href="/tracing/base/iteration_helpers.html"> 10 11<script> 12'use strict'; 13 14tr.exportTo('tr.e.chrome', function() { 15 var SAME_AS_PARENT = 'same-as-parent'; 16 17 var TITLES_FOR_USER_FRIENDLY_CATEGORY = { 18 composite: [ 19 'CompositingInputsUpdater::update', 20 'ThreadProxy::SetNeedsUpdateLayers', 21 'LayerTreeHost::UpdateLayers::CalcDrawProps', 22 'UpdateLayerTree' 23 ], 24 25 gc: [ 26 'minorGC', 27 'majorGC', 28 'MajorGC', 29 'MinorGC', 30 'V8.GCScavenger', 31 'V8.GCIncrementalMarking', 32 'V8.GCIdleNotification', 33 'V8.GCContext', 34 'V8.GCCompactor', 35 'V8GCController::traceDOMWrappers' 36 ], 37 38 iframe_creation: [ 39 'WebLocalFrameImpl::createChildframe' 40 ], 41 42 imageDecode: [ 43 'Decode Image', 44 'ImageFrameGenerator::decode', 45 'ImageFrameGenerator::decodeAndScale' 46 ], 47 48 input: [ 49 'HitTest', 50 'ScrollableArea::scrollPositionChanged', 51 'EventHandler::handleMouseMoveEvent' 52 ], 53 54 layout: [ 55 'FrameView::invalidateTree', 56 'FrameView::layout', 57 'FrameView::performLayout', 58 'FrameView::performPostLayoutTasks', 59 'FrameView::performPreLayoutTasks', 60 'Layer::updateLayerPositionsAfterLayout', 61 'Layout', 62 'LayoutView::hitTest', 63 'ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities', 64 'WebViewImpl::layout' 65 ], 66 67 parseHTML: [ 68 'ParseHTML', 69 'HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser', 70 'HTMLDocumentParser::processParsedChunkFromBackgroundParser' 71 ], 72 73 raster: [ 74 'DisplayListRasterSource::PerformSolidColorAnalysis', 75 'Picture::Raster', 76 'RasterBufferImpl::Playback', 77 'RasterTask', 78 'RasterizerTaskImpl::RunOnWorkerThread', 79 'SkCanvas::drawImageRect()', 80 'SkCanvas::drawPicture()', 81 'SkCanvas::drawTextBlob()', 82 'TileTaskWorkerPool::PlaybackToMemory' 83 ], 84 85 record: [ 86 'ContentLayerDelegate::paintContents', 87 'DeprecatedPaintLayerCompositor::updateIfNeededRecursive', 88 'DeprecatedPaintLayerCompositor::updateLayerPositionsAfterLayout', 89 'Paint', 90 'Picture::Record', 91 'PictureLayer::Update', 92 'RenderLayer::updateLayerPositionsAfterLayout' 93 ], 94 95 script: [ 96 'EvaluateScript', 97 'FunctionCall', 98 'ScheduledAction::execute', 99 'Script', 100 'V8.Execute', 101 'v8.run', 102 'v8.callModuleMethod', 103 'v8.callFunction', 104 'WindowProxy::initialize' 105 ], 106 107 style: [ 108 'CSSParserImpl::parseStyleSheet.parse', 109 'CSSParserImpl::parseStyleSheet.tokenize', 110 'Document::updateStyle', 111 'Document::updateStyleInvalidationIfNeeded', 112 'ParseAuthorStyleSheet', 113 'RuleSet::addRulesFromSheet', 114 'StyleElement::processStyleSheet', 115 'StyleEngine::createResolver', 116 'StyleSheetContents::parseAuthorStyleSheet', 117 'UpdateLayoutTree' 118 ], 119 120 script_parse_and_compile: [ 121 'V8.RecompileSynchronous', 122 'V8.RecompileConcurrent', 123 'V8.PreParseMicroSeconds', 124 'v8.parseOnBackground', 125 'V8.ParseMicroSeconds', 126 'V8.ParseLazyMicroSeconds', 127 'V8.CompileScriptMicroSeconds', 128 'V8.CompileMicroSeconds', 129 'V8.CompileFullCode', 130 'V8.CompileEvalMicroSeconds', 131 'v8.compile' 132 ], 133 134 script_parse: [ 135 'V8Test.ParseScript', 136 'V8Test.ParseFunction', 137 ], 138 139 script_compile: [ 140 'V8Test.Compile', 141 'V8Test.CompileFullCode', 142 ], 143 144 resource_loading: [ 145 'ResourceFetcher::requestResource', 146 'ResourceDispatcher::OnReceivedData', 147 'ResourceDispatcher::OnRequestComplete', 148 'ResourceDispatcher::OnReceivedResponse', 149 'Resource::appendData' 150 ], 151 152 // Where do these go? 153 renderer_misc: [ 154 'DecodeFont', 155 'ThreadState::completeSweep' // blink_gc 156 ], 157 158 [SAME_AS_PARENT]: [ 159 'SyncChannel::Send' 160 ] 161 }; 162 163 var USER_FRIENDLY_CATEGORY_FOR_TITLE = {}; 164 165 for (var category in TITLES_FOR_USER_FRIENDLY_CATEGORY) { 166 TITLES_FOR_USER_FRIENDLY_CATEGORY[category].forEach(function(title) { 167 USER_FRIENDLY_CATEGORY_FOR_TITLE[title] = category; 168 }); 169 } 170 171 var USER_FRIENDLY_CATEGORY_FOR_EVENT_CATEGORY = { 172 netlog: 'net', 173 overhead: 'overhead', 174 startup: 'startup', 175 gpu: 'gpu' 176 }; 177 178 function ChromeUserFriendlyCategoryDriver() { 179 } 180 181 ChromeUserFriendlyCategoryDriver.fromEvent = function(event) { 182 var userFriendlyCategory = USER_FRIENDLY_CATEGORY_FOR_TITLE[event.title]; 183 if (userFriendlyCategory) { 184 if (userFriendlyCategory == SAME_AS_PARENT) { 185 if (event.parentSlice) 186 return ChromeUserFriendlyCategoryDriver.fromEvent(event.parentSlice); 187 } else { 188 return userFriendlyCategory; 189 } 190 } 191 192 var eventCategoryParts = tr.b.getCategoryParts(event.category); 193 for (var i = 0; i < eventCategoryParts.length; ++i) { 194 var eventCategory = eventCategoryParts[i]; 195 userFriendlyCategory = USER_FRIENDLY_CATEGORY_FOR_EVENT_CATEGORY[ 196 eventCategory]; 197 if (userFriendlyCategory) 198 return userFriendlyCategory; 199 } 200 201 return undefined; 202 }; 203 204 return { 205 ChromeUserFriendlyCategoryDriver: ChromeUserFriendlyCategoryDriver 206 }; 207}); 208</script> 209