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 24 matching lines...) Expand all Loading... |
35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 template<typename T> | 39 template<typename T> |
40 class ScopedPersistent { | 40 class ScopedPersistent { |
41 WTF_MAKE_NONCOPYABLE(ScopedPersistent); | 41 WTF_MAKE_NONCOPYABLE(ScopedPersistent); |
42 public: | 42 public: |
43 ScopedPersistent() { } | 43 ScopedPersistent() { } |
44 | 44 |
45 explicit ScopedPersistent(v8::Handle<T> handle) | 45 ScopedPersistent(v8::Isolate* isolate, v8::Handle<T> handle) |
46 : m_handle(v8::Isolate::GetCurrent(), handle) | 46 : m_handle(isolate, handle) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 ~ScopedPersistent() | 50 ~ScopedPersistent() |
51 { | 51 { |
52 clear(); | 52 clear(); |
53 } | 53 } |
54 | 54 |
55 ALWAYS_INLINE v8::Local<T> newLocal(v8::Isolate* isolate) const | 55 ALWAYS_INLINE v8::Local<T> newLocal(v8::Isolate* isolate) const |
56 { | 56 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 { | 92 { |
93 return m_handle; | 93 return m_handle; |
94 } | 94 } |
95 | 95 |
96 v8::Persistent<T> m_handle; | 96 v8::Persistent<T> m_handle; |
97 }; | 97 }; |
98 | 98 |
99 } // namespace WebCore | 99 } // namespace WebCore |
100 | 100 |
101 #endif // ScopedPersistent_h | 101 #endif // ScopedPersistent_h |
OLD | NEW |