OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Creates a new isolated file system for the given filesystemId. | 54 // Creates a new isolated file system for the given filesystemId. |
55 static PassRefPtrWillBeRawPtr<DOMFileSystem> createIsolatedFileSystem(Execut
ionContext*, const String& filesystemId); | 55 static PassRefPtrWillBeRawPtr<DOMFileSystem> createIsolatedFileSystem(Execut
ionContext*, const String& filesystemId); |
56 | 56 |
57 PassRefPtrWillBeRawPtr<DirectoryEntry> root(); | 57 PassRefPtrWillBeRawPtr<DirectoryEntry> root(); |
58 | 58 |
59 // DOMFileSystemBase overrides. | 59 // DOMFileSystemBase overrides. |
60 virtual void addPendingCallbacks() OVERRIDE; | 60 virtual void addPendingCallbacks() OVERRIDE; |
61 virtual void removePendingCallbacks() OVERRIDE; | 61 virtual void removePendingCallbacks() OVERRIDE; |
62 virtual void reportError(PassOwnPtr<ErrorCallback>, PassRefPtrWillBeRawPtr<F
ileError>) OVERRIDE; | 62 virtual void reportError(PassOwnPtr<ErrorCallback>, PassRefPtrWillBeRawPtr<F
ileError>) OVERRIDE; |
63 | 63 |
| 64 // ActiveDOMObject overrides. |
| 65 virtual bool hasPendingActivity() const OVERRIDE; |
| 66 |
64 void createWriter(const FileEntry*, PassOwnPtr<FileWriterCallback>, PassOwnP
tr<ErrorCallback>); | 67 void createWriter(const FileEntry*, PassOwnPtr<FileWriterCallback>, PassOwnP
tr<ErrorCallback>); |
65 void createFile(const FileEntry*, PassOwnPtr<FileCallback>, PassOwnPtr<Error
Callback>); | 68 void createFile(const FileEntry*, PassOwnPtr<FileCallback>, PassOwnPtr<Error
Callback>); |
66 | 69 |
67 // Schedule a callback. This should not cross threads (should be called on t
he same context thread). | 70 // Schedule a callback. This should not cross threads (should be called on t
he same context thread). |
68 // FIXME: move this to a more generic place. | 71 // FIXME: move this to a more generic place. |
69 template <typename CB, typename CBArg> | 72 template <typename CB, typename CBArg> |
70 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, PassRefPtrWi
llBeRawPtr<CBArg>); | 73 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, PassRefPtrWi
llBeRawPtr<CBArg>); |
71 | 74 |
72 template <typename CB, typename CBArg> | 75 template <typename CB, typename CBArg> |
73 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, const CBArg&
); | 76 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, const CBArg&
); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 121 |
119 virtual void performTask(ExecutionContext*) OVERRIDE | 122 virtual void performTask(ExecutionContext*) OVERRIDE |
120 { | 123 { |
121 m_callback->handleEvent(m_callbackArg); | 124 m_callback->handleEvent(m_callbackArg); |
122 } | 125 } |
123 | 126 |
124 private: | 127 private: |
125 OwnPtr<CB> m_callback; | 128 OwnPtr<CB> m_callback; |
126 CBArg m_callbackArg; | 129 CBArg m_callbackArg; |
127 }; | 130 }; |
| 131 |
| 132 int m_numberOfPendingCallbacks; |
128 }; | 133 }; |
129 | 134 |
130 template <typename CB, typename CBArg> | 135 template <typename CB, typename CBArg> |
131 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, PassRefPtrWillBeRawPtr<CBArg> arg) | 136 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, PassRefPtrWillBeRawPtr<CBArg> arg) |
132 { | 137 { |
133 ASSERT(executionContext->isContextThread()); | 138 ASSERT(executionContext->isContextThread()); |
134 if (callback) | 139 if (callback) |
135 executionContext->postTask(adoptPtr(new DispatchCallbacRefPtrArgTask<CB,
CBArg>(callback, arg))); | 140 executionContext->postTask(adoptPtr(new DispatchCallbacRefPtrArgTask<CB,
CBArg>(callback, arg))); |
136 } | 141 } |
137 | 142 |
138 template <typename CB, typename CBArg> | 143 template <typename CB, typename CBArg> |
139 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) | 144 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) |
140 { | 145 { |
141 ASSERT(executionContext->isContextThread()); | 146 ASSERT(executionContext->isContextThread()); |
142 if (callback) | 147 if (callback) |
143 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); | 148 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); |
144 } | 149 } |
145 | 150 |
146 } // namespace | 151 } // namespace |
147 | 152 |
148 #endif // DOMFileSystem_h | 153 #endif // DOMFileSystem_h |
OLD | NEW |