| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (!IS_UNDEFINED(objectInfo)) | 287 if (!IS_UNDEFINED(objectInfo)) |
| 288 BeginPerformChange(objectInfo, 'splice'); | 288 BeginPerformChange(objectInfo, 'splice'); |
| 289 } | 289 } |
| 290 | 290 |
| 291 function EndPerformSplice(array) { | 291 function EndPerformSplice(array) { |
| 292 var objectInfo = objectInfoMap.get(array); | 292 var objectInfo = objectInfoMap.get(array); |
| 293 if (!IS_UNDEFINED(objectInfo)) | 293 if (!IS_UNDEFINED(objectInfo)) |
| 294 EndPerformChange(objectInfo, 'splice'); | 294 EndPerformChange(objectInfo, 'splice'); |
| 295 } | 295 } |
| 296 | 296 |
| 297 function EnqueueSpliceRecord(array, index, removed, deleteCount, addedCount) { | 297 function EnqueueSpliceRecord(array, index, removed, addedCount) { |
| 298 var objectInfo = objectInfoMap.get(array); | 298 var objectInfo = objectInfoMap.get(array); |
| 299 if (IS_UNDEFINED(objectInfo) || objectInfo.changeObservers.length === 0) | 299 if (IS_UNDEFINED(objectInfo) || objectInfo.changeObservers.length === 0) |
| 300 return; | 300 return; |
| 301 | 301 |
| 302 var changeRecord = { | 302 var changeRecord = { |
| 303 type: 'splice', | 303 type: 'splice', |
| 304 object: array, | 304 object: array, |
| 305 index: index, | 305 index: index, |
| 306 removed: removed, | 306 removed: removed, |
| 307 addedCount: addedCount | 307 addedCount: addedCount |
| 308 }; | 308 }; |
| 309 | 309 |
| 310 changeRecord.removed.length = deleteCount; | |
| 311 ObjectFreeze(changeRecord); | 310 ObjectFreeze(changeRecord); |
| 312 ObjectFreeze(changeRecord.removed); | 311 ObjectFreeze(changeRecord.removed); |
| 313 EnqueueChangeRecord(changeRecord, objectInfo.changeObservers); | 312 EnqueueChangeRecord(changeRecord, objectInfo.changeObservers); |
| 314 } | 313 } |
| 315 | 314 |
| 316 function NotifyChange(type, object, name, oldValue) { | 315 function NotifyChange(type, object, name, oldValue) { |
| 317 var objectInfo = objectInfoMap.get(object); | 316 var objectInfo = objectInfoMap.get(object); |
| 318 if (objectInfo.changeObservers.length === 0) | 317 if (objectInfo.changeObservers.length === 0) |
| 319 return; | 318 return; |
| 320 | 319 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 "observe", ArrayObserve, | 446 "observe", ArrayObserve, |
| 448 "unobserve", ArrayUnobserve | 447 "unobserve", ArrayUnobserve |
| 449 )); | 448 )); |
| 450 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 449 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
| 451 "notify", ObjectNotifierNotify, | 450 "notify", ObjectNotifierNotify, |
| 452 "performChange", ObjectNotifierPerformChange | 451 "performChange", ObjectNotifierPerformChange |
| 453 )); | 452 )); |
| 454 } | 453 } |
| 455 | 454 |
| 456 SetupObjectObserve(); | 455 SetupObjectObserve(); |
| OLD | NEW |