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

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

Issue 2261933002: DevTools: Use JS symbols instead of strings for eligible events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nokia Inc. All rights reserved. 2 * Copyright (C) 2008 Nokia Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /** 44 /**
45 * @param {string} securityOrigin 45 * @param {string} securityOrigin
46 * @param {boolean} isLocalStorage 46 * @param {boolean} isLocalStorage
47 * @return {!DOMStorageAgent.StorageId} 47 * @return {!DOMStorageAgent.StorageId}
48 */ 48 */
49 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage) 49 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage)
50 { 50 {
51 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage }; 51 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage };
52 } 52 }
53 53
54 /** @enum {symbol} */
54 WebInspector.DOMStorage.Events = { 55 WebInspector.DOMStorage.Events = {
55 DOMStorageItemsCleared: "DOMStorageItemsCleared", 56 DOMStorageItemsCleared: Symbol("DOMStorageItemsCleared"),
56 DOMStorageItemRemoved: "DOMStorageItemRemoved", 57 DOMStorageItemRemoved: Symbol("DOMStorageItemRemoved"),
57 DOMStorageItemAdded: "DOMStorageItemAdded", 58 DOMStorageItemAdded: Symbol("DOMStorageItemAdded"),
58 DOMStorageItemUpdated: "DOMStorageItemUpdated" 59 DOMStorageItemUpdated: Symbol("DOMStorageItemUpdated")
59 } 60 }
60 61
61 WebInspector.DOMStorage.prototype = { 62 WebInspector.DOMStorage.prototype = {
62 63
63 /** @return {!DOMStorageAgent.StorageId} */ 64 /** @return {!DOMStorageAgent.StorageId} */
64 get id() 65 get id()
65 { 66 {
66 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL ocalStorage); 67 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL ocalStorage);
67 }, 68 },
68 69
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 WebInspector.DOMStorageModel = function(target, securityOriginManager) 116 WebInspector.DOMStorageModel = function(target, securityOriginManager)
116 { 117 {
117 WebInspector.SDKModel.call(this, WebInspector.DOMStorageModel, target); 118 WebInspector.SDKModel.call(this, WebInspector.DOMStorageModel, target);
118 119
119 this._securityOriginManager = securityOriginManager; 120 this._securityOriginManager = securityOriginManager;
120 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ 121 /** @type {!Object.<string, !WebInspector.DOMStorage>} */
121 this._storages = {}; 122 this._storages = {};
122 this._agent = target.domstorageAgent(); 123 this._agent = target.domstorageAgent();
123 } 124 }
124 125
126 /** @enum {symbol} */
125 WebInspector.DOMStorageModel.Events = { 127 WebInspector.DOMStorageModel.Events = {
126 DOMStorageAdded: "DOMStorageAdded", 128 DOMStorageAdded: Symbol("DOMStorageAdded"),
127 DOMStorageRemoved: "DOMStorageRemoved" 129 DOMStorageRemoved: Symbol("DOMStorageRemoved")
128 } 130 }
129 131
130 WebInspector.DOMStorageModel.prototype = { 132 WebInspector.DOMStorageModel.prototype = {
131 enable: function() 133 enable: function()
132 { 134 {
133 if (this._enabled) 135 if (this._enabled)
134 return; 136 return;
135 137
136 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi spatcher(this)); 138 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi spatcher(this));
137 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); 139 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin Manager.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 * @return {!WebInspector.DOMStorageModel} 362 * @return {!WebInspector.DOMStorageModel}
361 */ 363 */
362 WebInspector.DOMStorageModel.fromTarget = function(target) 364 WebInspector.DOMStorageModel.fromTarget = function(target)
363 { 365 {
364 var model = /** @type {?WebInspector.DOMStorageModel} */ (target.model(WebIn spector.DOMStorageModel)); 366 var model = /** @type {?WebInspector.DOMStorageModel} */ (target.model(WebIn spector.DOMStorageModel));
365 if (!model) { 367 if (!model) {
366 model = new WebInspector.DOMStorageModel(target, WebInspector.SecurityOr iginManager.fromTarget(target)); 368 model = new WebInspector.DOMStorageModel(target, WebInspector.SecurityOr iginManager.fromTarget(target));
367 } 369 }
368 return model; 370 return model;
369 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698