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

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

Issue 563703002: Oilpan: Enable oilpan for callback classes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static DOMFileSystem* create(ExecutionContext*, const String& name, FileSyst emType, const KURL& rootURL); 53 static DOMFileSystem* create(ExecutionContext*, const String& name, FileSyst emType, const KURL& rootURL);
54 54
55 // Creates a new isolated file system for the given filesystemId. 55 // Creates a new isolated file system for the given filesystemId.
56 static DOMFileSystem* createIsolatedFileSystem(ExecutionContext*, const Stri ng& filesystemId); 56 static DOMFileSystem* createIsolatedFileSystem(ExecutionContext*, const Stri ng& filesystemId);
57 57
58 DirectoryEntry* root(); 58 DirectoryEntry* root();
59 59
60 // DOMFileSystemBase overrides. 60 // DOMFileSystemBase overrides.
61 virtual void addPendingCallbacks() OVERRIDE; 61 virtual void addPendingCallbacks() OVERRIDE;
62 virtual void removePendingCallbacks() OVERRIDE; 62 virtual void removePendingCallbacks() OVERRIDE;
63 virtual void reportError(PassOwnPtrWillBeRawPtr<ErrorCallback>, PassRefPtrWi llBeRawPtr<FileError>) OVERRIDE; 63 virtual void reportError(ErrorCallback*, PassRefPtrWillBeRawPtr<FileError>) OVERRIDE;
64 64
65 // ActiveDOMObject overrides. 65 // ActiveDOMObject overrides.
66 virtual bool hasPendingActivity() const OVERRIDE; 66 virtual bool hasPendingActivity() const OVERRIDE;
67 67
68 void createWriter(const FileEntry*, PassOwnPtrWillBeRawPtr<FileWriterCallbac k>, PassOwnPtrWillBeRawPtr<ErrorCallback>); 68 void createWriter(const FileEntry*, FileWriterCallback*, ErrorCallback*);
69 void createFile(const FileEntry*, PassOwnPtrWillBeRawPtr<FileCallback>, Pass OwnPtrWillBeRawPtr<ErrorCallback>); 69 void createFile(const FileEntry*, FileCallback*, ErrorCallback*);
70 70
71 // Schedule a callback. This should not cross threads (should be called on t he same context thread). 71 // Schedule a callback. This should not cross threads (should be called on t he same context thread).
72 // FIXME: move this to a more generic place. 72 // FIXME: move this to a more generic place.
73 template <typename CB, typename CBArg> 73 template <typename CB, typename CBArg>
74 static void scheduleCallback(ExecutionContext*, PassOwnPtrWillBeRawPtr<CB>, PassRefPtrWillBeRawPtr<CBArg>); 74 static void scheduleCallback(ExecutionContext*, CB*, PassRefPtrWillBeRawPtr< CBArg>);
75 75
76 template <typename CB, typename CBArg> 76 template <typename CB, typename CBArg>
77 static void scheduleCallback(ExecutionContext*, PassOwnPtrWillBeRawPtr<CB>, CBArg*); 77 static void scheduleCallback(ExecutionContext*, CB*, CBArg*);
78 78
79 template <typename CB, typename CBArg> 79 template <typename CB, typename CBArg>
80 static void scheduleCallback(ExecutionContext*, PassOwnPtrWillBeRawPtr<CB>, const HeapVector<CBArg>&); 80 static void scheduleCallback(ExecutionContext*, CB*, const HeapVector<CBArg> &);
81 81
82 template <typename CB, typename CBArg> 82 template <typename CB, typename CBArg>
83 static void scheduleCallback(ExecutionContext*, PassOwnPtrWillBeRawPtr<CB>, const CBArg&); 83 static void scheduleCallback(ExecutionContext*, CB*, const CBArg&);
84 84
85 template <typename CB> 85 template <typename CB>
86 static void scheduleCallback(ExecutionContext*, PassOwnPtrWillBeRawPtr<CB>); 86 static void scheduleCallback(ExecutionContext*, CB*);
87 87
88 template <typename CB, typename CBArg> 88 template <typename CB, typename CBArg>
89 void scheduleCallback(PassOwnPtrWillBeRawPtr<CB> callback, PassRefPtrWillBeR awPtr<CBArg> callbackArg) 89 void scheduleCallback(CB* callback, PassRefPtrWillBeRawPtr<CBArg> callbackAr g)
90 { 90 {
91 scheduleCallback(executionContext(), callback, callbackArg); 91 scheduleCallback(executionContext(), callback, callbackArg);
92 } 92 }
93 93
94 template <typename CB, typename CBArg> 94 template <typename CB, typename CBArg>
95 void scheduleCallback(PassOwnPtrWillBeRawPtr<CB> callback, CBArg* callbackAr g) 95 void scheduleCallback(CB* callback, CBArg* callbackArg)
96 { 96 {
97 scheduleCallback(executionContext(), callback, callbackArg); 97 scheduleCallback(executionContext(), callback, callbackArg);
98 } 98 }
99 99
100 template <typename CB, typename CBArg> 100 template <typename CB, typename CBArg>
101 void scheduleCallback(PassOwnPtrWillBeRawPtr<CB> callback, const CBArg& call backArg) 101 void scheduleCallback(CB* callback, const CBArg& callbackArg)
102 { 102 {
103 scheduleCallback(executionContext(), callback, callbackArg); 103 scheduleCallback(executionContext(), callback, callbackArg);
104 } 104 }
105 105
106 private: 106 private:
107 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K URL& rootURL); 107 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K URL& rootURL);
108 108
109 class DispatchCallbackTaskBase : public ExecutionContextTask { 109 class DispatchCallbackTaskBase : public ExecutionContextTask {
110 public: 110 public:
111 DispatchCallbackTaskBase() 111 DispatchCallbackTaskBase()
112 : m_taskName("FileSystem") 112 : m_taskName("FileSystem")
113 { 113 {
114 } 114 }
115 115
116 virtual const String& taskNameForInstrumentation() const OVERRIDE 116 virtual const String& taskNameForInstrumentation() const OVERRIDE
117 { 117 {
118 return m_taskName; 118 return m_taskName;
119 } 119 }
120 120
121 private: 121 private:
122 const String m_taskName; 122 const String m_taskName;
123 }; 123 };
124 124
125 // A helper template to schedule a callback task. 125 // A helper template to schedule a callback task.
126 template <typename CB, typename CBArg> 126 template <typename CB, typename CBArg>
127 class DispatchCallbackRefPtrArgTask FINAL : public DispatchCallbackTaskBase { 127 class DispatchCallbackRefPtrArgTask FINAL : public DispatchCallbackTaskBase {
128 public: 128 public:
129 DispatchCallbackRefPtrArgTask(PassOwnPtrWillBeRawPtr<CB> callback, PassR efPtrWillBeRawPtr<CBArg> arg) 129 DispatchCallbackRefPtrArgTask(CB* callback, PassRefPtrWillBeRawPtr<CBArg > arg)
130 : m_callback(callback) 130 : m_callback(callback)
131 , m_callbackArg(arg) 131 , m_callbackArg(arg)
132 { 132 {
133 } 133 }
134 134
135 virtual void performTask(ExecutionContext*) OVERRIDE 135 virtual void performTask(ExecutionContext*) OVERRIDE
136 { 136 {
137 m_callback->handleEvent(m_callbackArg.get()); 137 m_callback->handleEvent(m_callbackArg.get());
138 } 138 }
139 139
140 private: 140 private:
141 OwnPtrWillBePersistent<CB> m_callback; 141 Persistent<CB> m_callback;
142 RefPtrWillBePersistent<CBArg> m_callbackArg; 142 RefPtrWillBePersistent<CBArg> m_callbackArg;
143 }; 143 };
144 144
145 template <typename CB, typename CBArg> 145 template <typename CB, typename CBArg>
146 class DispatchCallbackPtrArgTask FINAL : public DispatchCallbackTaskBase { 146 class DispatchCallbackPtrArgTask FINAL : public DispatchCallbackTaskBase {
147 public: 147 public:
148 DispatchCallbackPtrArgTask(PassOwnPtrWillBeRawPtr<CB> callback, CBArg* a rg) 148 DispatchCallbackPtrArgTask(CB* callback, CBArg* arg)
149 : m_callback(callback) 149 : m_callback(callback)
150 , m_callbackArg(arg) 150 , m_callbackArg(arg)
151 { 151 {
152 } 152 }
153 153
154 virtual void performTask(ExecutionContext*) OVERRIDE 154 virtual void performTask(ExecutionContext*) OVERRIDE
155 { 155 {
156 m_callback->handleEvent(m_callbackArg.get()); 156 m_callback->handleEvent(m_callbackArg.get());
157 } 157 }
158 158
159 private: 159 private:
160 OwnPtrWillBePersistent<CB> m_callback; 160 Persistent<CB> m_callback;
161 Persistent<CBArg> m_callbackArg; 161 Persistent<CBArg> m_callbackArg;
162 }; 162 };
163 163
164 template <typename CB, typename CBArg> 164 template <typename CB, typename CBArg>
165 class DispatchCallbackNonPtrArgTask FINAL : public DispatchCallbackTaskBase { 165 class DispatchCallbackNonPtrArgTask FINAL : public DispatchCallbackTaskBase {
166 public: 166 public:
167 DispatchCallbackNonPtrArgTask(PassOwnPtrWillBeRawPtr<CB> callback, const CBArg& arg) 167 DispatchCallbackNonPtrArgTask(CB* callback, const CBArg& arg)
168 : m_callback(callback) 168 : m_callback(callback)
169 , m_callbackArg(arg) 169 , m_callbackArg(arg)
170 { 170 {
171 } 171 }
172 172
173 virtual void performTask(ExecutionContext*) OVERRIDE 173 virtual void performTask(ExecutionContext*) OVERRIDE
174 { 174 {
175 m_callback->handleEvent(m_callbackArg); 175 m_callback->handleEvent(m_callbackArg);
176 } 176 }
177 177
178 private: 178 private:
179 OwnPtrWillBePersistent<CB> m_callback; 179 Persistent<CB> m_callback;
180 CBArg m_callbackArg; 180 CBArg m_callbackArg;
181 }; 181 };
182 182
183 template <typename CB> 183 template <typename CB>
184 class DispatchCallbackNoArgTask FINAL : public DispatchCallbackTaskBase { 184 class DispatchCallbackNoArgTask FINAL : public DispatchCallbackTaskBase {
185 public: 185 public:
186 DispatchCallbackNoArgTask(PassOwnPtrWillBeRawPtr<CB> callback) 186 DispatchCallbackNoArgTask(CB* callback)
187 : m_callback(callback) 187 : m_callback(callback)
188 { 188 {
189 } 189 }
190 190
191 virtual void performTask(ExecutionContext*) OVERRIDE 191 virtual void performTask(ExecutionContext*) OVERRIDE
192 { 192 {
193 m_callback->handleEvent(); 193 m_callback->handleEvent();
194 } 194 }
195 195
196 private: 196 private:
197 OwnPtrWillBePersistent<CB> m_callback; 197 Persistent<CB> m_callback;
198 }; 198 };
199 199
200 int m_numberOfPendingCallbacks; 200 int m_numberOfPendingCallbacks;
201 }; 201 };
202 202
203 template <typename CB, typename CBArg> 203 template <typename CB, typename CBArg>
204 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn PtrWillBeRawPtr<CB> callback, PassRefPtrWillBeRawPtr<CBArg> arg) 204 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, CB* cal lback, PassRefPtrWillBeRawPtr<CBArg> arg)
205 { 205 {
206 ASSERT(executionContext->isContextThread()); 206 ASSERT(executionContext->isContextThread());
207 if (callback) 207 if (callback)
208 executionContext->postTask(adoptPtr(new DispatchCallbackRefPtrArgTask<CB , CBArg>(callback, arg))); 208 executionContext->postTask(adoptPtr(new DispatchCallbackRefPtrArgTask<CB , CBArg>(callback, arg)));
209 } 209 }
210 210
211 template <typename CB, typename CBArg> 211 template <typename CB, typename CBArg>
212 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn PtrWillBeRawPtr<CB> callback, CBArg* arg) 212 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, CB* cal lback, CBArg* arg)
213 { 213 {
214 ASSERT(executionContext->isContextThread()); 214 ASSERT(executionContext->isContextThread());
215 if (callback) 215 if (callback)
216 executionContext->postTask(adoptPtr(new DispatchCallbackPtrArgTask<CB, C BArg>(callback, arg))); 216 executionContext->postTask(adoptPtr(new DispatchCallbackPtrArgTask<CB, C BArg>(callback, arg)));
217 } 217 }
218 218
219 template <typename CB, typename CBArg> 219 template <typename CB, typename CBArg>
220 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn PtrWillBeRawPtr<CB> callback, const HeapVector<CBArg>& arg) 220 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, CB* cal lback, const HeapVector<CBArg>& arg)
221 { 221 {
222 ASSERT(executionContext->isContextThread()); 222 ASSERT(executionContext->isContextThread());
223 if (callback) 223 if (callback)
224 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB , PersistentHeapVector<CBArg> >(callback, arg))); 224 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB , PersistentHeapVector<CBArg> >(callback, arg)));
225 } 225 }
226 226
227 template <typename CB, typename CBArg> 227 template <typename CB, typename CBArg>
228 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn PtrWillBeRawPtr<CB> callback, const CBArg& arg) 228 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, CB* cal lback, const CBArg& arg)
229 { 229 {
230 ASSERT(executionContext->isContextThread()); 230 ASSERT(executionContext->isContextThread());
231 if (callback) 231 if (callback)
232 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB , CBArg>(callback, arg))); 232 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB , CBArg>(callback, arg)));
233 } 233 }
234 234
235 template <typename CB> 235 template <typename CB>
236 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn PtrWillBeRawPtr<CB> callback) 236 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, CB* cal lback)
237 { 237 {
238 ASSERT(executionContext->isContextThread()); 238 ASSERT(executionContext->isContextThread());
239 if (callback) 239 if (callback)
240 executionContext->postTask(adoptPtr(new DispatchCallbackNoArgTask<CB>(ca llback))); 240 executionContext->postTask(adoptPtr(new DispatchCallbackNoArgTask<CB>(ca llback)));
241 } 241 }
242 242
243 } // namespace blink 243 } // namespace blink
244 244
245 #endif // DOMFileSystem_h 245 #endif // DOMFileSystem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698