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

Side by Side Diff: ui/webui/resources/js/cr.js

Issue 460163002: Handle property definition by {cr|Object}.defineProperty() in compiler pass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@C_compiler_pass
Patch Set: define property on prototype, also minor nits Created 6 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * The global object. 6 * The global object.
7 * @type {!Object} 7 * @type {!Object}
8 * @const 8 * @const
9 */ 9 */
10 var global = this; 10 var global = this;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 /** 69 /**
70 * The kind of property to define in {@code defineProperty}. 70 * The kind of property to define in {@code defineProperty}.
71 * @enum {string} 71 * @enum {string}
72 * @const 72 * @const
73 */ 73 */
74 var PropertyKind = { 74 var PropertyKind = {
75 /** 75 /**
76 * Plain old JS property where the backing data is stored as a "private" 76 * Plain old JS property where the backing data is stored as a "private"
77 * field on the object. 77 * field on the object.
78 * Use only for properties of any type.
Tyler Breisacher (Chromium) 2014/08/13 20:35:43 s/only //
Vitaly Pavlenko 2014/08/13 21:12:04 Done.
78 */ 79 */
79 JS: 'js', 80 JS: 'js',
80 81
81 /** 82 /**
82 * The property backing data is stored as an attribute on an element. 83 * The property backing data is stored as an attribute on an element.
84 * Use only for properties of type {string}.
83 */ 85 */
84 ATTR: 'attr', 86 ATTR: 'attr',
85 87
86 /** 88 /**
87 * The property backing data is stored as an attribute on an element. If the 89 * The property backing data is stored as an attribute on an element. If the
88 * element has the attribute then the value is true. 90 * element has the attribute then the value is true.
91 * Use only for properties of type {boolean}.
89 */ 92 */
90 BOOL_ATTR: 'boolAttr' 93 BOOL_ATTR: 'boolAttr'
91 }; 94 };
92 95
93 /** 96 /**
94 * Helper function for defineProperty that returns the getter to use for the 97 * Helper function for defineProperty that returns the getter to use for the
95 * property. 98 * property.
96 * @param {string} name The name of the property. 99 * @param {string} name The name of the property.
97 * @param {PropertyKind} kind The kind of the property. 100 * @param {PropertyKind} kind The kind of the property.
98 * @return {function():*} The getter for the property. 101 * @return {function():*} The getter for the property.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return /Linux/.test(navigator.userAgent); 328 return /Linux/.test(navigator.userAgent);
326 }, 329 },
327 330
328 /** Whether this uses the views toolkit or not. */ 331 /** Whether this uses the views toolkit or not. */
329 get isViews() { 332 get isViews() {
330 return typeof chrome.getVariableValue == 'function' && 333 return typeof chrome.getVariableValue == 'function' &&
331 /views/.test(chrome.getVariableValue('toolkit')); 334 /views/.test(chrome.getVariableValue('toolkit'));
332 }, 335 },
333 }; 336 };
334 }(); 337 }();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698