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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 , m_code(0) | 101 , m_code(0) |
102 { | 102 { |
103 } | 103 } |
104 }; | 104 }; |
105 | 105 |
106 static PassOwnPtr<AsyncFileSystemCallbacks> create(CreateFileResult* result,
const String& name, const KURL& url, FileSystemType type) | 106 static PassOwnPtr<AsyncFileSystemCallbacks> create(CreateFileResult* result,
const String& name, const KURL& url, FileSystemType type) |
107 { | 107 { |
108 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHel
per(result, name, url, type))); | 108 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new CreateFileHel
per(result, name, url, type))); |
109 } | 109 } |
110 | 110 |
111 virtual void didFail(int code) override | 111 void didFail(int code) override |
112 { | 112 { |
113 m_result->m_failed = true; | 113 m_result->m_failed = true; |
114 m_result->m_code = code; | 114 m_result->m_code = code; |
115 } | 115 } |
116 | 116 |
117 virtual ~CreateFileHelper() | 117 ~CreateFileHelper() override |
118 { | 118 { |
119 } | 119 } |
120 | 120 |
121 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<
BlobDataHandle> snapshot) override | 121 void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<BlobData
Handle> snapshot) override |
122 { | 122 { |
123 // We can't directly use the snapshot blob data handle because the conte
nt type on it hasn't been set. | 123 // We can't directly use the snapshot blob data handle because the conte
nt type on it hasn't been set. |
124 // The |snapshot| param is here to provide a a chain of custody thru thr
ead bridging that is held onto until | 124 // The |snapshot| param is here to provide a a chain of custody thru thr
ead bridging that is held onto until |
125 // *after* we've coined a File with a new handle that has the correct ty
pe set on it. This allows the | 125 // *after* we've coined a File with a new handle that has the correct ty
pe set on it. This allows the |
126 // blob storage system to track when a temp file can and can't be safely
deleted. | 126 // blob storage system to track when a temp file can and can't be safely
deleted. |
127 | 127 |
128 m_result->m_file = DOMFileSystemBase::createFile(metadata, m_url, m_type
, m_name); | 128 m_result->m_file = DOMFileSystemBase::createFile(metadata, m_url, m_type
, m_name); |
129 } | 129 } |
130 | 130 |
131 virtual bool shouldBlockUntilCompletion() const override | 131 bool shouldBlockUntilCompletion() const override |
132 { | 132 { |
133 return true; | 133 return true; |
134 } | 134 } |
135 | 135 |
136 private: | 136 private: |
137 CreateFileHelper(CreateFileResult* result, const String& name, const KURL& u
rl, FileSystemType type) | 137 CreateFileHelper(CreateFileResult* result, const String& name, const KURL& u
rl, FileSystemType type) |
138 : m_result(result) | 138 : m_result(result) |
139 , m_name(name) | 139 , m_name(name) |
140 , m_url(url) | 140 , m_url(url) |
141 , m_type(type) | 141 , m_type(type) |
(...skipping 22 matching lines...) Expand all Loading... |
164 | 164 |
165 namespace { | 165 namespace { |
166 | 166 |
167 class ReceiveFileWriterCallback final : public FileWriterBaseCallback { | 167 class ReceiveFileWriterCallback final : public FileWriterBaseCallback { |
168 public: | 168 public: |
169 static ReceiveFileWriterCallback* create() | 169 static ReceiveFileWriterCallback* create() |
170 { | 170 { |
171 return new ReceiveFileWriterCallback(); | 171 return new ReceiveFileWriterCallback(); |
172 } | 172 } |
173 | 173 |
174 virtual void handleEvent(FileWriterBase*) override | 174 void handleEvent(FileWriterBase*) override |
175 { | 175 { |
176 } | 176 } |
177 | 177 |
178 private: | 178 private: |
179 ReceiveFileWriterCallback() | 179 ReceiveFileWriterCallback() |
180 { | 180 { |
181 } | 181 } |
182 }; | 182 }; |
183 | 183 |
184 class LocalErrorCallback final : public ErrorCallback { | 184 class LocalErrorCallback final : public ErrorCallback { |
185 public: | 185 public: |
186 static LocalErrorCallback* create(FileError::ErrorCode& errorCode) | 186 static LocalErrorCallback* create(FileError::ErrorCode& errorCode) |
187 { | 187 { |
188 return new LocalErrorCallback(errorCode); | 188 return new LocalErrorCallback(errorCode); |
189 } | 189 } |
190 | 190 |
191 virtual void handleEvent(FileError* error) override | 191 void handleEvent(FileError* error) override |
192 { | 192 { |
193 ASSERT(error->code() != FileError::OK); | 193 ASSERT(error->code() != FileError::OK); |
194 m_errorCode = error->code(); | 194 m_errorCode = error->code(); |
195 } | 195 } |
196 | 196 |
197 private: | 197 private: |
198 explicit LocalErrorCallback(FileError::ErrorCode& errorCode) | 198 explicit LocalErrorCallback(FileError::ErrorCode& errorCode) |
199 : m_errorCode(errorCode) | 199 : m_errorCode(errorCode) |
200 { | 200 { |
201 } | 201 } |
(...skipping 23 matching lines...) Expand all Loading... |
225 return fileWriter; | 225 return fileWriter; |
226 } | 226 } |
227 | 227 |
228 DEFINE_TRACE(DOMFileSystemSync) | 228 DEFINE_TRACE(DOMFileSystemSync) |
229 { | 229 { |
230 DOMFileSystemBase::trace(visitor); | 230 DOMFileSystemBase::trace(visitor); |
231 visitor->trace(m_rootEntry); | 231 visitor->trace(m_rootEntry); |
232 } | 232 } |
233 | 233 |
234 } | 234 } |
OLD | NEW |