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

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

Issue 1877223003: DevTools: deprecate InspectorTest.runAfterPendingDispatches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/main/Main.js ('k') | no next file » | 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) 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 processingStartTime = Date.now(); 339 processingStartTime = Date.now();
340 340
341 this.agent(callback.domain).dispatchResponse(messageObject, callback .methodName, callback); 341 this.agent(callback.domain).dispatchResponse(messageObject, callback .methodName, callback);
342 --this._pendingResponsesCount; 342 --this._pendingResponsesCount;
343 delete this._callbacks[messageObject.id]; 343 delete this._callbacks[messageObject.id];
344 344
345 if (InspectorBackendClass.Options.dumpInspectorTimeStats) 345 if (InspectorBackendClass.Options.dumpInspectorTimeStats)
346 console.log("time-stats: " + callback.methodName + " = " + (proc essingStartTime - callback.sendRequestTime) + " + " + (Date.now() - processingSt artTime)); 346 console.log("time-stats: " + callback.methodName + " = " + (proc essingStartTime - callback.sendRequestTime) + " + " + (Date.now() - processingSt artTime));
347 347
348 if (this._scripts && !this._pendingResponsesCount) 348 if (this._scripts && !this._pendingResponsesCount)
349 this.runAfterPendingDispatches(); 349 this.deprecatedRunAfterPendingDispatches();
350 return; 350 return;
351 } else { 351 } else {
352 var method = messageObject.method.split("."); 352 var method = messageObject.method.split(".");
353 var domainName = method[0]; 353 var domainName = method[0];
354 if (!(domainName in this._dispatchers)) { 354 if (!(domainName in this._dispatchers)) {
355 InspectorBackendClass.reportProtocolError("Protocol Error: the m essage " + messageObject.method + " is for non-existing domain '" + domainName + "'", messageObject); 355 InspectorBackendClass.reportProtocolError("Protocol Error: the m essage " + messageObject.method + " is for non-existing domain '" + domainName + "'", messageObject);
356 return; 356 return;
357 } 357 }
358 358
359 this._dispatchers[domainName].dispatch(method[1], messageObject); 359 this._dispatchers[domainName].dispatch(method[1], messageObject);
360 } 360 }
361 361
362 }, 362 },
363 363
364 /** 364 /**
365 * @param {string} domain 365 * @param {string} domain
366 * @param {!Object} dispatcher 366 * @param {!Object} dispatcher
367 */ 367 */
368 registerDispatcher: function(domain, dispatcher) 368 registerDispatcher: function(domain, dispatcher)
369 { 369 {
370 if (!this._dispatchers[domain]) 370 if (!this._dispatchers[domain])
371 return; 371 return;
372 372
373 this._dispatchers[domain].setDomainDispatcher(dispatcher); 373 this._dispatchers[domain].setDomainDispatcher(dispatcher);
374 }, 374 },
375 375
376 /** 376 /**
377 * @param {function()=} script 377 * @param {function()=} script
378 */ 378 */
379 runAfterPendingDispatches: function(script) 379 deprecatedRunAfterPendingDispatches: function(script)
380 { 380 {
381 if (!this._scripts) 381 if (!this._scripts)
382 this._scripts = []; 382 this._scripts = [];
383 383
384 if (script) 384 if (script)
385 this._scripts.push(script); 385 this._scripts.push(script);
386 386
387 // Execute all promises. 387 // Execute all promises.
388 setTimeout(function() { 388 setTimeout(function() {
389 if (!this._pendingResponsesCount) 389 if (!this._pendingResponsesCount)
390 this._executeAfterPendingDispatches(); 390 this._executeAfterPendingDispatches();
391 else 391 else
392 this.runAfterPendingDispatches(); 392 this.deprecatedRunAfterPendingDispatches();
393 }.bind(this), 0); 393 }.bind(this), 0);
394 }, 394 },
395 395
396 _executeAfterPendingDispatches: function() 396 _executeAfterPendingDispatches: function()
397 { 397 {
398 if (!this._pendingResponsesCount) { 398 if (!this._pendingResponsesCount) {
399 var scripts = this._scripts; 399 var scripts = this._scripts;
400 this._scripts = []; 400 this._scripts = [];
401 for (var id = 0; id < scripts.length; ++id) 401 for (var id = 0; id < scripts.length; ++id)
402 scripts[id].call(this); 402 scripts[id].call(this);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 722 }
723 } 723 }
724 724
725 InspectorBackendClass.Options = { 725 InspectorBackendClass.Options = {
726 dumpInspectorTimeStats: false, 726 dumpInspectorTimeStats: false,
727 dumpInspectorProtocolMessages: false, 727 dumpInspectorProtocolMessages: false,
728 suppressRequestErrors: false 728 suppressRequestErrors: false
729 } 729 }
730 730
731 InspectorBackend = new InspectorBackendClass(); 731 InspectorBackend = new InspectorBackendClass();
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/main/Main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698