| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // For ErrorCallback. | 60 // For ErrorCallback. |
| 61 virtual void didFail(int code) override final; | 61 virtual void didFail(int code) override final; |
| 62 | 62 |
| 63 // Other callback methods are implemented by each subclass. | 63 // Other callback methods are implemented by each subclass. |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 FileSystemCallbacksBase(ErrorCallback*, DOMFileSystemBase*, ExecutionContext
*); | 66 FileSystemCallbacksBase(ErrorCallback*, DOMFileSystemBase*, ExecutionContext
*); |
| 67 | 67 |
| 68 bool shouldScheduleCallback() const; | 68 bool shouldScheduleCallback() const; |
| 69 | 69 |
| 70 #if !ENABLE(OILPAN) | |
| 71 template <typename CB, typename CBArg> | |
| 72 void handleEventOrScheduleCallback(RawPtr<CB>, RawPtr<CBArg>); | |
| 73 #endif | |
| 74 | |
| 75 template <typename CB, typename CBArg> | 70 template <typename CB, typename CBArg> |
| 76 void handleEventOrScheduleCallback(RawPtr<CB>, CBArg*); | 71 void handleEventOrScheduleCallback(RawPtr<CB>, CBArg*); |
| 77 | 72 |
| 78 template <typename CB, typename CBArg> | |
| 79 void handleEventOrScheduleCallback(RawPtr<CB>, PassRefPtrWillBeRawPtr<CBArg>
); | |
| 80 | |
| 81 template <typename CB> | 73 template <typename CB> |
| 82 void handleEventOrScheduleCallback(RawPtr<CB>); | 74 void handleEventOrScheduleCallback(RawPtr<CB>); |
| 83 | 75 |
| 84 Persistent<ErrorCallback> m_errorCallback; | 76 Persistent<ErrorCallback> m_errorCallback; |
| 85 Persistent<DOMFileSystemBase> m_fileSystem; | 77 Persistent<DOMFileSystemBase> m_fileSystem; |
| 86 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 78 RefPtrWillBePersistent<ExecutionContext> m_executionContext; |
| 87 int m_asyncOperationId; | 79 int m_asyncOperationId; |
| 88 }; | 80 }; |
| 89 | 81 |
| 90 // Subclasses ---------------------------------------------------------------- | 82 // Subclasses ---------------------------------------------------------------- |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 static PassOwnPtr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorC
allback*, ExecutionContext*, DOMFileSystemBase*); | 133 static PassOwnPtr<AsyncFileSystemCallbacks> create(MetadataCallback*, ErrorC
allback*, ExecutionContext*, DOMFileSystemBase*); |
| 142 virtual void didReadMetadata(const FileMetadata&) override; | 134 virtual void didReadMetadata(const FileMetadata&) override; |
| 143 | 135 |
| 144 private: | 136 private: |
| 145 MetadataCallbacks(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMF
ileSystemBase*); | 137 MetadataCallbacks(MetadataCallback*, ErrorCallback*, ExecutionContext*, DOMF
ileSystemBase*); |
| 146 Persistent<MetadataCallback> m_successCallback; | 138 Persistent<MetadataCallback> m_successCallback; |
| 147 }; | 139 }; |
| 148 | 140 |
| 149 class FileWriterBaseCallbacks final : public FileSystemCallbacksBase { | 141 class FileWriterBaseCallbacks final : public FileSystemCallbacksBase { |
| 150 public: | 142 public: |
| 151 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassRefPtrWillBeRawPtr<Fi
leWriterBase>, FileWriterBaseCallback*, ErrorCallback*, ExecutionContext*); | 143 static PassOwnPtr<AsyncFileSystemCallbacks> create(FileWriterBase*, FileWrit
erBaseCallback*, ErrorCallback*, ExecutionContext*); |
| 152 virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length
) override; | 144 virtual void didCreateFileWriter(PassOwnPtr<WebFileWriter>, long long length
) override; |
| 153 | 145 |
| 154 private: | 146 private: |
| 155 FileWriterBaseCallbacks(PassRefPtrWillBeRawPtr<FileWriterBase>, FileWriterBa
seCallback*, ErrorCallback*, ExecutionContext*); | 147 FileWriterBaseCallbacks(FileWriterBase*, FileWriterBaseCallback*, ErrorCallb
ack*, ExecutionContext*); |
| 156 Persistent<FileWriterBase> m_fileWriter; | 148 Persistent<FileWriterBase> m_fileWriter; |
| 157 Persistent<FileWriterBaseCallback> m_successCallback; | 149 Persistent<FileWriterBaseCallback> m_successCallback; |
| 158 }; | 150 }; |
| 159 | 151 |
| 160 class SnapshotFileCallback final : public FileSystemCallbacksBase { | 152 class SnapshotFileCallback final : public FileSystemCallbacksBase { |
| 161 public: | 153 public: |
| 162 static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const
String& name, const KURL&, FileCallback*, ErrorCallback*, ExecutionContext*); | 154 static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystemBase*, const
String& name, const KURL&, FileCallback*, ErrorCallback*, ExecutionContext*); |
| 163 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot); | 155 virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataH
andle> snapshot); |
| 164 | 156 |
| 165 private: | 157 private: |
| 166 SnapshotFileCallback(DOMFileSystemBase*, const String& name, const KURL&, Fi
leCallback*, ErrorCallback*, ExecutionContext*); | 158 SnapshotFileCallback(DOMFileSystemBase*, const String& name, const KURL&, Fi
leCallback*, ErrorCallback*, ExecutionContext*); |
| 167 String m_name; | 159 String m_name; |
| 168 KURL m_url; | 160 KURL m_url; |
| 169 Persistent<FileCallback> m_successCallback; | 161 Persistent<FileCallback> m_successCallback; |
| 170 }; | 162 }; |
| 171 | 163 |
| 172 class VoidCallbacks final : public FileSystemCallbacksBase { | 164 class VoidCallbacks final : public FileSystemCallbacksBase { |
| 173 public: | 165 public: |
| 174 static PassOwnPtr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallb
ack*, ExecutionContext*, DOMFileSystemBase*); | 166 static PassOwnPtr<AsyncFileSystemCallbacks> create(VoidCallback*, ErrorCallb
ack*, ExecutionContext*, DOMFileSystemBase*); |
| 175 virtual void didSucceed() override; | 167 virtual void didSucceed() override; |
| 176 | 168 |
| 177 private: | 169 private: |
| 178 VoidCallbacks(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSyste
mBase*); | 170 VoidCallbacks(VoidCallback*, ErrorCallback*, ExecutionContext*, DOMFileSyste
mBase*); |
| 179 Persistent<VoidCallback> m_successCallback; | 171 Persistent<VoidCallback> m_successCallback; |
| 180 }; | 172 }; |
| 181 | 173 |
| 182 } // namespace blink | 174 } // namespace blink |
| 183 | 175 |
| 184 #endif // FileSystemCallbacks_h | 176 #endif // FileSystemCallbacks_h |
| OLD | NEW |