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

Side by Side Diff: WebCore/Modules/filesystem/DOMFileSystemSync.cpp

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 7 years, 11 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) 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 virtual void didFail(int code) 106 virtual void didFail(int code)
107 { 107 {
108 m_result->m_failed = true; 108 m_result->m_failed = true;
109 m_result->m_code = code; 109 m_result->m_code = code;
110 } 110 }
111 111
112 virtual ~CreateFileHelper() 112 virtual ~CreateFileHelper()
113 { 113 {
114 } 114 }
115 115
116 void didReadMetadata(const FileMetadata& metadata) 116 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr< BlobDataHandle> snapshot)
117 { 117 {
118 // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics. 118 // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics.
119 // For other filesystem types (which could be platform-specific ones), t here's a chance that the files are on remote filesystem. If the port has returne d metadata just pass it to File constructor (so we may cache the metadata). 119 // For other filesystem types (which could be platform-specific ones), t here's a chance that the files are on remote filesystem.
120 // If the port has returned metadata just pass it to File constructor (s o we may cache the metadata).
120 // FIXME: We should use the snapshot metadata for all files. 121 // FIXME: We should use the snapshot metadata for all files.
121 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746 122 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
122 if (m_type == FileSystemTypeTemporary || m_type == FileSystemTypePersist ent) { 123 if (m_type == FileSystemTypeTemporary || m_type == FileSystemTypePersist ent) {
123 m_result->m_file = File::createWithName(metadata.platformPath, m_nam e); 124 m_result->m_file = File::createWithName(metadata.platformPath, m_nam e);
124 } else if (!metadata.platformPath.isEmpty()) { 125 } else if (!metadata.platformPath.isEmpty()) {
125 // If the platformPath in the returned metadata is given, we create a File object for the path. 126 // If the platformPath in the returned metadata is given, we create a File object for the path.
126 m_result->m_file = File::createForFileSystemFile(m_name, metadata).g et(); 127 m_result->m_file = File::createForFileSystemFile(m_name, metadata).g et();
127 } else { 128 } else {
128 // Otherwise create a File from the FileSystem URL. 129 // Otherwise create a File from the FileSystem URL.
129 m_result->m_file = File::createForFileSystemFile(m_url, metadata).ge t(); 130 m_result->m_file = File::createForFileSystemFile(m_url, metadata).ge t();
130 } 131 }
132
133 // We can't directly use the snapshot blob data handle because the conte nt type on it hasn't been set.
134 // Having a chain of custody thru thread bridging of that instance up un til now, *after* we've coined a File with a new handle
135 // that has the correct type set on it, allows the blob storage system t o track when a temp file can and can't
136 // be safely deleted.
137 // FIXME: Maybe add a BlobDataHandle/BlobRegistry methods to clone a blo b with a new type?
131 } 138 }
132 private: 139 private:
133 CreateFileHelper(PassRefPtr<CreateFileResult> result, const String& name, co nst KURL& url, FileSystemType type) 140 CreateFileHelper(PassRefPtr<CreateFileResult> result, const String& name, co nst KURL& url, FileSystemType type)
134 : m_result(result) 141 : m_result(result)
135 , m_name(name) 142 , m_name(name)
136 , m_url(url) 143 , m_url(url)
137 , m_type(type) 144 , m_type(type)
138 { 145 {
139 } 146 }
140 147
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return 0; 258 return 0;
252 } 259 }
253 ASSERT(successCallback->fileWriterBase()); 260 ASSERT(successCallback->fileWriterBase());
254 ASSERT(static_cast<FileWriterSync*>(successCallback->fileWriterBase()) == fi leWriter.get()); 261 ASSERT(static_cast<FileWriterSync*>(successCallback->fileWriterBase()) == fi leWriter.get());
255 return fileWriter; 262 return fileWriter;
256 } 263 }
257 264
258 } 265 }
259 266
260 #endif // ENABLE(FILE_SYSTEM) 267 #endif // ENABLE(FILE_SYSTEM)
OLDNEW
« no previous file with comments | « WebCore/Modules/filesystem/DOMFileSystem.cpp ('k') | WebCore/Modules/indexeddb/IDBObjectStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698