| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 function ObservationWeakMap(map) { | 39 function ObservationWeakMap(map) { |
| 40 this.map_ = map; | 40 this.map_ = map; |
| 41 } | 41 } |
| 42 | 42 |
| 43 ObservationWeakMap.prototype = { | 43 ObservationWeakMap.prototype = { |
| 44 get: function(key) { | 44 get: function(key) { |
| 45 key = %UnwrapGlobalProxy(key); | 45 key = %UnwrapGlobalProxy(key); |
| 46 if (!IS_SPEC_OBJECT(key)) return void 0; | 46 if (!IS_SPEC_OBJECT(key)) return void 0; |
| 47 return %WeakMapGet(this.map_, key); | 47 return %WeakCollectionGet(this.map_, key); |
| 48 }, | 48 }, |
| 49 set: function(key, value) { | 49 set: function(key, value) { |
| 50 key = %UnwrapGlobalProxy(key); | 50 key = %UnwrapGlobalProxy(key); |
| 51 if (!IS_SPEC_OBJECT(key)) return void 0; | 51 if (!IS_SPEC_OBJECT(key)) return void 0; |
| 52 %WeakMapSet(this.map_, key, value); | 52 %WeakCollectionSet(this.map_, key, value); |
| 53 }, | 53 }, |
| 54 has: function(key) { | 54 has: function(key) { |
| 55 return !IS_UNDEFINED(this.get(key)); | 55 return !IS_UNDEFINED(this.get(key)); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 var callbackInfoMap = | 59 var callbackInfoMap = |
| 60 new ObservationWeakMap(observationState.callbackInfoMap); | 60 new ObservationWeakMap(observationState.callbackInfoMap); |
| 61 var objectInfoMap = new ObservationWeakMap(observationState.objectInfoMap); | 61 var objectInfoMap = new ObservationWeakMap(observationState.objectInfoMap); |
| 62 var notifierTargetMap = | 62 var notifierTargetMap = |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 "observe", ArrayObserve, | 453 "observe", ArrayObserve, |
| 454 "unobserve", ArrayUnobserve | 454 "unobserve", ArrayUnobserve |
| 455 )); | 455 )); |
| 456 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 456 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
| 457 "notify", ObjectNotifierNotify, | 457 "notify", ObjectNotifierNotify, |
| 458 "performChange", ObjectNotifierPerformChange | 458 "performChange", ObjectNotifierPerformChange |
| 459 )); | 459 )); |
| 460 } | 460 } |
| 461 | 461 |
| 462 SetupObjectObserve(); | 462 SetupObjectObserve(); |
| OLD | NEW |