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

Side by Side Diff: include/v8.h

Issue 15994003: remove most remaining V8_ALLOW_ACCESS_TO* defines (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | samples/lineprocessor.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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 */ 368 */
369 V8_INLINE(explicit Handle(T* val)) : val_(val) {} 369 V8_INLINE(explicit Handle(T* val)) : val_(val) {}
370 #endif 370 #endif
371 371
372 private: 372 private:
373 template<class F> 373 template<class F>
374 friend class Persistent; 374 friend class Persistent;
375 template<class F> 375 template<class F>
376 friend class Local; 376 friend class Local;
377 friend class Arguments; 377 friend class Arguments;
378 template<class F>
Sven Panne 2013/05/29 07:54:54 Similar code has been there before, but anyway: Mo
379 friend class FunctionCallbackInfo;
380 template<class F>
381 friend class PropertyCallbackInfo;
378 friend class String; 382 friend class String;
379 friend class Object; 383 friend class Object;
380 friend class AccessorInfo; 384 friend class AccessorInfo;
381 friend Handle<Primitive> Undefined(Isolate* isolate); 385 friend Handle<Primitive> Undefined(Isolate* isolate);
382 friend Handle<Primitive> Null(Isolate* isolate); 386 friend Handle<Primitive> Null(Isolate* isolate);
383 friend Handle<Boolean> True(Isolate* isolate); 387 friend Handle<Boolean> True(Isolate* isolate);
384 friend Handle<Boolean> False(Isolate* isolate); 388 friend Handle<Boolean> False(Isolate* isolate);
385 friend class Context; 389 friend class Context;
386 friend class InternalHandleHelper; 390 friend class InternalHandleHelper;
387 friend class LocalContext; 391 friend class LocalContext;
392 friend class HandleScope;
388 393
389 #ifndef V8_USE_UNSAFE_HANDLES 394 #ifndef V8_USE_UNSAFE_HANDLES
390 V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); 395 V8_INLINE(static Handle<T> New(Isolate* isolate, T* that));
391 #endif 396 #endif
392 397
393 T* val_; 398 T* val_;
394 }; 399 };
395 400
396 401
397 /** 402 /**
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 #endif 461 #endif
457 template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { } 462 template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { }
458 #endif 463 #endif
459 464
460 private: 465 private:
461 template<class F> 466 template<class F>
462 friend class Persistent; 467 friend class Persistent;
463 template<class F> 468 template<class F>
464 friend class Handle; 469 friend class Handle;
465 friend class Arguments; 470 friend class Arguments;
471 template<class F>
472 friend class FunctionCallbackInfo;
473 template<class F>
474 friend class PropertyCallbackInfo;
466 friend class String; 475 friend class String;
467 friend class Object; 476 friend class Object;
468 friend class AccessorInfo; 477 friend class AccessorInfo;
469 friend class Context; 478 friend class Context;
470 friend class InternalHandleHelper; 479 friend class InternalHandleHelper;
471 friend class LocalContext; 480 friend class LocalContext;
481 friend class HandleScope;
472 482
473 V8_INLINE(static Local<T> New(Isolate* isolate, T* that)); 483 V8_INLINE(static Local<T> New(Isolate* isolate, T* that));
474 }; 484 };
475 485
476 /** 486 /**
477 * An object reference that is independent of any handle scope. Where 487 * An object reference that is independent of any handle scope. Where
478 * a Local handle only lives as long as the HandleScope in which it was 488 * a Local handle only lives as long as the HandleScope in which it was
479 * allocated, a Persistent handle remains valid until it is explicitly 489 * allocated, a Persistent handle remains valid until it is explicitly
480 * disposed. 490 * disposed.
481 * 491 *
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 * was previously assigned. 730 * was previously assigned.
721 */ 731 */
722 // TODO(dcarney): remove before cutover 732 // TODO(dcarney): remove before cutover
723 V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const); 733 V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const);
724 734
725 /** 735 /**
726 * Disposes the current contents of the handle and replaces it. 736 * Disposes the current contents of the handle and replaces it.
727 */ 737 */
728 V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other)); 738 V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other));
729 739
740 #ifndef V8_USE_UNSAFE_HANDLES
741 V8_INLINE(void Reset(Isolate* isolate, const Persistent<T>& other));
742 #endif
743
730 /** 744 /**
731 * Returns the underlying raw pointer and clears the handle. The caller is 745 * Returns the underlying raw pointer and clears the handle. The caller is
732 * responsible of eventually destroying the underlying object (by creating a 746 * responsible of eventually destroying the underlying object (by creating a
733 * Persistent handle which points to it and Disposing it). In the future, 747 * Persistent handle which points to it and Disposing it). In the future,
734 * destructing a Persistent will also Dispose it. With this function, the 748 * destructing a Persistent will also Dispose it. With this function, the
735 * embedder can let the Persistent go out of scope without it getting 749 * embedder can let the Persistent go out of scope without it getting
736 * disposed. 750 * disposed.
737 */ 751 */
738 V8_INLINE(T* ClearAndLeak()); 752 V8_INLINE(T* ClearAndLeak());
739 753
(...skipping 4911 matching lines...) Expand 10 before | Expand all | Expand 10 after
5651 this->val_ = NULL; 5665 this->val_ = NULL;
5652 return; 5666 return;
5653 } 5667 }
5654 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); 5668 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_);
5655 this->val_ = reinterpret_cast<T*>( 5669 this->val_ = reinterpret_cast<T*>(
5656 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); 5670 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p));
5657 #endif 5671 #endif
5658 } 5672 }
5659 5673
5660 5674
5675 #ifndef V8_USE_UNSAFE_HANDLES
5676 template <class T>
5677 void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) {
5678 Dispose(isolate);
5679 if (other.IsEmpty()) {
5680 this->val_ = NULL;
5681 return;
5682 }
5683 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_);
5684 this->val_ = reinterpret_cast<T*>(
5685 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p));
5686 }
5687 #endif
5688
5689
5661 template <class T> 5690 template <class T>
5662 T* Persistent<T>::ClearAndLeak() { 5691 T* Persistent<T>::ClearAndLeak() {
5663 T* old; 5692 T* old;
5664 #ifdef V8_USE_UNSAFE_HANDLES 5693 #ifdef V8_USE_UNSAFE_HANDLES
5665 old = **this; 5694 old = **this;
5666 *this = Persistent<T>(); 5695 *this = Persistent<T>();
5667 #else 5696 #else
5668 old = val_; 5697 old = val_;
5669 val_ = NULL; 5698 val_ = NULL;
5670 #endif 5699 #endif
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
6343 6372
6344 6373
6345 } // namespace v8 6374 } // namespace v8
6346 6375
6347 6376
6348 #undef V8EXPORT 6377 #undef V8EXPORT
6349 #undef TYPE_CHECK 6378 #undef TYPE_CHECK
6350 6379
6351 6380
6352 #endif // V8_H_ 6381 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | samples/lineprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698