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

Side by Side Diff: chrome/browser/resources/task_manager/includes.js

Issue 8713016: WebUI TaskManager: Optimize initialization taskmanager and loading scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: avoid polling #2 Created 9 years 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 // This script includes additional resources via document.write(). Hence, it 5 // This script loads additional scripts after initialize of task manager.
mazda 2011/12/05 03:42:11 initialize -> initialization
yoshiki 2011/12/05 08:38:15 Done.
6 // must be a separate script file loaded before other scripts which would
7 // reference the resources.
8
9 var css = [
10 'chrome_shared.css',
11 'list.css',
12 'table.css',
13 'menu.css',
14 'button.css',
15 ];
16 6
17 var script = [ 7 var script = [
18 'local_strings.js',
19 'i18n_template.js',
20
21 'util.js',
22 'cr.js',
23 'cr/ui.js',
24 'cr/event_target.js',
25 'cr/ui/array_data_model.js',
26 'cr/ui/list_item.js',
27 'cr/ui/list_selection_model.js',
28 'cr/ui/list_single_selection_model.js',
29 'cr/ui/list_selection_controller.js',
30 'cr/ui/list.js',
31
32 'cr/ui/splitter.js',
33 'cr/ui/table/table_splitter.js',
34
35 'cr/ui/table/table_column.js',
36 'cr/ui/table/table_column_model.js',
37 'cr/ui/table/table_header.js',
38 'cr/ui/table/table_list.js',
39 'cr/ui/table.js',
40
41 'cr/ui/grid.js',
42
43 'cr/ui/command.js', 8 'cr/ui/command.js',
44 'cr/ui/position_util.js', 9 'cr/ui/position_util.js',
45 'cr/ui/menu_item.js', 10 'cr/ui/menu_item.js',
46 'cr/ui/menu.js', 11 'cr/ui/menu.js',
47 'cr/ui/context_menu_handler.js', 12 'cr/ui/context_menu_handler.js',
48 ]; 13 ];
49 14
50 (function() { 15 /**
16 * Loads delayed scripts.
17 * This function is called by TaskManager::initalize() in main.js.
18 */
19 function loadDelayedIncludes(taskmanager) {
51 // Switch to 'test harness' mode when loading from a file url. 20 // Switch to 'test harness' mode when loading from a file url.
52 var isHarness = document.location.protocol == 'file:'; 21 var isHarness = document.location.protocol == 'file:';
53 22
54 // In test harness mode we load resources from relative dirs. 23 // In test harness mode we load resources from relative dirs.
55 var prefix = isHarness ? './shared/' : 'chrome://resources/'; 24 var prefix = isHarness ? './shared/' : 'chrome://resources/';
56 25
57 for (var i = 0; i < css.length; ++i) { 26 var isLoading = script.length;
mazda 2011/12/05 03:42:11 Please rename |isLoading| to something that repres
yoshiki 2011/12/05 08:38:15 Done.
58 document.write('<link href="' + prefix + 'css/' + css[i] + 27
59 '" rel="stylesheet"></link>'); 28 // Waits for initialization of task manager.
29 for (var i = 0; i < script.length; ++i) {
30 var s = document.createElement('script');
31 s.onload = function(e) {
32 if (!--isLoading)
33 taskmanager.delayedInitialize();
34 };
35 s.type = 'text/javascript';
36 s.src = prefix + 'js/' + script[i];
37 s.defer = 'defer';
38 document.body.appendChild(s);
60 } 39 }
61 40 }
62 for (var i = 0; i < script.length; ++i) {
63 document.write('<script src="' + prefix + 'js/' + script[i] +
64 '"><\/script>');
65 }
66 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698