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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 /** @type {!Map.<!WebInspector.UISourceCode, string>} */ 42 /** @type {!Map.<!WebInspector.UISourceCode, string>} */
43 this._snippetIdForUISourceCode = new Map(); 43 this._snippetIdForUISourceCode = new Map();
44 44
45 /** @type {!Map.<!WebInspector.Target, !WebInspector.SnippetScriptMapping>} */ 45 /** @type {!Map.<!WebInspector.Target, !WebInspector.SnippetScriptMapping>} */
46 this._mappingForTarget = new Map(); 46 this._mappingForTarget = new Map();
47 this._snippetStorage = new WebInspector.SnippetStorage("script", "Script sni ppet #"); 47 this._snippetStorage = new WebInspector.SnippetStorage("script", "Script sni ppet #");
48 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSettin g("lastSnippetEvaluationIndex", 0); 48 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSettin g("lastSnippetEvaluationIndex", 0);
49 this._project = new WebInspector.SnippetsProject(workspace, this); 49 this._project = new WebInspector.SnippetsProject(workspace, this);
50 this._loadSnippets(); 50 this._loadSnippets();
51 WebInspector.targetManager.observeTargets(this); 51 WebInspector.targetManager.observeTargets(this);
52 } 52 };
53 53
54 WebInspector.ScriptSnippetModel.snippetSourceURLPrefix = "snippets:///"; 54 WebInspector.ScriptSnippetModel.snippetSourceURLPrefix = "snippets:///";
55 55
56 56
57 WebInspector.ScriptSnippetModel.prototype = { 57 WebInspector.ScriptSnippetModel.prototype = {
58 /** 58 /**
59 * @override 59 * @override
60 * @param {!WebInspector.Target} target 60 * @param {!WebInspector.Target} target
61 */ 61 */
62 targetAdded: function(target) 62 targetAdded: function(target)
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 { 363 {
364 var snippetPrefix = WebInspector.ScriptSnippetModel.snippetSourceURLPref ix; 364 var snippetPrefix = WebInspector.ScriptSnippetModel.snippetSourceURLPref ix;
365 if (!sourceURL.startsWith(snippetPrefix)) 365 if (!sourceURL.startsWith(snippetPrefix))
366 return null; 366 return null;
367 var splitURL = sourceURL.substring(snippetPrefix.length).split("_"); 367 var splitURL = sourceURL.substring(snippetPrefix.length).split("_");
368 var snippetId = splitURL[0]; 368 var snippetId = splitURL[0];
369 return snippetId; 369 return snippetId;
370 }, 370 },
371 371
372 __proto__: WebInspector.Object.prototype 372 __proto__: WebInspector.Object.prototype
373 } 373 };
374 374
375 /** 375 /**
376 * @constructor 376 * @constructor
377 * @implements {WebInspector.DebuggerSourceMapping} 377 * @implements {WebInspector.DebuggerSourceMapping}
378 * @param {!WebInspector.DebuggerModel} debuggerModel 378 * @param {!WebInspector.DebuggerModel} debuggerModel
379 * @param {!WebInspector.ScriptSnippetModel} scriptSnippetModel 379 * @param {!WebInspector.ScriptSnippetModel} scriptSnippetModel
380 */ 380 */
381 WebInspector.SnippetScriptMapping = function(debuggerModel, scriptSnippetModel) 381 WebInspector.SnippetScriptMapping = function(debuggerModel, scriptSnippetModel)
382 { 382 {
383 this._target = debuggerModel.target(); 383 this._target = debuggerModel.target();
384 this._debuggerModel = debuggerModel; 384 this._debuggerModel = debuggerModel;
385 this._scriptSnippetModel = scriptSnippetModel; 385 this._scriptSnippetModel = scriptSnippetModel;
386 /** @type {!Object.<string, !WebInspector.UISourceCode>} */ 386 /** @type {!Object.<string, !WebInspector.UISourceCode>} */
387 this._uiSourceCodeForScriptId = {}; 387 this._uiSourceCodeForScriptId = {};
388 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.Script>} */ 388 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.Script>} */
389 this._scriptForUISourceCode = new Map(); 389 this._scriptForUISourceCode = new Map();
390 /** @type {!Map.<!WebInspector.UISourceCode, number>} */ 390 /** @type {!Map.<!WebInspector.UISourceCode, number>} */
391 this._evaluationIndexForUISourceCode = new Map(); 391 this._evaluationIndexForUISourceCode = new Map();
392 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, this._reset, this); 392 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, this._reset, this);
393 } 393 };
394 394
395 WebInspector.SnippetScriptMapping.prototype = { 395 WebInspector.SnippetScriptMapping.prototype = {
396 /** 396 /**
397 * @param {!WebInspector.UISourceCode} uiSourceCode 397 * @param {!WebInspector.UISourceCode} uiSourceCode
398 */ 398 */
399 _releaseSnippetScript: function(uiSourceCode) 399 _releaseSnippetScript: function(uiSourceCode)
400 { 400 {
401 var script = this._scriptForUISourceCode.get(uiSourceCode); 401 var script = this._scriptForUISourceCode.get(uiSourceCode);
402 if (!script) 402 if (!script)
403 return; 403 return;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 /** 514 /**
515 * @override 515 * @override
516 * @param {!WebInspector.UISourceCode} uiSourceCode 516 * @param {!WebInspector.UISourceCode} uiSourceCode
517 * @param {number} lineNumber 517 * @param {number} lineNumber
518 * @return {boolean} 518 * @return {boolean}
519 */ 519 */
520 uiLineHasMapping: function(uiSourceCode, lineNumber) 520 uiLineHasMapping: function(uiSourceCode, lineNumber)
521 { 521 {
522 return true; 522 return true;
523 } 523 }
524 } 524 };
525 525
526 /** 526 /**
527 * @constructor 527 * @constructor
528 * @implements {WebInspector.ContentProvider} 528 * @implements {WebInspector.ContentProvider}
529 * @param {!WebInspector.Snippet} snippet 529 * @param {!WebInspector.Snippet} snippet
530 */ 530 */
531 WebInspector.SnippetContentProvider = function(snippet) 531 WebInspector.SnippetContentProvider = function(snippet)
532 { 532 {
533 this._snippet = snippet; 533 this._snippet = snippet;
534 } 534 };
535 535
536 WebInspector.SnippetContentProvider.prototype = { 536 WebInspector.SnippetContentProvider.prototype = {
537 /** 537 /**
538 * @override 538 * @override
539 * @return {string} 539 * @return {string}
540 */ 540 */
541 contentURL: function() 541 contentURL: function()
542 { 542 {
543 return ""; 543 return "";
544 }, 544 },
(...skipping 29 matching lines...) Expand all
574 * @this {WebInspector.SnippetContentProvider} 574 * @this {WebInspector.SnippetContentProvider}
575 */ 575 */
576 function performSearch() 576 function performSearch()
577 { 577 {
578 callback(WebInspector.ContentProvider.performSearchInContent(this._s nippet.content, query, caseSensitive, isRegex)); 578 callback(WebInspector.ContentProvider.performSearchInContent(this._s nippet.content, query, caseSensitive, isRegex));
579 } 579 }
580 580
581 // searchInContent should call back later. 581 // searchInContent should call back later.
582 window.setTimeout(performSearch.bind(this), 0); 582 window.setTimeout(performSearch.bind(this), 0);
583 } 583 }
584 } 584 };
585 585
586 /** 586 /**
587 * @constructor 587 * @constructor
588 * @extends {WebInspector.ContentProviderBasedProject} 588 * @extends {WebInspector.ContentProviderBasedProject}
589 * @param {!WebInspector.Workspace} workspace 589 * @param {!WebInspector.Workspace} workspace
590 * @param {!WebInspector.ScriptSnippetModel} model 590 * @param {!WebInspector.ScriptSnippetModel} model
591 */ 591 */
592 WebInspector.SnippetsProject = function(workspace, model) 592 WebInspector.SnippetsProject = function(workspace, model)
593 { 593 {
594 WebInspector.ContentProviderBasedProject.call(this, workspace, "snippets:", WebInspector.projectTypes.Snippets, ""); 594 WebInspector.ContentProviderBasedProject.call(this, workspace, "snippets:", WebInspector.projectTypes.Snippets, "");
595 this._model = model; 595 this._model = model;
596 } 596 };
597 597
598 WebInspector.SnippetsProject.prototype = { 598 WebInspector.SnippetsProject.prototype = {
599 /** 599 /**
600 * @param {string} name 600 * @param {string} name
601 * @param {!WebInspector.ContentProvider} contentProvider 601 * @param {!WebInspector.ContentProvider} contentProvider
602 * @return {!WebInspector.UISourceCode} 602 * @return {!WebInspector.UISourceCode}
603 */ 603 */
604 addSnippet: function(name, contentProvider) 604 addSnippet: function(name, contentProvider)
605 { 605 {
606 return this.addContentProvider(name, contentProvider); 606 return this.addContentProvider(name, contentProvider);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 /** 662 /**
663 * @override 663 * @override
664 * @param {string} url 664 * @param {string} url
665 */ 665 */
666 deleteFile: function(url) 666 deleteFile: function(url)
667 { 667 {
668 this._model.deleteScriptSnippet(url); 668 this._model.deleteScriptSnippet(url);
669 }, 669 },
670 670
671 __proto__: WebInspector.ContentProviderBasedProject.prototype 671 __proto__: WebInspector.ContentProviderBasedProject.prototype
672 } 672 };
673 673
674 /** 674 /**
675 * @type {!WebInspector.ScriptSnippetModel} 675 * @type {!WebInspector.ScriptSnippetModel}
676 */ 676 */
677 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect or.workspace); 677 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect or.workspace);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698