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

Side by Side Diff: include/v8.h

Issue 677403002: Revert 'Introduce phantom weak handles in the API and use them internally for debug info' (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 template<typename P> 509 template<typename P>
510 V8_INLINE void SetWeak( 510 V8_INLINE void SetWeak(
511 P* parameter, 511 P* parameter,
512 typename WeakCallbackData<T, P>::Callback callback); 512 typename WeakCallbackData<T, P>::Callback callback);
513 513
514 template<typename S, typename P> 514 template<typename S, typename P>
515 V8_INLINE void SetWeak( 515 V8_INLINE void SetWeak(
516 P* parameter, 516 P* parameter,
517 typename WeakCallbackData<S, P>::Callback callback); 517 typename WeakCallbackData<S, P>::Callback callback);
518 518
519 // Phantom persistents work like weak persistents, except that the pointer to
520 // the object being collected is not available in the finalization callback.
521 // This enables the garbage collector to collect the object and any objects
522 // it references transitively in one GC cycle.
523 template <typename P>
524 V8_INLINE void SetPhantom(P* parameter,
525 typename WeakCallbackData<T, P>::Callback callback);
526
527 template <typename S, typename P>
528 V8_INLINE void SetPhantom(P* parameter,
529 typename WeakCallbackData<S, P>::Callback callback);
530
531 template<typename P> 519 template<typename P>
532 V8_INLINE P* ClearWeak(); 520 V8_INLINE P* ClearWeak();
533 521
534 // TODO(dcarney): remove this. 522 // TODO(dcarney): remove this.
535 V8_INLINE void ClearWeak() { ClearWeak<void>(); } 523 V8_INLINE void ClearWeak() { ClearWeak<void>(); }
536 524
537 /** 525 /**
538 * Marks the reference to this object independent. Garbage collector is free 526 * Marks the reference to this object independent. Garbage collector is free
539 * to ignore any object groups containing this object. Weak callback for an 527 * to ignore any object groups containing this object. Weak callback for an
540 * independent handle should not assume that it will be preceded by a global 528 * independent handle should not assume that it will be preceded by a global
(...skipping 4794 matching lines...) Expand 10 before | Expand all | Expand 10 after
5335 5323
5336 /** 5324 /**
5337 * Clears all references to the v8::Platform. This should be invoked after 5325 * Clears all references to the v8::Platform. This should be invoked after
5338 * V8 was disposed. 5326 * V8 was disposed.
5339 */ 5327 */
5340 static void ShutdownPlatform(); 5328 static void ShutdownPlatform();
5341 5329
5342 private: 5330 private:
5343 V8(); 5331 V8();
5344 5332
5345 enum WeakHandleType { PhantomHandle, NonphantomHandle };
5346
5347 static internal::Object** GlobalizeReference(internal::Isolate* isolate, 5333 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
5348 internal::Object** handle); 5334 internal::Object** handle);
5349 static internal::Object** CopyPersistent(internal::Object** handle); 5335 static internal::Object** CopyPersistent(internal::Object** handle);
5350 static void DisposeGlobal(internal::Object** global_handle); 5336 static void DisposeGlobal(internal::Object** global_handle);
5351 typedef WeakCallbackData<Value, void>::Callback WeakCallback; 5337 typedef WeakCallbackData<Value, void>::Callback WeakCallback;
5352 static void MakeWeak(internal::Object** global_handle, void* data, 5338 static void MakeWeak(internal::Object** global_handle,
5353 WeakCallback weak_callback, WeakHandleType phantom); 5339 void* data,
5340 WeakCallback weak_callback);
5354 static void* ClearWeak(internal::Object** global_handle); 5341 static void* ClearWeak(internal::Object** global_handle);
5355 static void Eternalize(Isolate* isolate, 5342 static void Eternalize(Isolate* isolate,
5356 Value* handle, 5343 Value* handle,
5357 int* index); 5344 int* index);
5358 static Local<Value> GetEternal(Isolate* isolate, int index); 5345 static Local<Value> GetEternal(Isolate* isolate, int index);
5359 5346
5360 template <class T> friend class Handle; 5347 template <class T> friend class Handle;
5361 template <class T> friend class Local; 5348 template <class T> friend class Local;
5362 template <class T> friend class Eternal; 5349 template <class T> friend class Eternal;
5363 template <class T> friend class PersistentBase; 5350 template <class T> friend class PersistentBase;
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
6206 } 6193 }
6207 6194
6208 6195
6209 template <class T> 6196 template <class T>
6210 template <typename S, typename P> 6197 template <typename S, typename P>
6211 void PersistentBase<T>::SetWeak( 6198 void PersistentBase<T>::SetWeak(
6212 P* parameter, 6199 P* parameter,
6213 typename WeakCallbackData<S, P>::Callback callback) { 6200 typename WeakCallbackData<S, P>::Callback callback) {
6214 TYPE_CHECK(S, T); 6201 TYPE_CHECK(S, T);
6215 typedef typename WeakCallbackData<Value, void>::Callback Callback; 6202 typedef typename WeakCallbackData<Value, void>::Callback Callback;
6216 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter, 6203 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_),
6217 reinterpret_cast<Callback>(callback), V8::NonphantomHandle); 6204 parameter,
6205 reinterpret_cast<Callback>(callback));
6218 } 6206 }
6219 6207
6220 6208
6221 template <class T> 6209 template <class T>
6222 template <typename P> 6210 template <typename P>
6223 void PersistentBase<T>::SetWeak( 6211 void PersistentBase<T>::SetWeak(
6224 P* parameter, 6212 P* parameter,
6225 typename WeakCallbackData<T, P>::Callback callback) { 6213 typename WeakCallbackData<T, P>::Callback callback) {
6226 SetWeak<T, P>(parameter, callback); 6214 SetWeak<T, P>(parameter, callback);
6227 } 6215 }
6228 6216
6229 6217
6230 template <class T> 6218 template <class T>
6231 template <typename S, typename P> 6219 template<typename P>
6232 void PersistentBase<T>::SetPhantom(
6233 P* parameter, typename WeakCallbackData<S, P>::Callback callback) {
6234 TYPE_CHECK(S, T);
6235 typedef typename WeakCallbackData<Value, void>::Callback Callback;
6236 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
6237 reinterpret_cast<Callback>(callback), V8::PhantomHandle);
6238 }
6239
6240
6241 template <class T>
6242 template <typename P>
6243 void PersistentBase<T>::SetPhantom(
6244 P* parameter, typename WeakCallbackData<T, P>::Callback callback) {
6245 SetPhantom<T, P>(parameter, callback);
6246 }
6247
6248
6249 template <class T>
6250 template <typename P>
6251 P* PersistentBase<T>::ClearWeak() { 6220 P* PersistentBase<T>::ClearWeak() {
6252 return reinterpret_cast<P*>( 6221 return reinterpret_cast<P*>(
6253 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_))); 6222 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
6254 } 6223 }
6255 6224
6256 6225
6257 template <class T> 6226 template <class T>
6258 void PersistentBase<T>::MarkIndependent() { 6227 void PersistentBase<T>::MarkIndependent() {
6259 typedef internal::Internals I; 6228 typedef internal::Internals I;
6260 if (this->IsEmpty()) return; 6229 if (this->IsEmpty()) return;
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
7119 */ 7088 */
7120 7089
7121 7090
7122 } // namespace v8 7091 } // namespace v8
7123 7092
7124 7093
7125 #undef TYPE_CHECK 7094 #undef TYPE_CHECK
7126 7095
7127 7096
7128 #endif // V8_H_ 7097 #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