OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 void ClearWeak() { handle_.template ClearWeak<void>(); } | 79 void ClearWeak() { handle_.template ClearWeak<void>(); } |
80 | 80 |
81 bool IsEmpty() const { return handle_.IsEmpty(); } | 81 bool IsEmpty() const { return handle_.IsEmpty(); } |
82 bool IsWeak() const { return handle_.IsWeak(); } | 82 bool IsWeak() const { return handle_.IsWeak(); } |
83 | 83 |
84 virtual void Set(v8::Isolate* isolate, v8::Local<T> handle) { | 84 virtual void Set(v8::Isolate* isolate, v8::Local<T> handle) { |
85 handle_.Reset(isolate, handle); | 85 handle_.Reset(isolate, handle); |
86 } | 86 } |
87 | 87 |
88 // Note: This is clear in the std::unique_ptr sense, not the v8::Handle sense. | 88 // Note: This is clear in the std::unique_ptr sense, not the v8::Local sense. |
89 void Clear() { handle_.Reset(); } | 89 void Clear() { handle_.Reset(); } |
90 | 90 |
91 bool operator==(const ScopedPersistent<T>& other) { | 91 bool operator==(const ScopedPersistent<T>& other) { |
92 return handle_ == other.handle_; | 92 return handle_ == other.handle_; |
93 } | 93 } |
94 | 94 |
95 template <class S> | 95 template <class S> |
96 bool operator==(const v8::Local<S> other) const { | 96 bool operator==(const v8::Local<S> other) const { |
97 return handle_ == other; | 97 return handle_ == other; |
98 } | 98 } |
99 | 99 |
100 ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; } | 100 ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; } |
101 | 101 |
102 private: | 102 private: |
103 v8::Persistent<T> handle_; | 103 v8::Persistent<T> handle_; |
104 }; | 104 }; |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
107 | 107 |
108 #endif // ScopedPersistent_h | 108 #endif // ScopedPersistent_h |
OLD | NEW |