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

Side by Side Diff: include/v8.h

Issue 15648008: de-isolate Persistent::Dispose (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « no previous file | src/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 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 * of context disposals - including this one - since the last time 4534 * of context disposals - including this one - since the last time
4535 * V8 had a chance to clean up. 4535 * V8 had a chance to clean up.
4536 */ 4536 */
4537 static int ContextDisposedNotification(); 4537 static int ContextDisposedNotification();
4538 4538
4539 private: 4539 private:
4540 V8(); 4540 V8();
4541 4541
4542 static internal::Object** GlobalizeReference(internal::Isolate* isolate, 4542 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
4543 internal::Object** handle); 4543 internal::Object** handle);
4544 static void DisposeGlobal(internal::Isolate* isolate, 4544 static void DisposeGlobal(internal::Object** global_handle);
4545 internal::Object** global_handle);
4546 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; 4545 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
4547 static void MakeWeak(internal::Isolate* isolate, 4546 static void MakeWeak(internal::Isolate* isolate,
4548 internal::Object** global_handle, 4547 internal::Object** global_handle,
4549 void* data, 4548 void* data,
4550 RevivableCallback weak_reference_callback, 4549 RevivableCallback weak_reference_callback,
4551 NearDeathCallback near_death_callback); 4550 NearDeathCallback near_death_callback);
4552 static void ClearWeak(internal::Isolate* isolate, 4551 static void ClearWeak(internal::Isolate* isolate,
4553 internal::Object** global_handle); 4552 internal::Object** global_handle);
4554 4553
4555 template <class T> friend class Handle; 4554 template <class T> friend class Handle;
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
5479 typedef internal::Internals I; 5478 typedef internal::Internals I;
5480 if (this->IsEmpty()) return false; 5479 if (this->IsEmpty()) return false;
5481 if (!I::IsInitialized(isolate)) return false; 5480 if (!I::IsInitialized(isolate)) return false;
5482 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == 5481 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
5483 I::kNodeStateIsWeakValue; 5482 I::kNodeStateIsWeakValue;
5484 } 5483 }
5485 5484
5486 5485
5487 template <class T> 5486 template <class T>
5488 void Persistent<T>::Dispose() { 5487 void Persistent<T>::Dispose() {
5489 Dispose(Isolate::GetCurrent());
5490 }
5491
5492
5493 template <class T>
5494 void Persistent<T>::Dispose(Isolate* isolate) {
5495 if (this->IsEmpty()) return; 5488 if (this->IsEmpty()) return;
5496 V8::DisposeGlobal(reinterpret_cast<internal::Isolate*>(isolate), 5489 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
5497 reinterpret_cast<internal::Object**>(this->val_));
5498 #ifndef V8_USE_UNSAFE_HANDLES 5490 #ifndef V8_USE_UNSAFE_HANDLES
5499 val_ = 0; 5491 val_ = 0;
5500 #endif 5492 #endif
5501 } 5493 }
5502 5494
5503 5495
5496 template <class T>
5497 void Persistent<T>::Dispose(Isolate* isolate) {
Sven Panne 2013/05/23 08:09:11 I thought we want to remove this? Or is it just to
dcarney 2013/05/23 08:15:59 yeah, we've only just started moving chrome away f
5498 Dispose();
5499 }
5500
5501
5504 template <class T> 5502 template <class T>
5505 template <typename S, typename P> 5503 template <typename S, typename P>
5506 void Persistent<T>::MakeWeak( 5504 void Persistent<T>::MakeWeak(
5507 Isolate* isolate, 5505 Isolate* isolate,
5508 P* parameters, 5506 P* parameters,
5509 typename WeakReferenceCallbacks<S, P>::Revivable callback) { 5507 typename WeakReferenceCallbacks<S, P>::Revivable callback) {
5510 TYPE_CHECK(S, T); 5508 TYPE_CHECK(S, T);
5511 typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable; 5509 typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable;
5512 V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate), 5510 V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate),
5513 reinterpret_cast<internal::Object**>(this->val_), 5511 reinterpret_cast<internal::Object**>(this->val_),
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
6286 6284
6287 6285
6288 } // namespace v8 6286 } // namespace v8
6289 6287
6290 6288
6291 #undef V8EXPORT 6289 #undef V8EXPORT
6292 #undef TYPE_CHECK 6290 #undef TYPE_CHECK
6293 6291
6294 6292
6295 #endif // V8_H_ 6293 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698