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

Unified Diff: Source/modules/filesystem/DOMFileSystem.h

Issue 22436002: Replace EntryArray type by an Entry[] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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
« no previous file with comments | « Source/core/inspector/InspectorFileSystemAgent.cpp ('k') | Source/modules/filesystem/DOMFileSystemBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/filesystem/DOMFileSystem.h
diff --git a/Source/modules/filesystem/DOMFileSystem.h b/Source/modules/filesystem/DOMFileSystem.h
index 0efbcec5113b59cb408e82bb9c2418a0d5b267a5..4f334222e6dc661f31f38753b5c4f2b105773016 100644
--- a/Source/modules/filesystem/DOMFileSystem.h
+++ b/Source/modules/filesystem/DOMFileSystem.h
@@ -35,6 +35,7 @@
#include "core/dom/ActiveDOMObject.h"
#include "core/dom/ScriptExecutionContext.h"
#include "modules/filesystem/DOMFileSystemBase.h"
+#include "modules/filesystem/EntriesCallback.h"
namespace WebCore {
@@ -67,19 +68,28 @@ public:
static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, PassRefPtr<CBArg>);
template <typename CB, typename CBArg>
+ static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, const CBArg&);
+
+ template <typename CB, typename CBArg>
void scheduleCallback(PassRefPtr<CB> callback, PassRefPtr<CBArg> callbackArg)
{
scheduleCallback(scriptExecutionContext(), callback, callbackArg);
}
+ template <typename CB, typename CBArg>
+ void scheduleCallback(PassRefPtr<CB> callback, const CBArg& callbackArg)
+ {
+ scheduleCallback(scriptExecutionContext(), callback, callbackArg);
+ }
+
private:
DOMFileSystem(ScriptExecutionContext*, const String& name, FileSystemType, const KURL& rootURL, PassOwnPtr<AsyncFileSystem>);
// A helper template to schedule a callback task.
template <typename CB, typename CBArg>
- class DispatchCallbackTask : public ScriptExecutionContext::Task {
+ class DispatchCallbacRefPtrArgTask : public ScriptExecutionContext::Task {
public:
- DispatchCallbackTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg)
+ DispatchCallbacRefPtrArgTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg)
: m_callback(callback)
, m_callbackArg(arg)
{
@@ -94,6 +104,25 @@ private:
RefPtr<CB> m_callback;
RefPtr<CBArg> m_callbackArg;
};
+
+ template <typename CB, typename CBArg>
+ class DispatchCallbackNonPtrArgTask : public ScriptExecutionContext::Task {
+ public:
+ DispatchCallbackNonPtrArgTask(PassRefPtr<CB> callback, const CBArg& arg)
+ : m_callback(callback)
+ , m_callbackArg(arg)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext*)
+ {
+ m_callback->handleEvent(m_callbackArg);
+ }
+
+ private:
+ RefPtr<CB> m_callback;
+ CBArg m_callbackArg;
+ };
};
template <typename CB, typename CBArg>
@@ -101,7 +130,15 @@ void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionCont
{
ASSERT(scriptExecutionContext->isContextThread());
if (callback)
- scriptExecutionContext->postTask(adoptPtr(new DispatchCallbackTask<CB, CBArg>(callback, arg)));
+ scriptExecutionContext->postTask(adoptPtr(new DispatchCallbacRefPtrArgTask<CB, CBArg>(callback, arg)));
+}
+
+template <typename CB, typename CBArg>
+void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<CB> callback, const CBArg& arg)
+{
+ ASSERT(scriptExecutionContext->isContextThread());
+ if (callback)
+ scriptExecutionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB, CBArg>(callback, arg)));
}
} // namespace
« no previous file with comments | « Source/core/inspector/InspectorFileSystemAgent.cpp ('k') | Source/modules/filesystem/DOMFileSystemBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698