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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 * @param {!WebInspector.TargetManager} targetManager 8 * @param {!WebInspector.TargetManager} targetManager
9 * @param {!WebInspector.Workspace} workspace 9 * @param {!WebInspector.Workspace} workspace
10 * @param {!WebInspector.NetworkMapping} networkMapping 10 * @param {!WebInspector.NetworkMapping} networkMapping
11 */ 11 */
12 WebInspector.DebuggerWorkspaceBinding = function(targetManager, workspace, netwo rkMapping) 12 WebInspector.DebuggerWorkspaceBinding = function(targetManager, workspace, netwo rkMapping)
13 { 13 {
14 this._workspace = workspace; 14 this._workspace = workspace;
15 this._networkMapping = networkMapping; 15 this._networkMapping = networkMapping;
16 16
17 // FIXME: Migrate from _targetToData to _debuggerModelToData. 17 // FIXME: Migrate from _targetToData to _debuggerModelToData.
18 /** @type {!Map.<!WebInspector.Target, !WebInspector.DebuggerWorkspaceBindin g.TargetData>} */ 18 /** @type {!Map.<!WebInspector.Target, !WebInspector.DebuggerWorkspaceBindin g.TargetData>} */
19 this._targetToData = new Map(); 19 this._targetToData = new Map();
20 targetManager.observeTargets(this); 20 targetManager.observeTargets(this);
21 21
22 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.GlobalObjectCleared, this._globalObjectCleared, this); 22 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.GlobalObjectCleared, this._globalObjectCleared, this);
23 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.BeforeDebuggerPaused, this._beforeDebuggerPaused, this); 23 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.BeforeDebuggerPaused, this._beforeDebuggerPaused, this);
24 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.DebuggerResumed, this._debuggerResumed, this); 24 targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.Debu ggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
25 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved , this._uiSourceCodeRemoved, this); 25 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved , this._uiSourceCodeRemoved, this);
26 workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, thi s._projectRemoved, this); 26 workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, thi s._projectRemoved, this);
27 } 27 };
28 28
29 WebInspector.DebuggerWorkspaceBinding.prototype = { 29 WebInspector.DebuggerWorkspaceBinding.prototype = {
30 /** 30 /**
31 * @override 31 * @override
32 * @param {!WebInspector.Target} target 32 * @param {!WebInspector.Target} target
33 */ 33 */
34 targetAdded: function(target) 34 targetAdded: function(target)
35 { 35 {
36 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 36 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
37 if (debuggerModel) 37 if (debuggerModel)
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 */ 354 */
355 _beforeDebuggerPaused: function(event) 355 _beforeDebuggerPaused: function(event)
356 { 356 {
357 var rawLocation = event.data.callFrames[0].location(); 357 var rawLocation = event.data.callFrames[0].location();
358 var targetData = this._targetToData.get(rawLocation.target()); 358 var targetData = this._targetToData.get(rawLocation.target());
359 if (!targetData._compilerMapping.mapsToSourceCode(rawLocation)) { 359 if (!targetData._compilerMapping.mapsToSourceCode(rawLocation)) {
360 event.stopPropagation(); 360 event.stopPropagation();
361 event.preventDefault(); 361 event.preventDefault();
362 } 362 }
363 } 363 }
364 } 364 };
365 365
366 /** 366 /**
367 * @constructor 367 * @constructor
368 * @param {!WebInspector.DebuggerModel} debuggerModel 368 * @param {!WebInspector.DebuggerModel} debuggerModel
369 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 369 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
370 */ 370 */
371 WebInspector.DebuggerWorkspaceBinding.TargetData = function(debuggerModel, debug gerWorkspaceBinding) 371 WebInspector.DebuggerWorkspaceBinding.TargetData = function(debuggerModel, debug gerWorkspaceBinding)
372 { 372 {
373 this._target = debuggerModel.target(); 373 this._target = debuggerModel.target();
374 374
(...skipping 10 matching lines...) Expand all
385 this._resourceMapping = new WebInspector.ResourceScriptMapping(debuggerModel , workspace, networkMapping, debuggerWorkspaceBinding); 385 this._resourceMapping = new WebInspector.ResourceScriptMapping(debuggerModel , workspace, networkMapping, debuggerWorkspaceBinding);
386 this._compilerMapping = new WebInspector.CompilerScriptMapping(debuggerModel , workspace, networkMapping, WebInspector.NetworkProject.forTarget(this._target) , debuggerWorkspaceBinding); 386 this._compilerMapping = new WebInspector.CompilerScriptMapping(debuggerModel , workspace, networkMapping, WebInspector.NetworkProject.forTarget(this._target) , debuggerWorkspaceBinding);
387 387
388 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.DebuggerSourceMap ping>} */ 388 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.DebuggerSourceMap ping>} */
389 this._uiSourceCodeToSourceMapping = new Map(); 389 this._uiSourceCodeToSourceMapping = new Map();
390 390
391 this._eventListeners = [ 391 this._eventListeners = [
392 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedS criptSource, this._parsedScriptSource, this), 392 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedS criptSource, this._parsedScriptSource, this),
393 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedT oParseScriptSource, this._parsedScriptSource, this) 393 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedT oParseScriptSource, this._parsedScriptSource, this)
394 ]; 394 ];
395 } 395 };
396 396
397 WebInspector.DebuggerWorkspaceBinding.TargetData.prototype = { 397 WebInspector.DebuggerWorkspaceBinding.TargetData.prototype = {
398 /** 398 /**
399 * @param {!WebInspector.Event} event 399 * @param {!WebInspector.Event} event
400 */ 400 */
401 _parsedScriptSource: function(event) 401 _parsedScriptSource: function(event)
402 { 402 {
403 var script = /** @type {!WebInspector.Script} */ (event.data); 403 var script = /** @type {!WebInspector.Script} */ (event.data);
404 this._defaultMapping.addScript(script); 404 this._defaultMapping.addScript(script);
405 this._resourceMapping.addScript(script); 405 this._resourceMapping.addScript(script);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 }, 457 },
458 458
459 _dispose: function() 459 _dispose: function()
460 { 460 {
461 WebInspector.EventTarget.removeEventListeners(this._eventListeners); 461 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
462 this._compilerMapping.dispose(); 462 this._compilerMapping.dispose();
463 this._resourceMapping.dispose(); 463 this._resourceMapping.dispose();
464 this._defaultMapping.dispose(); 464 this._defaultMapping.dispose();
465 this._uiSourceCodeToSourceMapping.clear(); 465 this._uiSourceCodeToSourceMapping.clear();
466 } 466 }
467 } 467 };
468 468
469 /** 469 /**
470 * @constructor 470 * @constructor
471 * @param {!WebInspector.Script} script 471 * @param {!WebInspector.Script} script
472 */ 472 */
473 WebInspector.DebuggerWorkspaceBinding.ScriptInfo = function(script) 473 WebInspector.DebuggerWorkspaceBinding.ScriptInfo = function(script)
474 { 474 {
475 this._script = script; 475 this._script = script;
476 476
477 /** @type {!Array.<!WebInspector.DebuggerSourceMapping>} */ 477 /** @type {!Array.<!WebInspector.DebuggerSourceMapping>} */
478 this._sourceMappings = []; 478 this._sourceMappings = [];
479 479
480 /** @type {!Set<!WebInspector.LiveLocation>} */ 480 /** @type {!Set<!WebInspector.LiveLocation>} */
481 this._locations = new Set(); 481 this._locations = new Set();
482 } 482 };
483 483
484 WebInspector.DebuggerWorkspaceBinding.ScriptInfo.prototype = { 484 WebInspector.DebuggerWorkspaceBinding.ScriptInfo.prototype = {
485 /** 485 /**
486 * @param {!WebInspector.DebuggerSourceMapping} sourceMapping 486 * @param {!WebInspector.DebuggerSourceMapping} sourceMapping
487 */ 487 */
488 _pushSourceMapping: function(sourceMapping) 488 _pushSourceMapping: function(sourceMapping)
489 { 489 {
490 this._sourceMappings.push(sourceMapping); 490 this._sourceMappings.push(sourceMapping);
491 this._updateLocations(); 491 this._updateLocations();
492 }, 492 },
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 * @return {!WebInspector.UILocation} 529 * @return {!WebInspector.UILocation}
530 */ 530 */
531 _rawLocationToUILocation: function(rawLocation) 531 _rawLocationToUILocation: function(rawLocation)
532 { 532 {
533 var uiLocation; 533 var uiLocation;
534 for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i ) 534 for (var i = this._sourceMappings.length - 1; !uiLocation && i >= 0; --i )
535 uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLoca tion); 535 uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLoca tion);
536 console.assert(uiLocation, "Script raw location cannot be mapped to any UI location."); 536 console.assert(uiLocation, "Script raw location cannot be mapped to any UI location.");
537 return /** @type {!WebInspector.UILocation} */ (uiLocation); 537 return /** @type {!WebInspector.UILocation} */ (uiLocation);
538 } 538 }
539 } 539 };
540 540
541 541
542 /** 542 /**
543 * @constructor 543 * @constructor
544 * @extends {WebInspector.LiveLocationWithPool} 544 * @extends {WebInspector.LiveLocationWithPool}
545 * @param {!WebInspector.Script} script 545 * @param {!WebInspector.Script} script
546 * @param {!WebInspector.DebuggerModel.Location} rawLocation 546 * @param {!WebInspector.DebuggerModel.Location} rawLocation
547 * @param {!WebInspector.DebuggerWorkspaceBinding} binding 547 * @param {!WebInspector.DebuggerWorkspaceBinding} binding
548 * @param {function(!WebInspector.LiveLocation)} updateDelegate 548 * @param {function(!WebInspector.LiveLocation)} updateDelegate
549 * @param {!WebInspector.LiveLocationPool} locationPool 549 * @param {!WebInspector.LiveLocationPool} locationPool
550 */ 550 */
551 WebInspector.DebuggerWorkspaceBinding.Location = function(script, rawLocation, b inding, updateDelegate, locationPool) 551 WebInspector.DebuggerWorkspaceBinding.Location = function(script, rawLocation, b inding, updateDelegate, locationPool)
552 { 552 {
553 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool); 553 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool);
554 this._script = script; 554 this._script = script;
555 this._rawLocation = rawLocation; 555 this._rawLocation = rawLocation;
556 this._binding = binding; 556 this._binding = binding;
557 } 557 };
558 558
559 WebInspector.DebuggerWorkspaceBinding.Location.prototype = { 559 WebInspector.DebuggerWorkspaceBinding.Location.prototype = {
560 /** 560 /**
561 * @override 561 * @override
562 * @return {!WebInspector.UILocation} 562 * @return {!WebInspector.UILocation}
563 */ 563 */
564 uiLocation: function() 564 uiLocation: function()
565 { 565 {
566 var debuggerModelLocation = this._rawLocation; 566 var debuggerModelLocation = this._rawLocation;
567 return this._binding.rawLocationToUILocation(debuggerModelLocation); 567 return this._binding.rawLocationToUILocation(debuggerModelLocation);
(...skipping 11 matching lines...) Expand all
579 /** 579 /**
580 * @override 580 * @override
581 * @return {boolean} 581 * @return {boolean}
582 */ 582 */
583 isBlackboxed: function() 583 isBlackboxed: function()
584 { 584 {
585 return WebInspector.blackboxManager.isBlackboxedRawLocation(this._rawLoc ation); 585 return WebInspector.blackboxManager.isBlackboxedRawLocation(this._rawLoc ation);
586 }, 586 },
587 587
588 __proto__: WebInspector.LiveLocationWithPool.prototype 588 __proto__: WebInspector.LiveLocationWithPool.prototype
589 } 589 };
590 590
591 /** 591 /**
592 * @constructor 592 * @constructor
593 * @extends {WebInspector.LiveLocationWithPool} 593 * @extends {WebInspector.LiveLocationWithPool}
594 * @param {!Array<!WebInspector.DebuggerModel.Location>} rawLocations 594 * @param {!Array<!WebInspector.DebuggerModel.Location>} rawLocations
595 * @param {!WebInspector.DebuggerWorkspaceBinding} binding 595 * @param {!WebInspector.DebuggerWorkspaceBinding} binding
596 * @param {function(!WebInspector.LiveLocation)} updateDelegate 596 * @param {function(!WebInspector.LiveLocation)} updateDelegate
597 * @param {!WebInspector.LiveLocationPool} locationPool 597 * @param {!WebInspector.LiveLocationPool} locationPool
598 */ 598 */
599 WebInspector.DebuggerWorkspaceBinding.StackTraceTopFrameLocation = function(rawL ocations, binding, updateDelegate, locationPool) 599 WebInspector.DebuggerWorkspaceBinding.StackTraceTopFrameLocation = function(rawL ocations, binding, updateDelegate, locationPool)
600 { 600 {
601 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool); 601 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool);
602 602
603 this._updateScheduled = true; 603 this._updateScheduled = true;
604 /** @type {!Set<!WebInspector.LiveLocation>} */ 604 /** @type {!Set<!WebInspector.LiveLocation>} */
605 this._locations = new Set(); 605 this._locations = new Set();
606 for (var location of rawLocations) 606 for (var location of rawLocations)
607 this._locations.add(binding.createLiveLocation(location, this._scheduleU pdate.bind(this), locationPool)); 607 this._locations.add(binding.createLiveLocation(location, this._scheduleU pdate.bind(this), locationPool));
608 this._updateLocation(); 608 this._updateLocation();
609 } 609 };
610 610
611 WebInspector.DebuggerWorkspaceBinding.StackTraceTopFrameLocation.prototype = { 611 WebInspector.DebuggerWorkspaceBinding.StackTraceTopFrameLocation.prototype = {
612 /** 612 /**
613 * @override 613 * @override
614 * @return {!WebInspector.UILocation} 614 * @return {!WebInspector.UILocation}
615 */ 615 */
616 uiLocation: function() 616 uiLocation: function()
617 { 617 {
618 return this._current.uiLocation(); 618 return this._current.uiLocation();
619 }, 619 },
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 for (var current of this._locations) { 652 for (var current of this._locations) {
653 if (!current.isBlackboxed()) { 653 if (!current.isBlackboxed()) {
654 this._current = current; 654 this._current = current;
655 break; 655 break;
656 } 656 }
657 } 657 }
658 this.update(); 658 this.update();
659 }, 659 },
660 660
661 __proto__: WebInspector.LiveLocationWithPool.prototype 661 __proto__: WebInspector.LiveLocationWithPool.prototype
662 } 662 };
663 663
664 /** 664 /**
665 * @interface 665 * @interface
666 */ 666 */
667 WebInspector.DebuggerSourceMapping = function() 667 WebInspector.DebuggerSourceMapping = function()
668 { 668 {
669 } 669 };
670 670
671 WebInspector.DebuggerSourceMapping.prototype = { 671 WebInspector.DebuggerSourceMapping.prototype = {
672 /** 672 /**
673 * @param {!WebInspector.DebuggerModel.Location} rawLocation 673 * @param {!WebInspector.DebuggerModel.Location} rawLocation
674 * @return {?WebInspector.UILocation} 674 * @return {?WebInspector.UILocation}
675 */ 675 */
676 rawLocationToUILocation: function(rawLocation) { }, 676 rawLocationToUILocation: function(rawLocation) { },
677 677
678 /** 678 /**
679 * @param {!WebInspector.UISourceCode} uiSourceCode 679 * @param {!WebInspector.UISourceCode} uiSourceCode
680 * @param {number} lineNumber 680 * @param {number} lineNumber
681 * @param {number} columnNumber 681 * @param {number} columnNumber
682 * @return {?WebInspector.DebuggerModel.Location} 682 * @return {?WebInspector.DebuggerModel.Location}
683 */ 683 */
684 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { }, 684 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { },
685 685
686 /** 686 /**
687 * @return {boolean} 687 * @return {boolean}
688 */ 688 */
689 isIdentity: function() { }, 689 isIdentity: function() { },
690 690
691 /** 691 /**
692 * @param {!WebInspector.UISourceCode} uiSourceCode 692 * @param {!WebInspector.UISourceCode} uiSourceCode
693 * @param {number} lineNumber 693 * @param {number} lineNumber
694 * @return {boolean} 694 * @return {boolean}
695 */ 695 */
696 uiLineHasMapping: function(uiSourceCode, lineNumber) { } 696 uiLineHasMapping: function(uiSourceCode, lineNumber) { }
697 } 697 };
698 698
699 /** 699 /**
700 * @type {!WebInspector.DebuggerWorkspaceBinding} 700 * @type {!WebInspector.DebuggerWorkspaceBinding}
701 */ 701 */
702 WebInspector.debuggerWorkspaceBinding; 702 WebInspector.debuggerWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698