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

Side by Side Diff: Source/modules/filesystem/DOMFileSystem.h

Issue 23704004: Make WebFileSystemCallbacks not self-destruct, deprecate AsyncFileSystem (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 29 matching lines...) Expand all
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class DirectoryEntry; 42 class DirectoryEntry;
43 class File; 43 class File;
44 class FileCallback; 44 class FileCallback;
45 class FileEntry; 45 class FileEntry;
46 class FileWriterCallback; 46 class FileWriterCallback;
47 47
48 class DOMFileSystem : public DOMFileSystemBase, public ScriptWrappable, public A ctiveDOMObject { 48 class DOMFileSystem : public DOMFileSystemBase, public ScriptWrappable, public A ctiveDOMObject {
49 public: 49 public:
50 static PassRefPtr<DOMFileSystem> create(ScriptExecutionContext*, const Strin g& name, FileSystemType, const KURL& rootURL, PassOwnPtr<AsyncFileSystem>); 50 static PassRefPtr<DOMFileSystem> create(ScriptExecutionContext*, const Strin g& name, FileSystemType, const KURL& rootURL);
51 51
52 // Creates a new isolated file system for the given filesystemId. 52 // Creates a new isolated file system for the given filesystemId.
53 static PassRefPtr<DOMFileSystem> createIsolatedFileSystem(ScriptExecutionCon text*, const String& filesystemId); 53 static PassRefPtr<DOMFileSystem> createIsolatedFileSystem(ScriptExecutionCon text*, const String& filesystemId);
54 54
55 PassRefPtr<DirectoryEntry> root(); 55 PassRefPtr<DirectoryEntry> root();
56 56
57 // ActiveDOMObject methods. 57 // DOMFileSystemBase overrides.
58 virtual void stop(); 58 virtual void addPendingCallbacks() OVERRIDE;
59 virtual bool hasPendingActivity() const; 59 virtual void removePendingCallbacks() OVERRIDE;
60 virtual void contextDestroyed();
61 60
62 void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefP tr<ErrorCallback>); 61 void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefP tr<ErrorCallback>);
63 void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<Error Callback>); 62 void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<Error Callback>);
64 63
65 // Schedule a callback. This should not cross threads (should be called on t he same context thread). 64 // Schedule a callback. This should not cross threads (should be called on t he same context thread).
66 // FIXME: move this to a more generic place. 65 // FIXME: move this to a more generic place.
67 template <typename CB, typename CBArg> 66 template <typename CB, typename CBArg>
68 static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, PassRe fPtr<CBArg>); 67 static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, PassRe fPtr<CBArg>);
69 68
70 template <typename CB, typename CBArg> 69 template <typename CB, typename CBArg>
71 static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, const CBArg&); 70 static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, const CBArg&);
72 71
73 template <typename CB, typename CBArg> 72 template <typename CB, typename CBArg>
74 void scheduleCallback(PassRefPtr<CB> callback, PassRefPtr<CBArg> callbackArg ) 73 void scheduleCallback(PassRefPtr<CB> callback, PassRefPtr<CBArg> callbackArg )
75 { 74 {
76 scheduleCallback(scriptExecutionContext(), callback, callbackArg); 75 scheduleCallback(scriptExecutionContext(), callback, callbackArg);
77 } 76 }
78 77
79 template <typename CB, typename CBArg> 78 template <typename CB, typename CBArg>
80 void scheduleCallback(PassRefPtr<CB> callback, const CBArg& callbackArg) 79 void scheduleCallback(PassRefPtr<CB> callback, const CBArg& callbackArg)
81 { 80 {
82 scheduleCallback(scriptExecutionContext(), callback, callbackArg); 81 scheduleCallback(scriptExecutionContext(), callback, callbackArg);
83 } 82 }
84 83
85 private: 84 private:
86 DOMFileSystem(ScriptExecutionContext*, const String& name, FileSystemType, c onst KURL& rootURL, PassOwnPtr<AsyncFileSystem>); 85 DOMFileSystem(ScriptExecutionContext*, const String& name, FileSystemType, c onst KURL& rootURL);
87 86
88 // A helper template to schedule a callback task. 87 // A helper template to schedule a callback task.
89 template <typename CB, typename CBArg> 88 template <typename CB, typename CBArg>
90 class DispatchCallbacRefPtrArgTask : public ScriptExecutionContext::Task { 89 class DispatchCallbacRefPtrArgTask : public ScriptExecutionContext::Task {
91 public: 90 public:
92 DispatchCallbacRefPtrArgTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg) 91 DispatchCallbacRefPtrArgTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg)
93 : m_callback(callback) 92 : m_callback(callback)
94 , m_callbackArg(arg) 93 , m_callbackArg(arg)
95 { 94 {
96 } 95 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionCont ext, PassRefPtr<CB> callback, const CBArg& arg) 136 void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionCont ext, PassRefPtr<CB> callback, const CBArg& arg)
138 { 137 {
139 ASSERT(scriptExecutionContext->isContextThread()); 138 ASSERT(scriptExecutionContext->isContextThread());
140 if (callback) 139 if (callback)
141 scriptExecutionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgT ask<CB, CBArg>(callback, arg))); 140 scriptExecutionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgT ask<CB, CBArg>(callback, arg)));
142 } 141 }
143 142
144 } // namespace 143 } // namespace
145 144
146 #endif // DOMFileSystem_h 145 #endif // DOMFileSystem_h
OLDNEW
« no previous file with comments | « Source/core/platform/chromium/support/WebFileSystemCallbacks.cpp ('k') | Source/modules/filesystem/DOMFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698