OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 #ifndef SQLCallbackWrapper_h | 28 #ifndef SQLCallbackWrapper_h |
29 #define SQLCallbackWrapper_h | 29 #define SQLCallbackWrapper_h |
30 | 30 |
31 #include "core/dom/ExecutionContext.h" | 31 #include "core/dom/ExecutionContext.h" |
32 #include "core/dom/ExecutionContextTask.h" | 32 #include "core/dom/ExecutionContextTask.h" |
33 #include "wtf/ThreadingPrimitives.h" | 33 #include "wtf/ThreadingPrimitives.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace blink { |
36 | 36 |
37 // A helper class to safely dereference the callback objects held by | 37 // A helper class to safely dereference the callback objects held by |
38 // SQLStatement and SQLTransaction on the proper thread. The 'wrapped' | 38 // SQLStatement and SQLTransaction on the proper thread. The 'wrapped' |
39 // callback is dereferenced: | 39 // callback is dereferenced: |
40 // - by destructing the enclosing wrapper - on any thread | 40 // - by destructing the enclosing wrapper - on any thread |
41 // - by calling clear() - on any thread | 41 // - by calling clear() - on any thread |
42 // - by unwrapping and then dereferencing normally - on context thread only | 42 // - by unwrapping and then dereferencing normally - on context thread only |
43 // Oilpan: ~T must be thread-independent. | 43 // Oilpan: ~T must be thread-independent. |
44 template<typename T> class SQLCallbackWrapper { | 44 template<typename T> class SQLCallbackWrapper { |
45 DISALLOW_ALLOCATION(); | 45 DISALLOW_ALLOCATION(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 OwnPtr<T> m_callbackToRelease; | 126 OwnPtr<T> m_callbackToRelease; |
127 }; | 127 }; |
128 #endif | 128 #endif |
129 | 129 |
130 Mutex m_mutex; | 130 Mutex m_mutex; |
131 OwnPtr<T> m_callback; | 131 OwnPtr<T> m_callback; |
132 RefPtrWillBeMember<ExecutionContext> m_executionContext; | 132 RefPtrWillBeMember<ExecutionContext> m_executionContext; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace WebCore | 135 } // namespace blink |
136 | 136 |
137 #endif // SQLCallbackWrapper_h | 137 #endif // SQLCallbackWrapper_h |
OLD | NEW |