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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/Runtime.js

Issue 2608043002: DevTools: extract modules (with extensions) (Closed)
Patch Set: refactor py Created 3 years, 11 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return Promise.all(promises).then(undefined); 765 return Promise.all(promises).then(undefined);
766 } 766 }
767 767
768 /** 768 /**
769 * @return {!Promise.<undefined>} 769 * @return {!Promise.<undefined>}
770 */ 770 */
771 _loadScripts() { 771 _loadScripts() {
772 if (!this._descriptor.scripts || !this._descriptor.scripts.length) 772 if (!this._descriptor.scripts || !this._descriptor.scripts.length)
773 return Promise.resolve(); 773 return Promise.resolve();
774 774
775 // Module namespaces.
776 var namespace = this._name.replace('_lazy', '');
777 // the namespace keyword confuses clang-format 775 // the namespace keyword confuses clang-format
778 // clang-format off 776 // clang-format off
779 if (namespace === 'sdk' || namespace === 'ui') 777 // Module namespaces.
780 namespace = namespace.toUpperCase(); 778 const specialCases = {
781 if (namespace === 'css_tracker') 779 'sdk': 'SDK',
782 namespace = 'CSSTracker'; 780 'ui': 'UI',
781 'perf_ui': 'Perf_UI',
pfeldman 2017/01/09 19:29:48 PerfUI
chenwilliam 2017/01/09 22:49:15 Done.
782 'css_tracker': 'CSSTracker',
783 };
784 var namespace = specialCases[this._name] || this._name.split('_').map(a => a .substring(0, 1).toUpperCase() + a.substring(1)).join('');
785 self[namespace] = self[namespace] || {};
783 // clang-format on 786 // clang-format on
784 namespace = namespace.split('_').map(a => a.substring(0, 1).toUpperCase() + a.substring(1)).join('');
785 self[namespace] = self[namespace] || {};
786
787 return Runtime._loadScriptsPromise(this._descriptor.scripts.map(this._modula rizeURL, this), this._remoteBase()); 787 return Runtime._loadScriptsPromise(this._descriptor.scripts.map(this._modula rizeURL, this), this._remoteBase());
788 } 788 }
789 789
790 /** 790 /**
791 * @param {string} resourceName 791 * @param {string} resourceName
792 */ 792 */
793 _modularizeURL(resourceName) { 793 _modularizeURL(resourceName) {
794 return Runtime.normalizePath(this._name + '/' + resourceName); 794 return Runtime.normalizePath(this._name + '/' + resourceName);
795 } 795 }
796 796
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 send(message) {}, 1124 send(message) {},
1125 1125
1126 /** 1126 /**
1127 * @return {!Promise<boolean>} 1127 * @return {!Promise<boolean>}
1128 */ 1128 */
1129 close() {} 1129 close() {}
1130 }; 1130 };
1131 1131
1132 /** @type {!Runtime} */ 1132 /** @type {!Runtime} */
1133 var runtime; 1133 var runtime;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698