| <!DOCTYPE HTML> |
| <!-- |
| Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| <link rel="import" href="/perf_insights/value/value.html"> |
| <link rel="import" href="/perf_insights/map_function.html"> |
| <link rel="import" href="/tracing/base/range.html"> |
| <link rel="import" href="/tracing/extras/chrome/chrome_browser_helper.html"> |
| <link rel="import" href="/tracing/extras/chrome/chrome_renderer_helper.html"> |
| |
| <script> |
| tr.exportTo('pie', function() { |
| function mapStartupInfo(results, run_info, model) { |
| var startupIRs = model.interaction_records.filter(function(ir) { |
| return ir instanceof tr.e.rail.LoadInteractionRecord && |
| ir.name === 'Startup'; |
| }); |
| // Find the Startup IRs in the browser and renderer processes. |
| var ChromeBrowserHelper = tr.e.audits.ChromeBrowserHelper; |
| var ChromeRendererHelper = tr.e.audits.ChromeRendererHelper; |
| var browser_startup = new tr.b.Range(); |
| var renderer_startup = new tr.b.Range(); |
| startupIRs.forEach(function(ir) { |
| ir.associatedEvents.toArray().forEach(function(event) { |
| if (!event.getProcess) |
| return; |
| var process = event.getProcess(); |
| var end = event.start + event.duration; |
| if (ChromeBrowserHelper.isBrowserProcess(process)) |
| event.addBoundsToRange(browser_startup); |
| if (ChromeRendererHelper.isRenderProcess(process)) |
| event.addBoundsToRange(renderer_startup); |
| }); |
| }); |
| |
| if (browser_startup.isEmpty && renderer_startup.isEmpty) { |
| results.addValue(new pi.v.SkipValue(run_info, 'startup_info')); |
| } else { |
| results.addValue(new pi.v.DictValue( |
| run_info, |
| 'startup_info', |
| { |
| 'browserStartup': browser_startup, |
| 'rendererStartup': renderer_startup |
| })); |
| } |
| } |
| |
| pi.MapFunction.register(mapStartupInfo); |
| |
| // Exporting for tests. |
| return { |
| mapStartupInfo: mapStartupInfo |
| }; |
| }); |
| </script> |