| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class DirectoryEntry; | 44 class DirectoryEntry; |
| 45 class File; | 45 class File; |
| 46 class FileCallback; | 46 class FileCallback; |
| 47 class FileEntry; | 47 class FileEntry; |
| 48 class FileWriterCallback; | 48 class FileWriterCallback; |
| 49 | 49 |
| 50 class DOMFileSystem FINAL : public DOMFileSystemBase, public ScriptWrappable, pu
blic ActiveDOMObject { | 50 class DOMFileSystem FINAL : public DOMFileSystemBase, public ScriptWrappable, pu
blic ActiveDOMObject { |
| 51 public: | 51 public: |
| 52 static PassRefPtr<DOMFileSystem> create(ExecutionContext*, const String& nam
e, FileSystemType, const KURL& rootURL); | 52 static PassRefPtrWillBeRawPtr<DOMFileSystem> create(ExecutionContext*, const
String& name, FileSystemType, const KURL& rootURL); |
| 53 | 53 |
| 54 // Creates a new isolated file system for the given filesystemId. | 54 // Creates a new isolated file system for the given filesystemId. |
| 55 static PassRefPtr<DOMFileSystem> createIsolatedFileSystem(ExecutionContext*,
const String& filesystemId); | 55 static PassRefPtrWillBeRawPtr<DOMFileSystem> createIsolatedFileSystem(Execut
ionContext*, const String& filesystemId); |
| 56 | 56 |
| 57 PassRefPtr<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 void createWriter(const FileEntry*, PassOwnPtr<FileWriterCallback>, PassOwnP
tr<ErrorCallback>); | 64 void createWriter(const FileEntry*, PassOwnPtr<FileWriterCallback>, PassOwnP
tr<ErrorCallback>); |
| 65 void createFile(const FileEntry*, PassOwnPtr<FileCallback>, PassOwnPtr<Error
Callback>); | 65 void createFile(const FileEntry*, PassOwnPtr<FileCallback>, PassOwnPtr<Error
Callback>); |
| 66 | 66 |
| 67 // Schedule a callback. This should not cross threads (should be called on t
he same context thread). | 67 // 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. | 68 // FIXME: move this to a more generic place. |
| 69 template <typename CB, typename CBArg> | 69 template <typename CB, typename CBArg> |
| 70 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, PassRefPtrWi
llBeRawPtr<CBArg>); | 70 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, PassRefPtrWi
llBeRawPtr<CBArg>); |
| 71 | 71 |
| 72 template <typename CB, typename CBArg> | 72 template <typename CB, typename CBArg> |
| 73 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, const CBArg&
); | 73 static void scheduleCallback(ExecutionContext*, PassOwnPtr<CB>, const CBArg&
); |
| 74 | 74 |
| 75 template <typename CB, typename CBArg> | 75 template <typename CB, typename CBArg> |
| 76 void scheduleCallback(PassOwnPtr<CB> callback, PassRefPtrWillBeRawPtr<CBArg>
callbackArg) | 76 void scheduleCallback(PassOwnPtr<CB> callback, PassRefPtrWillBeRawPtr<CBArg>
callbackArg) |
| 77 { | 77 { |
| 78 scheduleCallback(executionContext(), callback, callbackArg); | 78 scheduleCallback(executionContext(), callback, callbackArg); |
| 79 } | 79 } |
| 80 | 80 |
| 81 template <typename CB, typename CBArg> | 81 template <typename CB, typename CBArg> |
| 82 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg) | 82 void scheduleCallback(PassOwnPtr<CB> callback, const CBArg& callbackArg) |
| 83 { | 83 { |
| 84 scheduleCallback(executionContext(), callback, callbackArg); | 84 scheduleCallback(executionContext(), callback, callbackArg); |
| 85 } | 85 } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K
URL& rootURL); | 88 DOMFileSystem(ExecutionContext*, const String& name, FileSystemType, const K
URL& rootURL); |
| 89 | 89 |
| 90 // A helper template to schedule a callback task. | 90 // A helper template to schedule a callback task. |
| 91 template <typename CB, typename CBArg> | 91 template <typename CB, typename CBArg> |
| 92 class DispatchCallbacRefPtrArgTask FINAL : public ExecutionContextTask { | 92 class DispatchCallbacRefPtrArgTask FINAL : public ExecutionContextTask { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) | 139 void DOMFileSystem::scheduleCallback(ExecutionContext* executionContext, PassOwn
Ptr<CB> callback, const CBArg& arg) |
| 140 { | 140 { |
| 141 ASSERT(executionContext->isContextThread()); | 141 ASSERT(executionContext->isContextThread()); |
| 142 if (callback) | 142 if (callback) |
| 143 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); | 143 executionContext->postTask(adoptPtr(new DispatchCallbackNonPtrArgTask<CB
, CBArg>(callback, arg))); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace | 146 } // namespace |
| 147 | 147 |
| 148 #endif // DOMFileSystem_h | 148 #endif // DOMFileSystem_h |
| OLD | NEW |