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

Side by Side Diff: WebCore/fileapi/File.h

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
« no previous file with comments | « WebCore/fileapi/BlobURL.cpp ('k') | WebCore/fileapi/File.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 WellKnownContentTypes, 44 WellKnownContentTypes,
45 AllContentTypes, 45 AllContentTypes,
46 }; 46 };
47 47
48 static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy p olicy = WellKnownContentTypes) 48 static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy p olicy = WellKnownContentTypes)
49 { 49 {
50 return adoptRef(new File(path, policy)); 50 return adoptRef(new File(path, policy));
51 } 51 }
52 52
53 // For deserialization. 53 // For deserialization.
54 static PassRefPtr<File> create(const String& path, const KURL& srcURL, const String& type) 54 static PassRefPtr<File> create(const String& path, const String& uuid, const String& type)
55 { 55 {
56 return adoptRef(new File(path, srcURL, type)); 56 return adoptRef(new File(path, uuid, type));
57 }
58 static PassRefPtr<File> create(const String& path, PassRefPtr<BlobDataHandle > blobDataHandle)
59 {
60 return adoptRef(new File(path, blobDataHandle));
57 } 61 }
58 62
59 #if ENABLE(DIRECTORY_UPLOAD) 63 #if ENABLE(DIRECTORY_UPLOAD)
60 static PassRefPtr<File> createWithRelativePath(const String& path, const Str ing& relativePath); 64 static PassRefPtr<File> createWithRelativePath(const String& path, const Str ing& relativePath);
61 #endif 65 #endif
62 66
63 #if ENABLE(FILE_SYSTEM) 67 #if ENABLE(FILE_SYSTEM)
64 // If filesystem files live in the remote filesystem, the port might pass th e valid metadata (whose length field is non-negative) and cache in the File obje ct. 68 // If filesystem files live in the remote filesystem, the port might pass th e valid metadata (whose length field is non-negative) and cache in the File obje ct.
65 // 69 //
66 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous ly query the file metadata. 70 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous ly query the file metadata.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const String& webkitRelativePath() const { return m_relativePath; } 103 const String& webkitRelativePath() const { return m_relativePath; }
100 #endif 104 #endif
101 105
102 // Note that this involves synchronous file operation. Think twice before ca lling this function. 106 // Note that this involves synchronous file operation. Think twice before ca lling this function.
103 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi me) const; 107 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi me) const;
104 108
105 private: 109 private:
106 File(const String& path, ContentTypeLookupPolicy); 110 File(const String& path, ContentTypeLookupPolicy);
107 111
108 // For deserialization. 112 // For deserialization.
109 File(const String& path, const KURL& srcURL, const String& type); 113 File(const String& path, const String& uuid, const String& type);
110 File(const String& path, const String& name, ContentTypeLookupPolicy); 114 File(const String& path, const String& name, ContentTypeLookupPolicy);
115 File(const String& path, PassRefPtr<BlobDataHandle>);
111 116
112 # if ENABLE(FILE_SYSTEM) 117 # if ENABLE(FILE_SYSTEM)
113 File(const String& name, const FileMetadata&); 118 File(const String& name, const FileMetadata&);
114 File(const KURL& fileSystemURL, const FileMetadata&); 119 File(const KURL& fileSystemURL, const FileMetadata&);
115 120
116 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize > = 0). 121 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize > = 0).
117 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } 122 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; }
118 #endif 123 #endif
119 124
120 String m_path; 125 String m_path;
(...skipping 21 matching lines...) Expand all
142 147
143 inline const File* toFile(const Blob* blob) 148 inline const File* toFile(const Blob* blob)
144 { 149 {
145 ASSERT(!blob || blob->isFile()); 150 ASSERT(!blob || blob->isFile());
146 return static_cast<const File*>(blob); 151 return static_cast<const File*>(blob);
147 } 152 }
148 153
149 } // namespace WebCore 154 } // namespace WebCore
150 155
151 #endif // File_h 156 #endif // File_h
OLDNEW
« no previous file with comments | « WebCore/fileapi/BlobURL.cpp ('k') | WebCore/fileapi/File.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698