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

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

Issue 1413593008: DevTools: straw man adaptable implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 { 550 {
551 if (!this._cachedTypeClasses[typeName]) { 551 if (!this._cachedTypeClasses[typeName]) {
552 var path = typeName.split("."); 552 var path = typeName.split(".");
553 var object = window; 553 var object = window;
554 for (var i = 0; object && (i < path.length); ++i) 554 for (var i = 0; object && (i < path.length); ++i)
555 object = object[path[i]]; 555 object = object[path[i]];
556 if (object) 556 if (object)
557 this._cachedTypeClasses[typeName] = /** @type function(new:Objec t) */(object); 557 this._cachedTypeClasses[typeName] = /** @type function(new:Objec t) */(object);
558 } 558 }
559 return this._cachedTypeClasses[typeName] || null; 559 return this._cachedTypeClasses[typeName] || null;
560 },
561
562 /**
563 * @param {!Object} object
564 * @return {!Promise<!Array<!Object>>}
565 */
566 adapt: function(object)
567 {
568 return this.instancesPromise(Runtime.Adapter, object).then(processAdapte rs);
569
570 /**
571 * @param {!Array<!Runtime.Adapter>} adapters
572 * @return {!Promise<!Array<!Object>>}
573 */
574 function processAdapters(adapters)
575 {
576 var promises = [];
577 for (var adapter of adapters)
578 promises.push(adapter.adapt(object));
579 return /** @type {!Promise<!Array<!Object>>} */ (Runtime._some(promi ses));
580 }
560 } 581 }
561 } 582 }
562 583
563 /** 584 /**
564 * @constructor 585 * @constructor
565 */ 586 */
566 Runtime.ModuleDescriptor = function() 587 Runtime.ModuleDescriptor = function()
567 { 588 {
568 /** 589 /**
569 * @type {string} 590 * @type {string}
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1090
1070 /** 1091 /**
1071 * @param {boolean} enabled 1092 * @param {boolean} enabled
1072 */ 1093 */
1073 setEnabled: function(enabled) 1094 setEnabled: function(enabled)
1074 { 1095 {
1075 this._experiments.setEnabled(this.name, enabled); 1096 this._experiments.setEnabled(this.name, enabled);
1076 } 1097 }
1077 } 1098 }
1078 1099
1100 /**
1101 * @interface
1102 */
1103 Runtime.Adapter = function() { }
1104
1105 Runtime.Adapter.prototype = {
1106 /**
1107 * @param {!Object} from
1108 * @return {!Promise<?Object>}
1109 */
1110 adapt: function(from) { }
1111 }
1112
1079 {(function parseQueryParameters() 1113 {(function parseQueryParameters()
1080 { 1114 {
1081 var queryParams = location.search; 1115 var queryParams = location.search;
1082 if (!queryParams) 1116 if (!queryParams)
1083 return; 1117 return;
1084 var params = queryParams.substring(1).split("&"); 1118 var params = queryParams.substring(1).split("&");
1085 for (var i = 0; i < params.length; ++i) { 1119 for (var i = 0; i < params.length; ++i) {
1086 var pair = params[i].split("="); 1120 var pair = params[i].split("=");
1087 var name = pair.shift(); 1121 var name = pair.shift();
1088 Runtime._queryParamsObject[name] = pair.join("="); 1122 Runtime._queryParamsObject[name] = pair.join("=");
1089 } 1123 }
1090 })();} 1124 })();}
1091 1125
1092 1126
1093 // This must be constructed after the query parameters have been parsed. 1127 // This must be constructed after the query parameters have been parsed.
1094 Runtime.experiments = new Runtime.ExperimentsSupport(); 1128 Runtime.experiments = new Runtime.ExperimentsSupport();
1095 1129
1096 /** 1130 /**
1097 * @type {?string} 1131 * @type {?string}
1098 */ 1132 */
1099 Runtime._remoteBase = Runtime.queryParam("remoteBase"); 1133 Runtime._remoteBase = Runtime.queryParam("remoteBase");
1100 1134
1101 /** @type {!Runtime} */ 1135 /** @type {!Runtime} */
1102 var runtime; 1136 var runtime;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698