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

Side by Side Diff: chrome/browser/resources/ntp4/logging.js

Issue 8052028: NTP: Clean up of MetricsHandler class and namespacing chrome.send messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasing changes Created 9 years, 2 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /** 5 /**
6 * @fileOverview 6 * @fileOverview
7 * Logging info for benchmarking purposes. Should be the first js file included. 7 * Logging info for benchmarking purposes. Should be the first js file included.
8 */ 8 */
9 9
10 /* Stack of events that has been logged. */ 10 /* Stack of events that has been logged. */
11 var eventLog = []; 11 var eventLog = [];
12 12
13 /** 13 /**
14 * Logs an event. 14 * Logs an event.
15 * @param {String} name The name of the event (can be any string). 15 * @param {String} name The name of the event (can be any string).
16 * @param {boolean} shouldLogTime If true, the event is used for benchmarking 16 * @param {boolean} shouldLogTime If true, the event is used for benchmarking
17 * and the time is logged. Otherwise, just push the event on the event 17 * and the time is logged. Otherwise, just push the event on the event
18 * stack. 18 * stack.
19 */ 19 */
20 function logEvent(name, shouldLogTime) { 20 function logEvent(name, shouldLogTime) {
21 if (shouldLogTime) 21 if (shouldLogTime)
22 chrome.send('logEventTime', [name]); 22 chrome.send('metricsHandler:logEventTime', [name]);
23 eventLog.push([name, Date.now()]); 23 eventLog.push([name, Date.now()]);
24 } 24 }
25 25
26 logEvent('Tab.NewTabScriptStart', true); 26 logEvent('Tab.NewTabScriptStart', true);
27 window.addEventListener('load', function(e) { 27 window.addEventListener('load', function(e) {
28 logEvent('Tab.NewTabOnload', true); 28 logEvent('Tab.NewTabOnload', true);
29 }); 29 });
30 document.addEventListener('DOMContentLoaded', function(e) { 30 document.addEventListener('DOMContentLoaded', function(e) {
31 logEvent('Tab.NewTabDOMContentLoaded', true); 31 logEvent('Tab.NewTabDOMContentLoaded', true);
32 }); 32 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp/most_visited.js ('k') | chrome/browser/resources/ntp4/most_visited_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698