| 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)) objectInfo = CreateObjectInfo(object); | 397 if (IS_UNDEFINED(objectInfo)) { |
| 398 objectInfo = CreateObjectInfo(object); |
| 399 %SetIsObserved(object); |
| 400 } |
| 398 | 401 |
| 399 if (IS_NULL(objectInfo.notifier)) { | 402 if (IS_NULL(objectInfo.notifier)) { |
| 400 objectInfo.notifier = { __proto__: notifierPrototype }; | 403 objectInfo.notifier = { __proto__: notifierPrototype }; |
| 401 notifierTargetMap.set(objectInfo.notifier, object); | 404 notifierTargetMap.set(objectInfo.notifier, object); |
| 402 } | 405 } |
| 403 | 406 |
| 404 return objectInfo.notifier; | 407 return objectInfo.notifier; |
| 405 } | 408 } |
| 406 | 409 |
| 407 function CallbackDeliverPending(callback) { | 410 function CallbackDeliverPending(callback) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 "observe", ArrayObserve, | 456 "observe", ArrayObserve, |
| 454 "unobserve", ArrayUnobserve | 457 "unobserve", ArrayUnobserve |
| 455 )); | 458 )); |
| 456 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 459 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
| 457 "notify", ObjectNotifierNotify, | 460 "notify", ObjectNotifierNotify, |
| 458 "performChange", ObjectNotifierPerformChange | 461 "performChange", ObjectNotifierPerformChange |
| 459 )); | 462 )); |
| 460 } | 463 } |
| 461 | 464 |
| 462 SetupObjectObserve(); | 465 SetupObjectObserve(); |
| OLD | NEW |