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

Side by Side Diff: src/api.cc

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 years, 10 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 | « samples/shell.cc ('k') | src/d8.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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 if (!result) return false; 619 if (!result) return false;
620 } 620 }
621 if (constraints->stack_limit() != NULL) { 621 if (constraints->stack_limit() != NULL) {
622 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); 622 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
623 isolate->stack_guard()->SetStackLimit(limit); 623 isolate->stack_guard()->SetStackLimit(limit);
624 } 624 }
625 return true; 625 return true;
626 } 626 }
627 627
628 628
629 i::Object** V8::GlobalizeReference(i::Object** obj) { 629 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) {
630 i::Isolate* isolate = i::Isolate::Current();
631 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; 630 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL;
632 LOG_API(isolate, "Persistent::New"); 631 LOG_API(isolate, "Persistent::New");
633 i::Handle<i::Object> result = 632 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
634 isolate->global_handles()->Create(*obj);
635 return result.location(); 633 return result.location();
636 } 634 }
637 635
638 636
639 void V8::MakeWeak(i::Object** object, void* parameters, 637 void V8::MakeWeak(i::Isolate* isolate,
640 WeakReferenceCallback callback) { 638 i::Object** object,
641 i::Isolate* isolate = i::Isolate::Current(); 639 void* parameters,
640 WeakReferenceCallback weak_reference_callback,
641 NearDeathCallback near_death_callback) {
642 ASSERT(isolate == i::Isolate::Current());
642 LOG_API(isolate, "MakeWeak"); 643 LOG_API(isolate, "MakeWeak");
643 isolate->global_handles()->MakeWeak(object, parameters, 644 isolate->global_handles()->MakeWeak(object,
644 callback); 645 parameters,
646 weak_reference_callback,
647 near_death_callback);
645 } 648 }
646 649
647 650
648 void V8::MakeWeak(i::Isolate* isolate, i::Object** object, 651 void V8::ClearWeak(i::Isolate* isolate, i::Object** obj) {
649 void* parameters, WeakReferenceCallback callback) {
650 ASSERT(isolate == i::Isolate::Current());
651 LOG_API(isolate, "MakeWeak");
652 isolate->global_handles()->MakeWeak(object, parameters,
653 callback);
654 }
655
656
657 void V8::ClearWeak(i::Object** obj) {
658 i::Isolate* isolate = i::Isolate::Current();
659 LOG_API(isolate, "ClearWeak"); 652 LOG_API(isolate, "ClearWeak");
660 isolate->global_handles()->ClearWeakness(obj); 653 isolate->global_handles()->ClearWeakness(obj);
661 } 654 }
662 655
663 656
664 void V8::MarkIndependent(i::Object** object) {
665 i::Isolate* isolate = i::Isolate::Current();
666 LOG_API(isolate, "MarkIndependent");
667 isolate->global_handles()->MarkIndependent(object);
668 }
669
670
671 void V8::MarkPartiallyDependent(i::Object** object) {
672 i::Isolate* isolate = i::Isolate::Current();
673 LOG_API(isolate, "MarkPartiallyDependent");
674 isolate->global_handles()->MarkPartiallyDependent(object);
675 }
676
677
678 bool V8::IsGlobalIndependent(i::Object** obj) {
679 i::Isolate* isolate = i::Isolate::Current();
680 LOG_API(isolate, "IsGlobalIndependent");
681 if (!isolate->IsInitialized()) return false;
682 return i::GlobalHandles::IsIndependent(obj);
683 }
684
685
686 bool V8::IsGlobalNearDeath(i::Object** obj) {
687 i::Isolate* isolate = i::Isolate::Current();
688 LOG_API(isolate, "IsGlobalNearDeath");
689 if (!isolate->IsInitialized()) return false;
690 return i::GlobalHandles::IsNearDeath(obj);
691 }
692
693
694 bool V8::IsGlobalWeak(i::Object** obj) {
695 i::Isolate* isolate = i::Isolate::Current();
696 LOG_API(isolate, "IsGlobalWeak");
697 if (!isolate->IsInitialized()) return false;
698 return i::GlobalHandles::IsWeak(obj);
699 }
700
701
702 bool V8::IsGlobalWeak(i::Isolate* isolate, i::Object** obj) {
703 ASSERT(isolate == i::Isolate::Current());
704 LOG_API(isolate, "IsGlobalWeak");
705 if (!isolate->IsInitialized()) return false;
706 return i::GlobalHandles::IsWeak(obj);
707 }
708
709
710 void V8::DisposeGlobal(i::Object** obj) {
711 i::Isolate* isolate = i::Isolate::Current();
712 LOG_API(isolate, "DisposeGlobal");
713 if (!isolate->IsInitialized()) return;
714 isolate->global_handles()->Destroy(obj);
715 }
716
717
718 void V8::DisposeGlobal(i::Isolate* isolate, i::Object** obj) { 657 void V8::DisposeGlobal(i::Isolate* isolate, i::Object** obj) {
719 ASSERT(isolate == i::Isolate::Current()); 658 ASSERT(isolate == i::Isolate::Current());
720 LOG_API(isolate, "DisposeGlobal"); 659 LOG_API(isolate, "DisposeGlobal");
721 if (!isolate->IsInitialized()) return; 660 if (!isolate->IsInitialized()) return;
722 isolate->global_handles()->Destroy(obj); 661 isolate->global_handles()->Destroy(obj);
723 } 662 }
724 663
725 // --- H a n d l e s --- 664 // --- H a n d l e s ---
726 665
727 666
(...skipping 6028 matching lines...) Expand 10 before | Expand all | Expand 10 after
6756 6695
6757 v->VisitPointers(blocks_.first(), first_block_limit_); 6696 v->VisitPointers(blocks_.first(), first_block_limit_);
6758 6697
6759 for (int i = 1; i < blocks_.length(); i++) { 6698 for (int i = 1; i < blocks_.length(); i++) {
6760 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6699 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6761 } 6700 }
6762 } 6701 }
6763 6702
6764 6703
6765 } } // namespace v8::internal 6704 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « samples/shell.cc ('k') | src/d8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698