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