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

Side by Side Diff: src/api.cc

Issue 260017: Implemented really weak handles. (Closed)
Patch Set: Fix typo. Created 11 years, 2 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 367
368 void V8::MakeWeak(i::Object** object, void* parameters, 368 void V8::MakeWeak(i::Object** object, void* parameters,
369 WeakReferenceCallback callback) { 369 WeakReferenceCallback callback) {
370 LOG_API("MakeWeak"); 370 LOG_API("MakeWeak");
371 i::GlobalHandles::MakeWeak(object, parameters, callback); 371 i::GlobalHandles::MakeWeak(object, parameters, callback);
372 } 372 }
373 373
374 374
375 void V8::MakeReallyWeak(i::Object** object, void* parameters,
376 WeakReferenceCallback callback) {
377 LOG_API("MakeReallyWeak");
378 i::GlobalHandles::MakeReallyWeak(object, parameters, callback);
379 }
380
381
375 void V8::ClearWeak(i::Object** obj) { 382 void V8::ClearWeak(i::Object** obj) {
376 LOG_API("ClearWeak"); 383 LOG_API("ClearWeak");
377 i::GlobalHandles::ClearWeakness(obj); 384 i::GlobalHandles::ClearWeakness(obj);
378 } 385 }
379 386
380 387
381 bool V8::IsGlobalNearDeath(i::Object** obj) { 388 bool V8::IsGlobalNearDeath(i::Object** obj) {
382 LOG_API("IsGlobalNearDeath"); 389 LOG_API("IsGlobalNearDeath");
383 if (!i::V8::IsRunning()) return false; 390 if (!i::V8::IsRunning()) return false;
384 return i::GlobalHandles::IsNearDeath(obj); 391 return i::GlobalHandles::IsNearDeath(obj);
385 } 392 }
386 393
387 394
388 bool V8::IsGlobalWeak(i::Object** obj) { 395 bool V8::IsGlobalWeak(i::Object** obj) {
389 LOG_API("IsGlobalWeak"); 396 LOG_API("IsGlobalWeak");
390 if (!i::V8::IsRunning()) return false; 397 if (!i::V8::IsRunning()) return false;
391 return i::GlobalHandles::IsWeak(obj); 398 return i::GlobalHandles::IsWeak(obj);
392 } 399 }
393 400
394 401
395 void V8::DisposeGlobal(i::Object** obj) { 402 void V8::DisposeGlobal(i::Object** obj) {
396 LOG_API("DisposeGlobal"); 403 LOG_API("DisposeGlobal");
397 if (!i::V8::IsRunning()) return; 404 if (!i::V8::IsRunning()) return;
398 if ((*obj)->IsGlobalContext()) i::Heap::NotifyContextDisposed(); 405 if (!i::GlobalHandles::IsReallyWeak(obj) && (*obj)->IsGlobalContext()) {
406 i::Heap::NotifyContextDisposed();
407 }
399 i::GlobalHandles::Destroy(obj); 408 i::GlobalHandles::Destroy(obj);
400 } 409 }
401 410
402 // --- H a n d l e s --- 411 // --- H a n d l e s ---
403 412
404 413
405 HandleScope::HandleScope() : is_closed_(false) { 414 HandleScope::HandleScope() : is_closed_(false) {
406 API_ENTRY_CHECK("HandleScope::HandleScope"); 415 API_ENTRY_CHECK("HandleScope::HandleScope");
407 i::HandleScope::Enter(&previous_); 416 i::HandleScope::Enter(&previous_);
408 } 417 }
(...skipping 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 3775
3767 3776
3768 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3777 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3769 HandleScopeImplementer* thread_local = 3778 HandleScopeImplementer* thread_local =
3770 reinterpret_cast<HandleScopeImplementer*>(storage); 3779 reinterpret_cast<HandleScopeImplementer*>(storage);
3771 thread_local->IterateThis(v); 3780 thread_local->IterateThis(v);
3772 return storage + ArchiveSpacePerThread(); 3781 return storage + ArchiveSpacePerThread();
3773 } 3782 }
3774 3783
3775 } } // namespace v8::internal 3784 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698