| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 { | 65 { |
| 66 return v8::Local<T>::New(isolate, m_handle); | 66 return v8::Local<T>::New(isolate, m_handle); |
| 67 } | 67 } |
| 68 | 68 |
| 69 template<typename P> | 69 template<typename P> |
| 70 void setWeak(P* parameters, void (*callback)(const v8::WeakCallbackInfo<P>&)
, v8::WeakCallbackType type = v8::WeakCallbackType::kParameter) | 70 void setWeak(P* parameters, void (*callback)(const v8::WeakCallbackInfo<P>&)
, v8::WeakCallbackType type = v8::WeakCallbackType::kParameter) |
| 71 { | 71 { |
| 72 m_handle.SetWeak(parameters, callback, type); | 72 m_handle.SetWeak(parameters, callback, type); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Turns this handle into a weak phantom handle without |
| 76 // finalization callback. |
| 77 void setPhantom() |
| 78 { |
| 79 m_handle.SetWeak(); |
| 80 } |
| 81 |
| 75 void clearWeak() | 82 void clearWeak() |
| 76 { | 83 { |
| 77 m_handle.template ClearWeak<void>(); | 84 m_handle.template ClearWeak<void>(); |
| 78 } | 85 } |
| 79 | 86 |
| 80 bool isEmpty() const { return m_handle.IsEmpty(); } | 87 bool isEmpty() const { return m_handle.IsEmpty(); } |
| 81 bool isWeak() const { return m_handle.IsWeak(); } | 88 bool isWeak() const { return m_handle.IsWeak(); } |
| 82 | 89 |
| 83 void set(v8::Isolate* isolate, v8::Local<T> handle) | 90 void set(v8::Isolate* isolate, v8::Local<T> handle) |
| 84 { | 91 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 115 { | 122 { |
| 116 return m_handle; | 123 return m_handle; |
| 117 } | 124 } |
| 118 | 125 |
| 119 v8::Persistent<T> m_handle; | 126 v8::Persistent<T> m_handle; |
| 120 }; | 127 }; |
| 121 | 128 |
| 122 } // namespace blink | 129 } // namespace blink |
| 123 | 130 |
| 124 #endif // ScopedPersistent_h | 131 #endif // ScopedPersistent_h |
| OLD | NEW |