Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: src/object-observe.js

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 var callback = ObserverGetCallback(observer); 383 var callback = ObserverGetCallback(observer);
384 if (needsAccessCheck && 384 if (needsAccessCheck &&
385 // Drop all splice records on the floor for access-checked objects 385 // Drop all splice records on the floor for access-checked objects
386 (changeRecord.type == 'splice' || 386 (changeRecord.type == 'splice' ||
387 !%IsAccessAllowedForObserver( 387 !%IsAccessAllowedForObserver(
388 callback, changeRecord.object, changeRecord.name))) { 388 callback, changeRecord.object, changeRecord.name))) {
389 return; 389 return;
390 } 390 }
391 391
392 var callbackInfo = CallbackInfoNormalize(callback); 392 var callbackInfo = CallbackInfoNormalize(callback);
393 if (IS_NULL(observationState.pendingObservers)) { 393 if (!observationState.pendingObservers)
394 observationState.pendingObservers = nullProtoObject(); 394 observationState.pendingObservers = nullProtoObject();
395 GetMicrotaskQueue().push(ObserveMicrotaskRunner);
396 %SetMicrotaskPending(true);
397 }
398 observationState.pendingObservers[callbackInfo.priority] = callback; 395 observationState.pendingObservers[callbackInfo.priority] = callback;
399 callbackInfo.push(changeRecord); 396 callbackInfo.push(changeRecord);
397 %SetMicrotaskPending(true);
400 } 398 }
401 399
402 function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { 400 function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) {
403 if (!ObjectInfoHasActiveObservers(objectInfo)) 401 if (!ObjectInfoHasActiveObservers(objectInfo))
404 return; 402 return;
405 403
406 var hasType = !IS_UNDEFINED(type); 404 var hasType = !IS_UNDEFINED(type);
407 var newRecord = hasType ? 405 var newRecord = hasType ?
408 { object: ObjectInfoGetObject(objectInfo), type: type } : 406 { object: ObjectInfoGetObject(objectInfo), type: type } :
409 { object: ObjectInfoGetObject(objectInfo) }; 407 { object: ObjectInfoGetObject(objectInfo) };
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 576
579 function ObserveMicrotaskRunner() { 577 function ObserveMicrotaskRunner() {
580 var pendingObservers = observationState.pendingObservers; 578 var pendingObservers = observationState.pendingObservers;
581 if (pendingObservers) { 579 if (pendingObservers) {
582 observationState.pendingObservers = null; 580 observationState.pendingObservers = null;
583 for (var i in pendingObservers) { 581 for (var i in pendingObservers) {
584 CallbackDeliverPending(pendingObservers[i]); 582 CallbackDeliverPending(pendingObservers[i]);
585 } 583 }
586 } 584 }
587 } 585 }
586 RunMicrotasks.runners.push(ObserveMicrotaskRunner);
588 587
589 function SetupObjectObserve() { 588 function SetupObjectObserve() {
590 %CheckIsBootstrapping(); 589 %CheckIsBootstrapping();
591 InstallFunctions($Object, DONT_ENUM, $Array( 590 InstallFunctions($Object, DONT_ENUM, $Array(
592 "deliverChangeRecords", ObjectDeliverChangeRecords, 591 "deliverChangeRecords", ObjectDeliverChangeRecords,
593 "getNotifier", ObjectGetNotifier, 592 "getNotifier", ObjectGetNotifier,
594 "observe", ObjectObserve, 593 "observe", ObjectObserve,
595 "unobserve", ObjectUnobserve 594 "unobserve", ObjectUnobserve
596 )); 595 ));
597 InstallFunctions($Array, DONT_ENUM, $Array( 596 InstallFunctions($Array, DONT_ENUM, $Array(
598 "observe", ArrayObserve, 597 "observe", ArrayObserve,
599 "unobserve", ArrayUnobserve 598 "unobserve", ArrayUnobserve
600 )); 599 ));
601 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( 600 InstallFunctions(notifierPrototype, DONT_ENUM, $Array(
602 "notify", ObjectNotifierNotify, 601 "notify", ObjectNotifierNotify,
603 "performChange", ObjectNotifierPerformChange 602 "performChange", ObjectNotifierPerformChange
604 )); 603 ));
605 } 604 }
606 605
607 SetupObjectObserve(); 606 SetupObjectObserve();
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698