Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: Source/modules/webdatabase/SQLCallbackWrapper.h

Issue 311273005: Oilpan: Prepare to move AbstractSQLStatement, SQLStatement, and SQLCallbackWrapper<T> to Oilpan hea… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698