| 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 void clearWeak() | |
| 76 { | |
| 77 m_handle.template ClearWeak<void>(); | |
| 78 } | |
| 79 | |
| 80 bool isEmpty() const { return m_handle.IsEmpty(); } | 75 bool isEmpty() const { return m_handle.IsEmpty(); } |
| 81 bool isWeak() const { return m_handle.IsWeak(); } | 76 bool isWeak() const { return m_handle.IsWeak(); } |
| 82 | 77 |
| 83 void set(v8::Isolate* isolate, v8::Local<T> handle) | 78 void set(v8::Isolate* isolate, v8::Local<T> handle) |
| 84 { | 79 { |
| 85 m_handle.Reset(isolate, handle); | 80 m_handle.Reset(isolate, handle); |
| 86 } | 81 } |
| 87 | 82 |
| 88 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. | 83 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. |
| 89 void clear() | 84 void clear() |
| (...skipping 25 matching lines...) Expand all Loading... |
| 115 { | 110 { |
| 116 return m_handle; | 111 return m_handle; |
| 117 } | 112 } |
| 118 | 113 |
| 119 v8::Persistent<T> m_handle; | 114 v8::Persistent<T> m_handle; |
| 120 }; | 115 }; |
| 121 | 116 |
| 122 } // namespace blink | 117 } // namespace blink |
| 123 | 118 |
| 124 #endif // ScopedPersistent_h | 119 #endif // ScopedPersistent_h |
| OLD | NEW |