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

Side by Side Diff: Source/core/fileapi/File.cpp

Issue 157363003: Implement Blob.close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Avoid warning from PHP's fread() on empty reads Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (!getFileMetadata(m_path, metadata)) { 218 if (!getFileMetadata(m_path, metadata)) {
219 snapshotSize = 0; 219 snapshotSize = 0;
220 snapshotModificationTime = invalidFileTime(); 220 snapshotModificationTime = invalidFileTime();
221 return; 221 return;
222 } 222 }
223 223
224 snapshotSize = metadata.length; 224 snapshotSize = metadata.length;
225 snapshotModificationTime = metadata.modificationTime; 225 snapshotModificationTime = metadata.modificationTime;
226 } 226 }
227 227
228 void File::close(ExecutionContext* executionContext)
229 {
230 if (!hasBeenClosed()) {
231 m_hasBackingFile = false;
232 m_relativePath = String();
233 m_path = String();
kinuko 2014/02/12 12:52:00 There're more fields in this class (e.g. m_name)--
sof 2014/02/12 12:53:46 The name of the Blob isn't currently spec'ed as go
kinuko 2014/02/12 13:26:25 I see thanks. Could we clear m_fileSystemURL too t
sof 2014/02/12 22:28:26 Yes, better do both.
sof 2014/02/13 09:59:57 Done now.
234 invalidateSnapshotMetadata();
235 Blob::close(executionContext);
236 }
237 }
238
228 void File::appendTo(BlobData& blobData) const 239 void File::appendTo(BlobData& blobData) const
229 { 240 {
230 if (!m_hasBackingFile) { 241 if (!m_hasBackingFile) {
231 Blob::appendTo(blobData); 242 Blob::appendTo(blobData);
232 return; 243 return;
233 } 244 }
234 245
235 // FIXME: This involves synchronous file operation. We need to figure out ho w to make it asynchronous. 246 // FIXME: This involves synchronous file operation. We need to figure out ho w to make it asynchronous.
236 long long size; 247 long long size;
237 double modificationTime; 248 double modificationTime;
238 captureSnapshot(size, modificationTime); 249 captureSnapshot(size, modificationTime);
239 if (!m_fileSystemURL.isEmpty()) { 250 if (!m_fileSystemURL.isEmpty()) {
240 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime) ; 251 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime) ;
241 return; 252 return;
242 } 253 }
243 ASSERT(!m_path.isEmpty()); 254 ASSERT(!m_path.isEmpty());
244 blobData.appendFile(m_path, 0, size, modificationTime); 255 blobData.appendFile(m_path, 0, size, modificationTime);
245 } 256 }
246 257
247 } // namespace WebCore 258 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698