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

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js

Issue 2915883002: DevTools: prepare to unify Network and CPU throttling UI (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 'use strict'; 4 'use strict';
5 const fs = require('fs'); 5 const fs = require('fs');
6 const path = require('path'); 6 const path = require('path');
7 7
8 const utils = require('../utils'); 8 const utils = require('../utils');
9 9
10 const FRONTEND_PATH = path.resolve(__dirname, '..', '..', 'front_end'); 10 const FRONTEND_PATH = path.resolve(__dirname, '..', '..', 'front_end');
11 const BUILD_GN_PATH = path.resolve(__dirname, '..', '..', 'BUILD.gn'); 11 const BUILD_GN_PATH = path.resolve(__dirname, '..', '..', 'BUILD.gn');
12 const SPECIAL_CASE_NAMESPACES_PATH = path.resolve(__dirname, '..', 'special_case _namespaces.json'); 12 const SPECIAL_CASE_NAMESPACES_PATH = path.resolve(__dirname, '..', 'special_case _namespaces.json');
13 13
14 /*
15 * ==========================================
16 * START EDITING HERE - TRANSFORMATION INPUTS
17 * ==========================================
18 */
19
14 const APPLICATION_DESCRIPTORS = [ 20 const APPLICATION_DESCRIPTORS = [
15 'inspector.json', 21 'inspector.json',
16 'toolbox.json', 22 'toolbox.json',
17 'unit_test_runner.json', 23 'unit_test_runner.json',
18 'formatter_worker.json', 24 'formatter_worker.json',
19 'heap_snapshot_worker.json', 25 'heap_snapshot_worker.json',
20 'utility_shared_worker.json', 26 'utility_shared_worker.json',
21 ]; 27 ];
22 28
23 // Replace based on specified transformation 29 /*
24 const MODULES_TO_REMOVE = []; 30 * If the transformation removes all the files of a module:
31 * ['text_editor']
32 */
33 const MODULES_TO_REMOVE = ['network_conditions'];
25 34
35 /**
36 * If moving to a new module:
37 * {file: 'common/Text.js', new: 'a_new_module'}
38 *
39 * If moving to an existing module:
40 * {file: 'ui/SomeFile.js', existing: 'common'}
41 */
26 const JS_FILES_MAPPING = [ 42 const JS_FILES_MAPPING = [
27 {file: 'common/Text.js', new: 'text_utils'}, 43 {file: 'network_conditions/NetworkConditionsSelector.js', new: 'mobile_throttl ing'},
28 {file: 'common/TextUtils.js', new: 'text_utils'}, 44 {file: 'network_conditions/NetworkConditionsSettingsTab.js', new: 'mobile_thro ttling'},
29 {file: 'common/TextRange.js', new: 'text_utils'}, 45 {file: 'network_conditions/NetworkPriorities.js', new: 'mobile_throttling'},
46 {file: 'components/CPUThrottlingManager.js', new: 'mobile_throttling'},
30 ]; 47 ];
31 48
49 /**
50 * List all new modules here:
51 * mobile_throttling: {
52 * dependencies: ['sdk'],
53 * dependents: ['console'],
54 * applications: ['inspector.json'],
55 * autostart: false,
56 * }
57 */
32 const MODULE_MAPPING = { 58 const MODULE_MAPPING = {
33 text_utils: { 59 mobile_throttling: {
34 dependencies: [], 60 dependencies: ['common', 'sdk', 'ui', 'protocol'],
35 dependents: ['common'], 61 dependents: ['emulation', 'network', 'resources', 'timeline'],
36 applications: ['inspector.json'], 62 applications: ['inspector.json'],
37 autostart: true, // set to autostart because of extensions 63 autostart: true,
38 }, 64 },
39 }; 65 };
40 66
67 /**
68 * If an existing module will have a new dependency on an existing module:
69 * console: ['new_dependency']
70 */
41 const NEW_DEPENDENCIES_BY_EXISTING_MODULES = { 71 const NEW_DEPENDENCIES_BY_EXISTING_MODULES = {
42 // resources: ['components'], 72 // resources: ['components'],
43 }; 73 };
44 74
75 /**
76 * If an existing module will no longer have a dependency on a module:
77 * console: ['former_dependency']
78 */
45 const REMOVE_DEPENDENCIES_BY_EXISTING_MODULES = {}; 79 const REMOVE_DEPENDENCIES_BY_EXISTING_MODULES = {};
46 80
81 /*
82 * ==========================================
83 * STOP EDITING HERE
84 * ==========================================
85 */
86
47 const DEPENDENCIES_BY_MODULE = Object.keys(MODULE_MAPPING).reduce((acc, module) => { 87 const DEPENDENCIES_BY_MODULE = Object.keys(MODULE_MAPPING).reduce((acc, module) => {
48 acc[module] = MODULE_MAPPING[module].dependencies; 88 acc[module] = MODULE_MAPPING[module].dependencies;
49 return acc; 89 return acc;
50 }, {}); 90 }, {});
51 91
52 const APPLICATIONS_BY_MODULE = Object.keys(MODULE_MAPPING).reduce((acc, module) => { 92 const APPLICATIONS_BY_MODULE = Object.keys(MODULE_MAPPING).reduce((acc, module) => {
53 acc[module] = MODULE_MAPPING[module].applications; 93 acc[module] = MODULE_MAPPING[module].applications;
54 return acc; 94 return acc;
55 }, {}); 95 }, {});
56 96
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 return string.split('') 720 return string.split('')
681 .map(function(char) { 721 .map(function(char) {
682 var charCode = char.charCodeAt(0); 722 var charCode = char.charCodeAt(0);
683 return charCode > 127 ? unicodeCharEscape(charCode) : char; 723 return charCode > 127 ? unicodeCharEscape(charCode) : char;
684 }) 724 })
685 .join(''); 725 .join('');
686 } 726 }
687 727
688 if (require.main === module) 728 if (require.main === module)
689 extractModule(); 729 extractModule();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698