1<!DOCTYPE html> 2<!-- 3Copyright (c) 2013 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<link rel="import" href="/tracing/base/base.html"> 8<script> 9'use strict'; 10 11/** 12 * @fileoverview Helper code for working with tracing categories. 13 * 14 */ 15tr.exportTo('tr.b', function() { 16 17 // Cached values for getCategoryParts. 18 var categoryPartsFor = {}; 19 20 /** 21 * Categories are stored in comma-separated form, e.g: 'a,b' meaning 22 * that the event is part of the a and b category. 23 * 24 * This function returns the category split by string, caching the 25 * array for performance. 26 * 27 * Do not mutate the returned array!!!! 28 */ 29 function getCategoryParts(category) { 30 var parts = categoryPartsFor[category]; 31 if (parts !== undefined) 32 return parts; 33 parts = category.split(','); 34 categoryPartsFor[category] = parts; 35 return parts; 36 } 37 38 return { 39 getCategoryParts: getCategoryParts 40 }; 41}); 42</script> 43