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

Side by Side Diff: include/v8.h

Issue 25226002: change of V8_DEPRECATED to be enabled behind a gyp flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « build/features.gypi ('k') | include/v8-profiler.h » ('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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 template <class S> 579 template <class S>
580 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other); 580 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other);
581 /** 581 /**
582 * If non-empty, destroy the underlying storage cell 582 * If non-empty, destroy the underlying storage cell
583 * and create a new one with the contents of other if other is non empty 583 * and create a new one with the contents of other if other is non empty
584 */ 584 */
585 template <class S, class M2> 585 template <class S, class M2>
586 V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other); 586 V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other);
587 // TODO(dcarney): deprecate 587 // TODO(dcarney): deprecate
588 V8_INLINE void Dispose() { Reset(); } 588 V8_INLINE void Dispose() { Reset(); }
589 V8_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); }
590 589
591 V8_INLINE bool IsEmpty() const { return val_ == 0; } 590 V8_INLINE bool IsEmpty() const { return val_ == 0; }
592 591
593 // TODO(dcarney): this is pretty useless, fix or remove 592 // TODO(dcarney): this is pretty useless, fix or remove
594 template <class S> 593 template <class S>
595 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT 594 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
596 #ifdef V8_ENABLE_CHECKS 595 #ifdef V8_ENABLE_CHECKS
597 // If we're going to perform the type check then we have to check 596 // If we're going to perform the type check then we have to check
598 // that the handle isn't empty before doing the checked cast. 597 // that the handle isn't empty before doing the checked cast.
599 if (!that.IsEmpty()) T::Cast(*that); 598 if (!that.IsEmpty()) T::Cast(*that);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 typename WeakReferenceCallbacks<S, P>::Revivable callback); 648 typename WeakReferenceCallbacks<S, P>::Revivable callback);
650 649
651 // TODO(dcarney): deprecate 650 // TODO(dcarney): deprecate
652 template<typename P> 651 template<typename P>
653 V8_INLINE void MakeWeak( 652 V8_INLINE void MakeWeak(
654 P* parameter, 653 P* parameter,
655 typename WeakReferenceCallbacks<T, P>::Revivable callback); 654 typename WeakReferenceCallbacks<T, P>::Revivable callback);
656 655
657 V8_INLINE void ClearWeak(); 656 V8_INLINE void ClearWeak();
658 657
659 V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); }
660
661 /** 658 /**
662 * Marks the reference to this object independent. Garbage collector is free 659 * Marks the reference to this object independent. Garbage collector is free
663 * to ignore any object groups containing this object. Weak callback for an 660 * to ignore any object groups containing this object. Weak callback for an
664 * independent handle should not assume that it will be preceded by a global 661 * independent handle should not assume that it will be preceded by a global
665 * GC prologue callback or followed by a global GC epilogue callback. 662 * GC prologue callback or followed by a global GC epilogue callback.
666 */ 663 */
667 V8_INLINE void MarkIndependent(); 664 V8_INLINE void MarkIndependent();
668 665
669 V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) {
670 MarkIndependent();
671 }
672
673 /** 666 /**
674 * Marks the reference to this object partially dependent. Partially dependent 667 * Marks the reference to this object partially dependent. Partially dependent
675 * handles only depend on other partially dependent handles and these 668 * handles only depend on other partially dependent handles and these
676 * dependencies are provided through object groups. It provides a way to build 669 * dependencies are provided through object groups. It provides a way to build
677 * smaller object groups for young objects that represent only a subset of all 670 * smaller object groups for young objects that represent only a subset of all
678 * external dependencies. This mark is automatically cleared after each 671 * external dependencies. This mark is automatically cleared after each
679 * garbage collection. 672 * garbage collection.
680 */ 673 */
681 V8_INLINE void MarkPartiallyDependent(); 674 V8_INLINE void MarkPartiallyDependent();
682 675
683 V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) {
684 MarkPartiallyDependent();
685 }
686
687 V8_INLINE bool IsIndependent() const; 676 V8_INLINE bool IsIndependent() const;
688 677
689 V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) {
690 return IsIndependent();
691 }
692
693 /** Checks if the handle holds the only reference to an object. */ 678 /** Checks if the handle holds the only reference to an object. */
694 V8_INLINE bool IsNearDeath() const; 679 V8_INLINE bool IsNearDeath() const;
695 680
696 V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) {
697 return IsNearDeath();
698 }
699
700 /** Returns true if the handle's reference is weak. */ 681 /** Returns true if the handle's reference is weak. */
701 V8_INLINE bool IsWeak() const; 682 V8_INLINE bool IsWeak() const;
702 683
703 V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) {
704 return IsWeak();
705 }
706
707 /** 684 /**
708 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface 685 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
709 * description in v8-profiler.h for details. 686 * description in v8-profiler.h for details.
710 */ 687 */
711 V8_INLINE void SetWrapperClassId(uint16_t class_id); 688 V8_INLINE void SetWrapperClassId(uint16_t class_id);
712 689
713 V8_DEPRECATED(
714 V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) {
715 SetWrapperClassId(class_id);
716 }
717
718 /** 690 /**
719 * Returns the class ID previously assigned to this handle or 0 if no class ID 691 * Returns the class ID previously assigned to this handle or 0 if no class ID
720 * was previously assigned. 692 * was previously assigned.
721 */ 693 */
722 V8_INLINE uint16_t WrapperClassId() const; 694 V8_INLINE uint16_t WrapperClassId() const;
723 695
724 V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) {
725 return WrapperClassId();
726 }
727
728 // TODO(dcarney): remove 696 // TODO(dcarney): remove
729 V8_INLINE T* ClearAndLeak(); 697 V8_INLINE T* ClearAndLeak();
730 698
731 // TODO(dcarney): remove 699 // TODO(dcarney): remove
732 V8_INLINE void Clear() { val_ = 0; } 700 V8_INLINE void Clear() { val_ = 0; }
733 701
734 // TODO(dcarney): remove 702 // TODO(dcarney): remove
735 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR 703 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
736 704
737 private: 705 private:
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 */ 1534 */
1567 int Length() const; 1535 int Length() const;
1568 1536
1569 /** 1537 /**
1570 * Returns the number of bytes in the UTF-8 encoded 1538 * Returns the number of bytes in the UTF-8 encoded
1571 * representation of this string. 1539 * representation of this string.
1572 */ 1540 */
1573 int Utf8Length() const; 1541 int Utf8Length() const;
1574 1542
1575 /** 1543 /**
1576 * This function is no longer useful.
1577 */
1578 V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; }
1579
1580 /**
1581 * Returns whether this string is known to contain only one byte data. 1544 * Returns whether this string is known to contain only one byte data.
1582 * Does not read the string. 1545 * Does not read the string.
1583 * False negatives are possible. 1546 * False negatives are possible.
1584 */ 1547 */
1585 bool IsOneByte() const; 1548 bool IsOneByte() const;
1586 1549
1587 /** 1550 /**
1588 * Returns whether this string contain only one byte data. 1551 * Returns whether this string contain only one byte data.
1589 * Will read the entire string in some cases. 1552 * Will read the entire string in some cases.
1590 */ 1553 */
(...skipping 29 matching lines...) Expand all
1620 HINT_MANY_WRITES_EXPECTED = 1, 1583 HINT_MANY_WRITES_EXPECTED = 1,
1621 NO_NULL_TERMINATION = 2, 1584 NO_NULL_TERMINATION = 2,
1622 PRESERVE_ASCII_NULL = 4 1585 PRESERVE_ASCII_NULL = 4
1623 }; 1586 };
1624 1587
1625 // 16-bit character codes. 1588 // 16-bit character codes.
1626 int Write(uint16_t* buffer, 1589 int Write(uint16_t* buffer,
1627 int start = 0, 1590 int start = 0,
1628 int length = -1, 1591 int length = -1,
1629 int options = NO_OPTIONS) const; 1592 int options = NO_OPTIONS) const;
1630 // ASCII characters.
1631 V8_DEPRECATED(int WriteAscii(char* buffer,
1632 int start = 0,
1633 int length = -1,
1634 int options = NO_OPTIONS) const);
1635 // One byte characters. 1593 // One byte characters.
1636 int WriteOneByte(uint8_t* buffer, 1594 int WriteOneByte(uint8_t* buffer,
1637 int start = 0, 1595 int start = 0,
1638 int length = -1, 1596 int length = -1,
1639 int options = NO_OPTIONS) const; 1597 int options = NO_OPTIONS) const;
1640 // UTF-8 encoded characters. 1598 // UTF-8 encoded characters.
1641 int WriteUtf8(char* buffer, 1599 int WriteUtf8(char* buffer,
1642 int length = -1, 1600 int length = -1,
1643 int* nchars_ref = NULL, 1601 int* nchars_ref = NULL,
1644 int options = NO_OPTIONS) const; 1602 int options = NO_OPTIONS) const;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 V8_INLINE ExternalStringResource* GetExternalStringResource() const; 1713 V8_INLINE ExternalStringResource* GetExternalStringResource() const;
1756 1714
1757 /** 1715 /**
1758 * Get the ExternalAsciiStringResource for an external ASCII string. 1716 * Get the ExternalAsciiStringResource for an external ASCII string.
1759 * Returns NULL if IsExternalAscii() doesn't return true. 1717 * Returns NULL if IsExternalAscii() doesn't return true.
1760 */ 1718 */
1761 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; 1719 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1762 1720
1763 V8_INLINE static String* Cast(v8::Value* obj); 1721 V8_INLINE static String* Cast(v8::Value* obj);
1764 1722
1765 // TODO(dcarney): deprecate
1766 /** 1723 /**
1767 * Allocates a new string from either UTF-8 encoded or ASCII data. 1724 * Allocates a new string from either UTF-8 encoded or ASCII data.
1768 * The second parameter 'length' gives the buffer length. If omitted, 1725 * The second parameter 'length' gives the buffer length. If omitted,
1769 * the function calls 'strlen' to determine the buffer length. 1726 * the function calls 'strlen' to determine the buffer length.
1770 */ 1727 */
1771 V8_INLINE static Local<String> New(const char* data, int length = -1); 1728 V8_DEPRECATED(
1729 "Use NewFromOneByte instead",
1730 V8_INLINE static Local<String> New(const char* data, int length = -1));
1772 1731
1773 // TODO(dcarney): deprecate
1774 /** Allocates a new string from 16-bit character codes.*/ 1732 /** Allocates a new string from 16-bit character codes.*/
1775 V8_INLINE static Local<String> New(const uint16_t* data, int length = -1); 1733 V8_DEPRECATED(
1734 "Use NewFromTwoByte instead",
1735 V8_INLINE static Local<String> New(
1736 const uint16_t* data, int length = -1));
1776 1737
1777 // TODO(dcarney): deprecate
1778 /** 1738 /**
1779 * Creates an internalized string (historically called a "symbol", 1739 * Creates an internalized string (historically called a "symbol",
1780 * not to be confused with ES6 symbols). Returns one if it exists already. 1740 * not to be confused with ES6 symbols). Returns one if it exists already.
1781 */ 1741 */
1782 V8_INLINE static Local<String> NewSymbol(const char* data, int length = -1); 1742 V8_DEPRECATED(
1743 "Use NewFromUtf8 instead",
1744 V8_INLINE static Local<String> NewSymbol(
1745 const char* data, int length = -1));
1783 1746
1784 enum NewStringType { 1747 enum NewStringType {
1785 kNormalString, kInternalizedString, kUndetectableString 1748 kNormalString, kInternalizedString, kUndetectableString
1786 }; 1749 };
1787 1750
1788 /** Allocates a new string from UTF-8 data.*/ 1751 /** Allocates a new string from UTF-8 data.*/
1789 static Local<String> NewFromUtf8(Isolate* isolate, 1752 static Local<String> NewFromUtf8(Isolate* isolate,
1790 const char* data, 1753 const char* data,
1791 NewStringType type = kNormalString, 1754 NewStringType type = kNormalString,
1792 int length = -1); 1755 int length = -1);
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after
4583 static void SetEntropySource(EntropySource source); 4546 static void SetEntropySource(EntropySource source);
4584 4547
4585 /** 4548 /**
4586 * Allows the host application to provide a callback that allows v8 to 4549 * Allows the host application to provide a callback that allows v8 to
4587 * cooperate with a profiler that rewrites return addresses on stack. 4550 * cooperate with a profiler that rewrites return addresses on stack.
4588 */ 4551 */
4589 static void SetReturnAddressLocationResolver( 4552 static void SetReturnAddressLocationResolver(
4590 ReturnAddressLocationResolver return_address_resolver); 4553 ReturnAddressLocationResolver return_address_resolver);
4591 4554
4592 /** 4555 /**
4593 * Deprecated, use the variant with the Isolate parameter below instead.
4594 */
4595 V8_DEPRECATED(static bool SetFunctionEntryHook(FunctionEntryHook entry_hook));
4596
4597 /**
4598 * Allows the host application to provide the address of a function that's 4556 * Allows the host application to provide the address of a function that's
4599 * invoked on entry to every V8-generated function. 4557 * invoked on entry to every V8-generated function.
4600 * Note that \p entry_hook is invoked at the very start of each 4558 * Note that \p entry_hook is invoked at the very start of each
4601 * generated function. 4559 * generated function.
4602 * 4560 *
4603 * \param isolate the isolate to operate on. 4561 * \param isolate the isolate to operate on.
4604 * \param entry_hook a function that will be invoked on entry to every 4562 * \param entry_hook a function that will be invoked on entry to every
4605 * V8-generated function. 4563 * V8-generated function.
4606 * \returns true on success on supported platforms, false on failure. 4564 * \returns true on success on supported platforms, false on failure.
4607 * \note Setting an entry hook can only be done very early in an isolates 4565 * \note Setting an entry hook can only be done very early in an isolates
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4684 * Releases any resources used by v8 and stops any utility threads 4642 * Releases any resources used by v8 and stops any utility threads
4685 * that may be running. Note that disposing v8 is permanent, it 4643 * that may be running. Note that disposing v8 is permanent, it
4686 * cannot be reinitialized. 4644 * cannot be reinitialized.
4687 * 4645 *
4688 * It should generally not be necessary to dispose v8 before exiting 4646 * It should generally not be necessary to dispose v8 before exiting
4689 * a process, this should happen automatically. It is only necessary 4647 * a process, this should happen automatically. It is only necessary
4690 * to use if the process needs the resources taken up by v8. 4648 * to use if the process needs the resources taken up by v8.
4691 */ 4649 */
4692 static bool Dispose(); 4650 static bool Dispose();
4693 4651
4694 /** Deprecated. Use Isolate::GetHeapStatistics instead. */
4695 V8_DEPRECATED(static void GetHeapStatistics(HeapStatistics* heap_statistics));
4696
4697 /** 4652 /**
4698 * Iterates through all external resources referenced from current isolate 4653 * Iterates through all external resources referenced from current isolate
4699 * heap. GC is not invoked prior to iterating, therefore there is no 4654 * heap. GC is not invoked prior to iterating, therefore there is no
4700 * guarantee that visited objects are still alive. 4655 * guarantee that visited objects are still alive.
4701 */ 4656 */
4702 static void VisitExternalResources(ExternalResourceVisitor* visitor); 4657 static void VisitExternalResources(ExternalResourceVisitor* visitor);
4703 4658
4704 /** 4659 /**
4705 * Iterates through all the persistent handles in the current isolate's heap 4660 * Iterates through all the persistent handles in the current isolate's heap
4706 * that have class_ids. 4661 * that have class_ids.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
4984 * created by a previous call to Context::New with the same global 4939 * created by a previous call to Context::New with the same global
4985 * template. The state of the global object will be completely reset 4940 * template. The state of the global object will be completely reset
4986 * and only object identify will remain. 4941 * and only object identify will remain.
4987 */ 4942 */
4988 static Local<Context> New( 4943 static Local<Context> New(
4989 Isolate* isolate, 4944 Isolate* isolate,
4990 ExtensionConfiguration* extensions = NULL, 4945 ExtensionConfiguration* extensions = NULL,
4991 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), 4946 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
4992 Handle<Value> global_object = Handle<Value>()); 4947 Handle<Value> global_object = Handle<Value>());
4993 4948
4994 // TODO(dcarney): Remove this function. 4949 V8_DEPRECATED("Use Isolate::GetEnteredContext instead",
4995 /** Deprecated. Use Isolate::GetEnteredContext */ 4950 static Local<Context> GetEntered());
4996 static Local<Context> GetEntered();
4997 4951
4998 // TODO(dcarney) Remove this function. 4952 V8_DEPRECATED("Use Isolate::GetCurrentContext instead",
4999 /** Deprecated. Use Isolate::GetCurrentContext instead. */ 4953 static Local<Context> GetCurrent());
5000 static Local<Context> GetCurrent();
5001 4954
5002 // TODO(dcarney) Remove this function. 4955 V8_DEPRECATED("Use Isolate::GetCallingContext instead",
5003 /** Deprecated. Use Isolate::GetCallingContext instead. */ 4956 static Local<Context> GetCalling());
5004 static Local<Context> GetCalling();
5005 4957
5006 /** 4958 /**
5007 * Sets the security token for the context. To access an object in 4959 * Sets the security token for the context. To access an object in
5008 * another context, the security tokens must match. 4960 * another context, the security tokens must match.
5009 */ 4961 */
5010 void SetSecurityToken(Handle<Value> token); 4962 void SetSecurityToken(Handle<Value> token);
5011 4963
5012 /** Restores the security token to the default value. */ 4964 /** Restores the security token to the default value. */
5013 void UseDefaultSecurityToken(); 4965 void UseDefaultSecurityToken();
5014 4966
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 */ 6454 */
6503 6455
6504 6456
6505 } // namespace v8 6457 } // namespace v8
6506 6458
6507 6459
6508 #undef TYPE_CHECK 6460 #undef TYPE_CHECK
6509 6461
6510 6462
6511 #endif // V8_H_ 6463 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/features.gypi ('k') | include/v8-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698