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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 InspectorBackendClass._DevToolsErrorCode = -32000; 42 InspectorBackendClass._DevToolsErrorCode = -32000;
43 InspectorBackendClass.DevToolsStubErrorCode = -32015; 43 InspectorBackendClass.DevToolsStubErrorCode = -32015;
44 44
45 /** 45 /**
46 * @param {string} error 46 * @param {string} error
47 * @param {!Object} messageObject 47 * @param {!Object} messageObject
48 */ 48 */
49 InspectorBackendClass.reportProtocolError = function(error, messageObject) 49 InspectorBackendClass.reportProtocolError = function(error, messageObject)
50 { 50 {
51 console.error(error + ": " + JSON.stringify(messageObject)); 51 console.error(error + ": " + JSON.stringify(messageObject));
52 } 52 };
53 53
54 InspectorBackendClass.prototype = { 54 InspectorBackendClass.prototype = {
55 /** 55 /**
56 * @return {boolean} 56 * @return {boolean}
57 */ 57 */
58 isInitialized: function() 58 isInitialized: function()
59 { 59 {
60 return this._initialized; 60 return this._initialized;
61 }, 61 },
62 62
(...skipping 29 matching lines...) Expand all
92 return this._agentsMap[domain]; 92 return this._agentsMap[domain];
93 } 93 }
94 94
95 window.Protocol.Agents.prototype[methodName] = agentGetter; 95 window.Protocol.Agents.prototype[methodName] = agentGetter;
96 96
97 /** 97 /**
98 * @this {Protocol.Agents} 98 * @this {Protocol.Agents}
99 */ 99 */
100 function registerDispatcher(dispatcher) 100 function registerDispatcher(dispatcher)
101 { 101 {
102 this.registerDispatcher(domain, dispatcher) 102 this.registerDispatcher(domain, dispatcher);
103 } 103 }
104 104
105 window.Protocol.Agents.prototype["register" + domain + "Dispatcher"] = r egisterDispatcher; 105 window.Protocol.Agents.prototype["register" + domain + "Dispatcher"] = r egisterDispatcher;
106 }, 106 },
107 107
108 /** 108 /**
109 * @param {string} domain 109 * @param {string} domain
110 * @return {!InspectorBackendClass.AgentPrototype} 110 * @return {!InspectorBackendClass.AgentPrototype}
111 */ 111 */
112 _agentPrototype: function(domain) 112 _agentPrototype: function(domain)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 clientCallback(defaultValue); 191 clientCallback(defaultValue);
192 return; 192 return;
193 } 193 }
194 if (constructor) 194 if (constructor)
195 clientCallback(new constructor(value)); 195 clientCallback(new constructor(value));
196 else 196 else
197 clientCallback(value); 197 clientCallback(value);
198 } 198 }
199 return callbackWrapper; 199 return callbackWrapper;
200 } 200 }
201 } 201 };
202 202
203 /** 203 /**
204 * @constructor 204 * @constructor
205 * @extends {WebInspector.Object} 205 * @extends {WebInspector.Object}
206 */ 206 */
207 InspectorBackendClass.Connection = function() 207 InspectorBackendClass.Connection = function()
208 { 208 {
209 this._lastMessageId = 1; 209 this._lastMessageId = 1;
210 this._pendingResponsesCount = 0; 210 this._pendingResponsesCount = 0;
211 this._agents = {}; 211 this._agents = {};
212 this._dispatchers = {}; 212 this._dispatchers = {};
213 this._callbacks = {}; 213 this._callbacks = {};
214 this._initialize(InspectorBackend._agentPrototypes, InspectorBackend._dispat cherPrototypes); 214 this._initialize(InspectorBackend._agentPrototypes, InspectorBackend._dispat cherPrototypes);
215 this._isConnected = true; 215 this._isConnected = true;
216 } 216 };
217 217
218 /** @enum {symbol} */ 218 /** @enum {symbol} */
219 InspectorBackendClass.Connection.Events = { 219 InspectorBackendClass.Connection.Events = {
220 Disconnected: Symbol("Disconnected") 220 Disconnected: Symbol("Disconnected")
221 } 221 };
222 222
223 InspectorBackendClass.Connection.prototype = { 223 InspectorBackendClass.Connection.prototype = {
224 /** 224 /**
225 * @param {!Object.<string, !InspectorBackendClass.AgentPrototype>} agentPro totypes 225 * @param {!Object.<string, !InspectorBackendClass.AgentPrototype>} agentPro totypes
226 * @param {!Object.<string, !InspectorBackendClass.DispatcherPrototype>} dis patcherPrototypes 226 * @param {!Object.<string, !InspectorBackendClass.DispatcherPrototype>} dis patcherPrototypes
227 */ 227 */
228 _initialize: function(agentPrototypes, dispatcherPrototypes) 228 _initialize: function(agentPrototypes, dispatcherPrototypes)
229 { 229 {
230 for (var domain in agentPrototypes) { 230 for (var domain in agentPrototypes) {
231 this._agents[domain] = Object.create(agentPrototypes[domain]); 231 this._agents[domain] = Object.create(agentPrototypes[domain]);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 /** 477 /**
478 * @param {!Array.<string>} domains 478 * @param {!Array.<string>} domains
479 */ 479 */
480 suppressErrorsForDomains: function(domains) 480 suppressErrorsForDomains: function(domains)
481 { 481 {
482 domains.forEach(function(domain) { this._agents[domain].suppressErrorLog ging(); }, this); 482 domains.forEach(function(domain) { this._agents[domain].suppressErrorLog ging(); }, this);
483 }, 483 },
484 484
485 __proto__: WebInspector.Object.prototype 485 __proto__: WebInspector.Object.prototype
486 486
487 } 487 };
488 488
489 /** 489 /**
490 * @constructor 490 * @constructor
491 * @param {string} domain 491 * @param {string} domain
492 */ 492 */
493 InspectorBackendClass.AgentPrototype = function(domain) 493 InspectorBackendClass.AgentPrototype = function(domain)
494 { 494 {
495 this._replyArgs = {}; 495 this._replyArgs = {};
496 this._hasErrorData = {}; 496 this._hasErrorData = {};
497 this._domain = domain; 497 this._domain = domain;
498 this._suppressErrorLogging = false; 498 this._suppressErrorLogging = false;
499 } 499 };
500 500
501 InspectorBackendClass.AgentPrototype.prototype = { 501 InspectorBackendClass.AgentPrototype.prototype = {
502 /** 502 /**
503 * @param {!InspectorBackendClass.Connection} connection 503 * @param {!InspectorBackendClass.Connection} connection
504 */ 504 */
505 setConnection: function(connection) 505 setConnection: function(connection)
506 { 506 {
507 this._connection = connection; 507 this._connection = connection;
508 }, 508 },
509 509
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (args.length === 1 && (!allowExtraUndefinedArg || (typeof args[0] !== "undefined"))) { 586 if (args.length === 1 && (!allowExtraUndefinedArg || (typeof args[0] !== "undefined"))) {
587 errorCallback("Protocol Error: Optional callback argument for method '" + method + "' call must be a function but its type is '" + typeof args[0] + "'."); 587 errorCallback("Protocol Error: Optional callback argument for method '" + method + "' call must be a function but its type is '" + typeof args[0] + "'.");
588 return null; 588 return null;
589 } 589 }
590 590
591 if (args.length > 1) { 591 if (args.length > 1) {
592 errorCallback("Protocol Error: Extra " + args.length + " arguments i n a call to method '" + method + "'."); 592 errorCallback("Protocol Error: Extra " + args.length + " arguments i n a call to method '" + method + "'.");
593 return null; 593 return null;
594 } 594 }
595 595
596 return hasParams ? params : null 596 return hasParams ? params : null;
597 }, 597 },
598 598
599 /** 599 /**
600 * @param {string} method 600 * @param {string} method
601 * @param {!Array.<!Object>} signature 601 * @param {!Array.<!Object>} signature
602 * @param {!Array.<*>} args 602 * @param {!Array.<*>} args
603 * @return {!Promise.<*>} 603 * @return {!Promise.<*>}
604 */ 604 */
605 _sendMessageToBackendPromise: function(method, signature, args) 605 _sendMessageToBackendPromise: function(method, signature, args)
606 { 606 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 argumentsArray.push(messageObject.result[paramNames[i]]); 673 argumentsArray.push(messageObject.result[paramNames[i]]);
674 } 674 }
675 675
676 callback.apply(null, argumentsArray); 676 callback.apply(null, argumentsArray);
677 }, 677 },
678 678
679 suppressErrorLogging: function() 679 suppressErrorLogging: function()
680 { 680 {
681 this._suppressErrorLogging = true; 681 this._suppressErrorLogging = true;
682 } 682 }
683 } 683 };
684 684
685 /** 685 /**
686 * @constructor 686 * @constructor
687 */ 687 */
688 InspectorBackendClass.DispatcherPrototype = function() 688 InspectorBackendClass.DispatcherPrototype = function()
689 { 689 {
690 this._eventArgs = {}; 690 this._eventArgs = {};
691 this._dispatcher = null; 691 this._dispatcher = null;
692 } 692 };
693 693
694 InspectorBackendClass.DispatcherPrototype.prototype = { 694 InspectorBackendClass.DispatcherPrototype.prototype = {
695 695
696 /** 696 /**
697 * @param {string} eventName 697 * @param {string} eventName
698 * @param {!Object} params 698 * @param {!Object} params
699 */ 699 */
700 registerEvent: function(eventName, params) 700 registerEvent: function(eventName, params)
701 { 701 {
702 this._eventArgs[eventName] = params; 702 this._eventArgs[eventName] = params;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 738
739 var processingStartTime; 739 var processingStartTime;
740 if (InspectorBackendClass.Options.dumpInspectorTimeStats) 740 if (InspectorBackendClass.Options.dumpInspectorTimeStats)
741 processingStartTime = Date.now(); 741 processingStartTime = Date.now();
742 742
743 this._dispatcher[functionName].apply(this._dispatcher, params); 743 this._dispatcher[functionName].apply(this._dispatcher, params);
744 744
745 if (InspectorBackendClass.Options.dumpInspectorTimeStats) 745 if (InspectorBackendClass.Options.dumpInspectorTimeStats)
746 console.log("time-stats: " + messageObject.method + " = " + (Date.no w() - processingStartTime)); 746 console.log("time-stats: " + messageObject.method + " = " + (Date.no w() - processingStartTime));
747 } 747 }
748 } 748 };
749 749
750 InspectorBackendClass.Options = { 750 InspectorBackendClass.Options = {
751 dumpInspectorTimeStats: false, 751 dumpInspectorTimeStats: false,
752 dumpInspectorProtocolMessages: false, 752 dumpInspectorProtocolMessages: false,
753 suppressRequestErrors: false 753 suppressRequestErrors: false
754 } 754 };
755 755
756 InspectorBackend = new InspectorBackendClass(); 756 InspectorBackend = new InspectorBackendClass();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698