| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 InternalObjectHashTable.prototype = { | 43 InternalObjectHashTable.prototype = { |
| 44 get: function(key) { | 44 get: function(key) { |
| 45 return %ObjectHashTableGet(observationState[this.tableName], key); | 45 return %ObjectHashTableGet(observationState[this.tableName], key); |
| 46 }, | 46 }, |
| 47 set: function(key, value) { | 47 set: function(key, value) { |
| 48 observationState[this.tableName] = | 48 observationState[this.tableName] = |
| 49 %ObjectHashTableSet(observationState[this.tableName], key, value); | 49 %ObjectHashTableSet(observationState[this.tableName], key, value); |
| 50 }, | 50 }, |
| 51 has: function(key) { | 51 has: function(key) { |
| 52 return %ObjectHashTableHas(observationState[this.tableName], key); | 52 return !IS_UNDEFINED(this.get(key)); |
| 53 } | 53 } |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 var observerInfoMap = new InternalObjectHashTable('observerInfoMap'); | 56 var observerInfoMap = new InternalObjectHashTable('observerInfoMap'); |
| 57 var objectInfoMap = new InternalObjectHashTable('objectInfoMap'); | 57 var objectInfoMap = new InternalObjectHashTable('objectInfoMap'); |
| 58 var notifierTargetMap = new InternalObjectHashTable('notifierTargetMap'); | 58 var notifierTargetMap = new InternalObjectHashTable('notifierTargetMap'); |
| 59 | 59 |
| 60 function CreateObjectInfo(object) { | 60 function CreateObjectInfo(object) { |
| 61 var info = { | 61 var info = { |
| 62 changeObservers: new InternalArray, | 62 changeObservers: new InternalArray, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 "getNotifier", ObjectGetNotifier, | 233 "getNotifier", ObjectGetNotifier, |
| 234 "observe", ObjectObserve, | 234 "observe", ObjectObserve, |
| 235 "unobserve", ObjectUnobserve | 235 "unobserve", ObjectUnobserve |
| 236 )); | 236 )); |
| 237 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 237 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
| 238 "notify", ObjectNotifierNotify | 238 "notify", ObjectNotifierNotify |
| 239 )); | 239 )); |
| 240 } | 240 } |
| 241 | 241 |
| 242 SetupObjectObserve(); | 242 SetupObjectObserve(); |
| OLD | NEW |