OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 properties.setDefaultLastModified(); | 83 properties.setDefaultLastModified(); |
84 } | 84 } |
85 | 85 |
86 OwnPtr<BlobData> blobData = BlobData::create(); | 86 OwnPtr<BlobData> blobData = BlobData::create(); |
87 blobData->setContentType(properties.contentType()); | 87 blobData->setContentType(properties.contentType()); |
88 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); | 88 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); |
89 if (!V8BlobCustomHelpers::processBlobParts(blobParts, length, properties.nor
malizeLineEndingsToNative(), *blobData, info.GetIsolate())) | 89 if (!V8BlobCustomHelpers::processBlobParts(blobParts, length, properties.nor
malizeLineEndingsToNative(), *blobData, info.GetIsolate())) |
90 return; | 90 return; |
91 | 91 |
92 long long fileSize = blobData->length(); | 92 long long fileSize = blobData->length(); |
93 RefPtr<File> file = File::create(fileName, properties.lastModified(), BlobDa
taHandle::create(blobData.release(), fileSize)); | 93 RefPtrWillBeRawPtr<File> file = File::create(fileName, properties.lastModifi
ed(), BlobDataHandle::create(blobData.release(), fileSize)); |
94 v8SetReturnValue(info, file.release()); | 94 v8SetReturnValue(info, file.release()); |
95 } | 95 } |
96 | 96 |
97 void V8File::lastModifiedDateAttributeGetterCustom(const v8::PropertyCallbackInf
o<v8::Value>& info) | 97 void V8File::lastModifiedDateAttributeGetterCustom(const v8::PropertyCallbackInf
o<v8::Value>& info) |
98 { | 98 { |
99 // The auto-generated getters return null when the method in the underlying | 99 // The auto-generated getters return null when the method in the underlying |
100 // implementation returns NaN. The File API says we should return the | 100 // implementation returns NaN. The File API says we should return the |
101 // current time when the last modification time is unknown. | 101 // current time when the last modification time is unknown. |
102 // Section 7.2 of the File API spec. http://dev.w3.org/2006/webapi/FileAPI/ | 102 // Section 7.2 of the File API spec. http://dev.w3.org/2006/webapi/FileAPI/ |
103 | 103 |
(...skipping 13 matching lines...) Expand all Loading... |
117 double lastModified = file->lastModifiedDate(); | 117 double lastModified = file->lastModifiedDate(); |
118 if (!isValidFileTime(lastModified)) | 118 if (!isValidFileTime(lastModified)) |
119 lastModified = currentTimeMS(); | 119 lastModified = currentTimeMS(); |
120 | 120 |
121 // lastModified returns a number, not a Date instance. | 121 // lastModified returns a number, not a Date instance. |
122 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs | 122 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs |
123 v8SetReturnValue(info, floor(lastModified)); | 123 v8SetReturnValue(info, floor(lastModified)); |
124 } | 124 } |
125 | 125 |
126 } // namespace WebCore | 126 } // namespace WebCore |
OLD | NEW |