| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 { | 77 { |
| 78 m_handle.Reset(isolate, handle); | 78 m_handle.Reset(isolate, handle); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. | 81 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. |
| 82 void clear() | 82 void clear() |
| 83 { | 83 { |
| 84 m_handle.Reset(); | 84 m_handle.Reset(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void setReference(const v8::Persistent<v8::Object>& parent, v8::Isolate* iso
late) |
| 88 { |
| 89 isolate->SetReference(parent, m_handle); |
| 90 } |
| 91 |
| 87 bool operator==(const ScopedPersistent<T>& other) | 92 bool operator==(const ScopedPersistent<T>& other) |
| 88 { | 93 { |
| 89 return m_handle == other.m_handle; | 94 return m_handle == other.m_handle; |
| 90 } | 95 } |
| 91 | 96 |
| 92 template <class S> | 97 template <class S> |
| 93 bool operator==(const v8::Local<S> other) const | 98 bool operator==(const v8::Local<S> other) const |
| 94 { | 99 { |
| 95 return m_handle == other; | 100 return m_handle == other; |
| 96 } | 101 } |
| 97 | 102 |
| 98 private: | 103 private: |
| 99 // FIXME: This function does an unsafe handle access. Remove it. | 104 // FIXME: This function does an unsafe handle access. Remove it. |
| 100 friend class V8AbstractEventListener; | 105 friend class V8AbstractEventListener; |
| 101 friend class V8PerIsolateData; | 106 friend class V8PerIsolateData; |
| 102 ALWAYS_INLINE v8::Persistent<T>& getUnsafe() | 107 ALWAYS_INLINE v8::Persistent<T>& getUnsafe() |
| 103 { | 108 { |
| 104 return m_handle; | 109 return m_handle; |
| 105 } | 110 } |
| 106 | 111 |
| 107 v8::Persistent<T> m_handle; | 112 v8::Persistent<T> m_handle; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 } // namespace blink | 115 } // namespace blink |
| 111 | 116 |
| 112 #endif // ScopedPersistent_h | 117 #endif // ScopedPersistent_h |
| OLD | NEW |