Chromium Code Reviews| Index: Source/modules/webdatabase/SQLCallbackWrapper.h |
| diff --git a/Source/modules/webdatabase/SQLCallbackWrapper.h b/Source/modules/webdatabase/SQLCallbackWrapper.h |
| index e630b0af976139d80bb4bba1b99ff3494ec76db2..29bd637da70c980fa115f528125f45830405e5f9 100644 |
| --- a/Source/modules/webdatabase/SQLCallbackWrapper.h |
| +++ b/Source/modules/webdatabase/SQLCallbackWrapper.h |
| @@ -41,6 +41,7 @@ namespace WebCore { |
| // - by calling clear() - on any thread |
| // - by unwrapping and then dereferencing normally - on context thread only |
| template<typename T> class SQLCallbackWrapper { |
| + DISALLOW_ALLOCATION(); |
| public: |
| SQLCallbackWrapper(PassOwnPtr<T> callback, ExecutionContext* executionContext) |
| : m_callback(callback) |
| @@ -54,8 +55,19 @@ public: |
| clear(); |
| } |
| + // FIXME: Oilpan: Trace m_executionContext. |
| + void trace(Visitor* visitor) { } |
| + |
| void clear() |
| { |
| +#if ENABLE(OILPAN) |
| + // It's safe to call ~T in non-context-thread. |
| + // Implementation classses of ExecutionContext are on-heap. Their |
|
haraken
2014/06/05 08:22:43
classes
tkent
2014/06/05 23:39:32
Done.
|
| + // destructors are called in their owner threads. |
| + MutexLocker locker(m_mutex); |
| + m_callback.clear(); |
| + m_executionContext.clear(); |
| +#else |
| ExecutionContext* context; |
| OwnPtr<T> callback; |
| { |
| @@ -73,6 +85,7 @@ public: |
| callback = m_callback.release(); |
| } |
| context->postTask(SafeReleaseTask::create(callback.release())); |
| +#endif |
| } |
| PassOwnPtr<T> unwrap() |
| @@ -87,6 +100,7 @@ public: |
| bool hasCallback() const { return m_callback; } |
| private: |
| +#if !ENABLE(OILPAN) |
| class SafeReleaseTask : public ExecutionContextTask { |
| public: |
| static PassOwnPtr<SafeReleaseTask> create(PassOwnPtr<T> callbackToRelease) |
| @@ -111,6 +125,7 @@ private: |
| OwnPtr<T> m_callbackToRelease; |
| }; |
| +#endif |
| Mutex m_mutex; |
| OwnPtr<T> m_callback; |