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

Side by Side Diff: chrome/browser/resources/file_manager/js/main.js

Issue 8490014: [filebrowser] Historgram for the file browser's open time. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added comments Created 9 years, 1 month 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 * Global fileManager reference useful for poking at from the console. 6 * Global fileManager reference useful for poking at from the console.
7 */ 7 */
8 var fileManager; 8 var fileManager;
9 9
10 /** 10 /**
11 * Kick off the file manager dialog. 11 * Kick off the file manager dialog.
12 * 12 *
13 * Called by main.html after the dom has been parsed. 13 * Called by main.html after the dom has been parsed.
14 */ 14 */
15 function init() { 15 function init() {
16 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp']; 16 var rootPaths = ['Downloads', 'removable', 'archive', 'tmp'];
17 17
18 function onEntriesFound(filesystem, entries) { 18 function onEntriesFound(filesystem, entries) {
19 metrics.recordTime('EnumerateRoots');
19 FileManager.initStrings(function () { 20 FileManager.initStrings(function () {
21 metrics.startInterval('Construct');
20 fileManager = new FileManager(document.body, filesystem, entries); 22 fileManager = new FileManager(document.body, filesystem, entries);
23 metrics.recordTime('Construct');
24 metrics.recordTime('TotalLoad');
21 // We're ready to run. Tests can monitor for this state with 25 // We're ready to run. Tests can monitor for this state with
22 // ExtensionTestMessageListener listener("ready"); 26 // ExtensionTestMessageListener listener("ready");
23 // ASSERT_TRUE(listener.WaitUntilSatisfied()); 27 // ASSERT_TRUE(listener.WaitUntilSatisfied());
24 chrome.test.sendMessage('ready'); 28 chrome.test.sendMessage('ready');
25 }); 29 });
26 } 30 }
27 31
28 function onFileSystemFound(filesystem) { 32 function onFileSystemFound(filesystem) {
33 metrics.recordTime('RequestLocalFileSystem');
29 console.log('Found filesystem: ' + filesystem.name, filesystem); 34 console.log('Found filesystem: ' + filesystem.name, filesystem);
30 35
31 var entries = []; 36 var entries = [];
32 37
33 function onPathError(path, err) { 38 function onPathError(path, err) {
34 console.error('Error locating root path: ' + path + ': ' + err); 39 console.error('Error locating root path: ' + path + ': ' + err);
35 } 40 }
36 41
37 function onEntryFound(entry) { 42 function onEntryFound(entry) {
38 if (entry) { 43 if (entry) {
39 entries.push(entry); 44 entries.push(entry);
40 } else { 45 } else {
41 onEntriesFound(filesystem, entries); 46 onEntriesFound(filesystem, entries);
42 } 47 }
43 } 48 }
44 49
50 metrics.startInterval('EnumerateRoots');
45 if (filesystem.name.match(/^chrome-extension_\S+:external/i)) { 51 if (filesystem.name.match(/^chrome-extension_\S+:external/i)) {
46 // We've been handed the local filesystem, whose root directory 52 // We've been handed the local filesystem, whose root directory
47 // cannot be enumerated. 53 // cannot be enumerated.
48 util.getDirectories(filesystem.root, {create: false}, rootPaths, 54 util.getDirectories(filesystem.root, {create: false}, rootPaths,
49 onEntryFound, onPathError); 55 onEntryFound, onPathError);
50 } else { 56 } else {
51 util.forEachDirEntry(filesystem.root, onEntryFound); 57 util.forEachDirEntry(filesystem.root, onEntryFound);
52 } 58 }
53 }; 59 };
54 60
55 util.installFileErrorToString(); 61 util.installFileErrorToString();
56 62
57 console.log('Requesting filesystem.'); 63 console.log('Requesting filesystem.');
58 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound); 64 metrics.startInterval('RequestLocalFileSystem');
65 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFound);
59 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_manager.js ('k') | chrome/browser/resources/file_manager/js/metrics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698