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

Side by Side Diff: src/api.cc

Issue 11360082: Pass Isolate to MakeWeak(), IsWeak(), and AddObjectGroup(). (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 isolate->global_handles()->Create(*obj); 623 isolate->global_handles()->Create(*obj);
624 return result.location(); 624 return result.location();
625 } 625 }
626 626
627 627
628 void V8::MakeWeak(i::Object** object, void* parameters, 628 void V8::MakeWeak(i::Object** object, void* parameters,
629 WeakReferenceCallback callback) { 629 WeakReferenceCallback callback) {
630 i::Isolate* isolate = i::Isolate::Current(); 630 i::Isolate* isolate = i::Isolate::Current();
631 LOG_API(isolate, "MakeWeak"); 631 LOG_API(isolate, "MakeWeak");
632 isolate->global_handles()->MakeWeak(object, parameters, 632 isolate->global_handles()->MakeWeak(object, parameters,
633 callback); 633 callback);
634 } 634 }
635 635
636 636
637 void V8::MakeWeak(i::Isolate* isolate, i::Object** object,
638 void* parameters, WeakReferenceCallback callback) {
639 ASSERT(isolate == i::Isolate::Current());
640 LOG_API(isolate, "MakeWeak");
641 isolate->global_handles()->MakeWeak(object, parameters,
642 callback);
643 }
644
645
637 void V8::ClearWeak(i::Object** obj) { 646 void V8::ClearWeak(i::Object** obj) {
638 i::Isolate* isolate = i::Isolate::Current(); 647 i::Isolate* isolate = i::Isolate::Current();
639 LOG_API(isolate, "ClearWeak"); 648 LOG_API(isolate, "ClearWeak");
640 isolate->global_handles()->ClearWeakness(obj); 649 isolate->global_handles()->ClearWeakness(obj);
641 } 650 }
642 651
643 652
644 void V8::MarkIndependent(i::Object** object) { 653 void V8::MarkIndependent(i::Object** object) {
645 i::Isolate* isolate = i::Isolate::Current(); 654 i::Isolate* isolate = i::Isolate::Current();
646 LOG_API(isolate, "MarkIndependent"); 655 LOG_API(isolate, "MarkIndependent");
(...skipping 18 matching lines...) Expand all
665 674
666 675
667 bool V8::IsGlobalWeak(i::Object** obj) { 676 bool V8::IsGlobalWeak(i::Object** obj) {
668 i::Isolate* isolate = i::Isolate::Current(); 677 i::Isolate* isolate = i::Isolate::Current();
669 LOG_API(isolate, "IsGlobalWeak"); 678 LOG_API(isolate, "IsGlobalWeak");
670 if (!isolate->IsInitialized()) return false; 679 if (!isolate->IsInitialized()) return false;
671 return i::GlobalHandles::IsWeak(obj); 680 return i::GlobalHandles::IsWeak(obj);
672 } 681 }
673 682
674 683
684 bool V8::IsGlobalWeak(i::Isolate* isolate, i::Object** obj) {
685 ASSERT(isolate == i::Isolate::Current());
686 LOG_API(isolate, "IsGlobalWeak");
687 if (!isolate->IsInitialized()) return false;
688 return i::GlobalHandles::IsWeak(obj);
689 }
690
691
675 void V8::DisposeGlobal(i::Object** obj) { 692 void V8::DisposeGlobal(i::Object** obj) {
676 i::Isolate* isolate = i::Isolate::Current(); 693 i::Isolate* isolate = i::Isolate::Current();
677 LOG_API(isolate, "DisposeGlobal"); 694 LOG_API(isolate, "DisposeGlobal");
678 if (!isolate->IsInitialized()) return; 695 if (!isolate->IsInitialized()) return;
679 isolate->global_handles()->Destroy(obj); 696 isolate->global_handles()->Destroy(obj);
680 } 697 }
681 698
682 // --- H a n d l e s --- 699 // --- H a n d l e s ---
683 700
684 701
(...skipping 4659 matching lines...) Expand 10 before | Expand all | Expand 10 after
5344 5361
5345 void V8::SetFailedAccessCheckCallbackFunction( 5362 void V8::SetFailedAccessCheckCallbackFunction(
5346 FailedAccessCheckCallback callback) { 5363 FailedAccessCheckCallback callback) {
5347 i::Isolate* isolate = i::Isolate::Current(); 5364 i::Isolate* isolate = i::Isolate::Current();
5348 if (IsDeadCheck(isolate, "v8::V8::SetFailedAccessCheckCallbackFunction()")) { 5365 if (IsDeadCheck(isolate, "v8::V8::SetFailedAccessCheckCallbackFunction()")) {
5349 return; 5366 return;
5350 } 5367 }
5351 isolate->SetFailedAccessCheckCallback(callback); 5368 isolate->SetFailedAccessCheckCallback(callback);
5352 } 5369 }
5353 5370
5371
5354 void V8::AddObjectGroup(Persistent<Value>* objects, 5372 void V8::AddObjectGroup(Persistent<Value>* objects,
5355 size_t length, 5373 size_t length,
5356 RetainedObjectInfo* info) { 5374 RetainedObjectInfo* info) {
5357 i::Isolate* isolate = i::Isolate::Current(); 5375 i::Isolate* isolate = i::Isolate::Current();
5358 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return; 5376 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return;
5359 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 5377 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5360 isolate->global_handles()->AddObjectGroup( 5378 isolate->global_handles()->AddObjectGroup(
5361 reinterpret_cast<i::Object***>(objects), length, info); 5379 reinterpret_cast<i::Object***>(objects), length, info);
5362 } 5380 }
5363 5381
5364 5382
5383 void V8::AddObjectGroup(Isolate* exportedIsolate,
5384 Persistent<Value>* objects,
5385 size_t length,
5386 RetainedObjectInfo* info) {
5387 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exportedIsolate);
5388 ASSERT(isolate == i::Isolate::Current());
5389 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return;
5390 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5391 isolate->global_handles()->AddObjectGroup(
5392 reinterpret_cast<i::Object***>(objects), length, info);
5393 }
5394
5395
5365 void V8::AddImplicitReferences(Persistent<Object> parent, 5396 void V8::AddImplicitReferences(Persistent<Object> parent,
5366 Persistent<Value>* children, 5397 Persistent<Value>* children,
5367 size_t length) { 5398 size_t length) {
5368 i::Isolate* isolate = i::Isolate::Current(); 5399 i::Isolate* isolate = i::Isolate::Current();
5369 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return; 5400 if (IsDeadCheck(isolate, "v8::V8::AddImplicitReferences()")) return;
5370 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 5401 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
5371 isolate->global_handles()->AddImplicitReferences( 5402 isolate->global_handles()->AddImplicitReferences(
5372 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(), 5403 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(*parent)).location(),
5373 reinterpret_cast<i::Object***>(children), length); 5404 reinterpret_cast<i::Object***>(children), length);
5374 } 5405 }
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
6639 6670
6640 v->VisitPointers(blocks_.first(), first_block_limit_); 6671 v->VisitPointers(blocks_.first(), first_block_limit_);
6641 6672
6642 for (int i = 1; i < blocks_.length(); i++) { 6673 for (int i = 1; i < blocks_.length(); i++) {
6643 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6674 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6644 } 6675 }
6645 } 6676 }
6646 6677
6647 6678
6648 } } // namespace v8::internal 6679 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698