| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 function ObjectGetNotifier(object) { | 390 function ObjectGetNotifier(object) { |
| 391 if (!IS_SPEC_OBJECT(object)) | 391 if (!IS_SPEC_OBJECT(object)) |
| 392 throw MakeTypeError("observe_non_object", ["getNotifier"]); | 392 throw MakeTypeError("observe_non_object", ["getNotifier"]); |
| 393 | 393 |
| 394 if (ObjectIsFrozen(object)) return null; | 394 if (ObjectIsFrozen(object)) return null; |
| 395 | 395 |
| 396 var objectInfo = objectInfoMap.get(object); | 396 var objectInfo = objectInfoMap.get(object); |
| 397 if (IS_UNDEFINED(objectInfo)) { | 397 if (IS_UNDEFINED(objectInfo)) objectInfo = CreateObjectInfo(object); |
| 398 objectInfo = CreateObjectInfo(object); | |
| 399 %SetIsObserved(object); | |
| 400 } | |
| 401 | 398 |
| 402 if (IS_NULL(objectInfo.notifier)) { | 399 if (IS_NULL(objectInfo.notifier)) { |
| 403 objectInfo.notifier = { __proto__: notifierPrototype }; | 400 objectInfo.notifier = { __proto__: notifierPrototype }; |
| 404 notifierTargetMap.set(objectInfo.notifier, object); | 401 notifierTargetMap.set(objectInfo.notifier, object); |
| 405 } | 402 } |
| 406 | 403 |
| 407 return objectInfo.notifier; | 404 return objectInfo.notifier; |
| 408 } | 405 } |
| 409 | 406 |
| 410 function CallbackDeliverPending(callback) { | 407 function CallbackDeliverPending(callback) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 "observe", ArrayObserve, | 453 "observe", ArrayObserve, |
| 457 "unobserve", ArrayUnobserve | 454 "unobserve", ArrayUnobserve |
| 458 )); | 455 )); |
| 459 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 456 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
| 460 "notify", ObjectNotifierNotify, | 457 "notify", ObjectNotifierNotify, |
| 461 "performChange", ObjectNotifierPerformChange | 458 "performChange", ObjectNotifierPerformChange |
| 462 )); | 459 )); |
| 463 } | 460 } |
| 464 | 461 |
| 465 SetupObjectObserve(); | 462 SetupObjectObserve(); |
| OLD | NEW |