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

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

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 1 month 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #if ENABLE(DIRECTORY_UPLOAD) 88 #if ENABLE(DIRECTORY_UPLOAD)
89 PassRefPtr<File> File::createWithRelativePath(const String& path, const String& relativePath) 89 PassRefPtr<File> File::createWithRelativePath(const String& path, const String& relativePath)
90 { 90 {
91 RefPtr<File> file = adoptRef(new File(path, AllContentTypes)); 91 RefPtr<File> file = adoptRef(new File(path, AllContentTypes));
92 file->m_relativePath = relativePath; 92 file->m_relativePath = relativePath;
93 return file.release(); 93 return file.release();
94 } 94 }
95 #endif 95 #endif
96 96
97 File::File(const String& path, ContentTypeLookupPolicy policy) 97 File::File(const String& path, ContentTypeLookupPolicy policy)
98 : Blob(createBlobDataForFile(path, policy), -1) 98 : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1))
99 , m_path(path) 99 , m_path(path)
100 , m_name(pathGetFileName(path)) 100 , m_name(pathGetFileName(path))
101 #if ENABLE(FILE_SYSTEM) 101 #if ENABLE(FILE_SYSTEM)
102 , m_snapshotSize(-1) 102 , m_snapshotSize(-1)
103 , m_snapshotModificationTime(invalidFileTime()) 103 , m_snapshotModificationTime(invalidFileTime())
104 #endif 104 #endif
105 { 105 {
106 } 106 }
107 107
108 File::File(const String& path, const KURL& url, const String& type) 108 File::File(const String& path, const String& uuid, const String& type)
109 : Blob(url, type, -1) 109 : Blob(BlobDataHandle::create(uuid, type, -1))
110 , m_path(path) 110 , m_path(path)
111 #if ENABLE(FILE_SYSTEM) 111 #if ENABLE(FILE_SYSTEM)
112 , m_snapshotSize(-1) 112 , m_snapshotSize(-1)
113 , m_snapshotModificationTime(invalidFileTime()) 113 , m_snapshotModificationTime(invalidFileTime())
114 #endif 114 #endif
115 { 115 {
116 m_name = pathGetFileName(path); 116 m_name = pathGetFileName(path);
117 // FIXME: File object serialization/deserialization does not include 117 // FIXME: File object serialization/deserialization does not include
118 // newer file object data members: m_name and m_relativePath. 118 // newer file object data members: m_name and m_relativePath.
119 // See SerializedScriptValue.cpp for js and v8. 119 // See SerializedScriptValue.cpp for js and v8.
120 } 120 }
121 121
122 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic y) 122 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic y)
123 : Blob(createBlobDataForFileWithName(path, name, policy), -1) 123 : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, poli cy), -1))
124 , m_path(path) 124 , m_path(path)
125 , m_name(name) 125 , m_name(name)
126 #if ENABLE(FILE_SYSTEM) 126 #if ENABLE(FILE_SYSTEM)
127 , m_snapshotSize(-1) 127 , m_snapshotSize(-1)
128 , m_snapshotModificationTime(invalidFileTime()) 128 , m_snapshotModificationTime(invalidFileTime())
129 #endif 129 #endif
130 { 130 {
131 } 131 }
132 132
133 #if ENABLE(FILE_SYSTEM) 133 #if ENABLE(FILE_SYSTEM)
134 File::File(const String& name, const FileMetadata& metadata) 134 File::File(const String& name, const FileMetadata& metadata)
135 : Blob(createBlobDataForFileWithMetadata(name, metadata), metadata.length) 135 : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metada ta), metadata.length))
136 , m_path(metadata.platformPath) 136 , m_path(metadata.platformPath)
137 , m_name(name) 137 , m_name(name)
138 , m_snapshotSize(metadata.length) 138 , m_snapshotSize(metadata.length)
139 , m_snapshotModificationTime(metadata.modificationTime) 139 , m_snapshotModificationTime(metadata.modificationTime)
140 { 140 {
141 } 141 }
142 142
143 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) 143 File::File(const KURL& fileSystemURL, const FileMetadata& metadata)
144 : Blob(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.len gth) 144 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length))
145 , m_fileSystemURL(fileSystemURL) 145 , m_fileSystemURL(fileSystemURL)
146 , m_snapshotSize(metadata.length) 146 , m_snapshotSize(metadata.length)
147 , m_snapshotModificationTime(metadata.modificationTime) 147 , m_snapshotModificationTime(metadata.modificationTime)
148 { 148 {
149 } 149 }
150 #endif 150 #endif
151 151
152 double File::lastModifiedDate() const 152 double File::lastModifiedDate() const
153 { 153 {
154 #if ENABLE(FILE_SYSTEM) 154 #if ENABLE(FILE_SYSTEM)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 snapshotSize = 0; 196 snapshotSize = 0;
197 snapshotModificationTime = invalidFileTime(); 197 snapshotModificationTime = invalidFileTime();
198 return; 198 return;
199 } 199 }
200 200
201 snapshotSize = metadata.length; 201 snapshotSize = metadata.length;
202 snapshotModificationTime = metadata.modificationTime; 202 snapshotModificationTime = metadata.modificationTime;
203 } 203 }
204 204
205 } // namespace WebCore 205 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698