| OLD | NEW |
| 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 var nativeDeepCopy = requireNative('utils').deepCopy; | 5 var nativeDeepCopy = requireNative('utils').deepCopy; |
| 6 var schemaRegistry = requireNative('schema_registry'); | 6 var schemaRegistry = requireNative('schema_registry'); |
| 7 var CHECK = requireNative('logging').CHECK; | 7 var CHECK = requireNative('logging').CHECK; |
| 8 var DCHECK = requireNative('logging').DCHECK; | 8 var DCHECK = requireNative('logging').DCHECK; |
| 9 var WARNING = requireNative('logging').WARNING; | 9 var WARNING = requireNative('logging').WARNING; |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 * functions: ?Array<string>, | 83 * functions: ?Array<string>, |
| 84 * properties: ?Array<string>, | 84 * properties: ?Array<string>, |
| 85 * readonly: ?Array<string>}} exposed The names of properties on the | 85 * readonly: ?Array<string>}} exposed The names of properties on the |
| 86 * implementation class to be exposed. |superclass| represents the | 86 * implementation class to be exposed. |superclass| represents the |
| 87 * constructor of the class to be used as the superclass of the exposed | 87 * constructor of the class to be used as the superclass of the exposed |
| 88 * class; |functions| represents the names of functions which should be | 88 * class; |functions| represents the names of functions which should be |
| 89 * delegated to the implementation; |properties| are gettable/settable | 89 * delegated to the implementation; |properties| are gettable/settable |
| 90 * properties and |readonly| are read-only properties. | 90 * properties and |readonly| are read-only properties. |
| 91 */ | 91 */ |
| 92 function expose(publicClass, privateClass, exposed) { | 92 function expose(publicClass, privateClass, exposed) { |
| 93 // TODO(robwu): Fix callers and uncomment this assertion. | 93 DCHECK(!(privateClass instanceof $Object.self)); |
| 94 // DCHECK(!(privateClass instanceof $Object.self)); | |
| 95 | 94 |
| 96 $Object.setPrototypeOf(exposed, null); | 95 $Object.setPrototypeOf(exposed, null); |
| 97 | 96 |
| 98 // This should be called by publicClass. | 97 // This should be called by publicClass. |
| 99 privates(publicClass).constructPrivate = function(self, args) { | 98 privates(publicClass).constructPrivate = function(self, args) { |
| 100 if (!(self instanceof publicClass)) { | 99 if (!(self instanceof publicClass)) { |
| 101 throw new Error('Please use "new ' + publicClass.name + '"'); | 100 throw new Error('Please use "new ' + publicClass.name + '"'); |
| 102 } | 101 } |
| 103 // The "instanceof publicClass" check can easily be spoofed, so we check | 102 // The "instanceof publicClass" check can easily be spoofed, so we check |
| 104 // whether the private impl is already set before continuing. | 103 // whether the private impl is already set before continuing. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 $Function.apply(func, null, args); | 213 $Function.apply(func, null, args); |
| 215 }); | 214 }); |
| 216 } | 215 } |
| 217 | 216 |
| 218 exports.$set('forEach', forEach); | 217 exports.$set('forEach', forEach); |
| 219 exports.$set('loadTypeSchema', loadTypeSchema); | 218 exports.$set('loadTypeSchema', loadTypeSchema); |
| 220 exports.$set('lookup', lookup); | 219 exports.$set('lookup', lookup); |
| 221 exports.$set('expose', expose); | 220 exports.$set('expose', expose); |
| 222 exports.$set('deepCopy', deepCopy); | 221 exports.$set('deepCopy', deepCopy); |
| 223 exports.$set('promise', promise); | 222 exports.$set('promise', promise); |
| OLD | NEW |