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

Side by Side Diff: Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 235373005: Handle JS-created files in <input type="file">. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed visibility bug. Created 6 years, 5 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 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 if (!readWebCoreString(&type)) 2309 if (!readWebCoreString(&type))
2310 return nullptr; 2310 return nullptr;
2311 if (m_version >= 4 && !doReadUint32(&hasSnapshot)) 2311 if (m_version >= 4 && !doReadUint32(&hasSnapshot))
2312 return nullptr; 2312 return nullptr;
2313 if (hasSnapshot) { 2313 if (hasSnapshot) {
2314 if (!doReadUint64(&size)) 2314 if (!doReadUint64(&size))
2315 return nullptr; 2315 return nullptr;
2316 if (!doReadNumber(&lastModified)) 2316 if (!doReadNumber(&lastModified))
2317 return nullptr; 2317 return nullptr;
2318 } 2318 }
2319 return File::create(path, name, relativePath, hasSnapshot > 0, size, las tModified, getOrCreateBlobDataHandle(uuid, type)); 2319 return File::createFromSerialization(path, name, relativePath, hasSnapsh ot > 0, size, lastModified, getOrCreateBlobDataHandle(uuid, type));
2320 } 2320 }
2321 2321
2322 PassRefPtrWillBeRawPtr<File> readFileIndexHelper() 2322 PassRefPtrWillBeRawPtr<File> readFileIndexHelper()
2323 { 2323 {
2324 if (m_version < 3) 2324 if (m_version < 3)
2325 return nullptr; 2325 return nullptr;
2326 ASSERT(m_blobInfo); 2326 ASSERT(m_blobInfo);
2327 uint32_t index; 2327 uint32_t index;
2328 if (!doReadUint32(&index) || index >= m_blobInfo->size()) 2328 if (!doReadUint32(&index) || index >= m_blobInfo->size())
2329 return nullptr; 2329 return nullptr;
2330 const blink::WebBlobInfo& info = (*m_blobInfo)[index]; 2330 const blink::WebBlobInfo& info = (*m_blobInfo)[index];
2331 return File::create(info.filePath(), info.fileName(), info.size(), info. lastModified(), getOrCreateBlobDataHandle(info.uuid(), info.type(), info.size()) ); 2331 return File::createFromIndexedSerialization(info.filePath(), info.fileNa me(), info.size(), info.lastModified(), getOrCreateBlobDataHandle(info.uuid(), i nfo.type(), info.size()));
2332 } 2332 }
2333 2333
2334 template<class T> 2334 template<class T>
2335 bool doReadUintHelper(T* value) 2335 bool doReadUintHelper(T* value)
2336 { 2336 {
2337 *value = 0; 2337 *value = 0;
2338 uint8_t currentByte; 2338 uint8_t currentByte;
2339 int shift = 0; 2339 int shift = 0;
2340 do { 2340 do {
2341 if (m_position >= m_length) 2341 if (m_position >= m_length)
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 // If the allocated memory was not registered before, then this class is lik ely 3056 // If the allocated memory was not registered before, then this class is lik ely
3057 // used in a context other then Worker's onmessage environment and the prese nce of 3057 // used in a context other then Worker's onmessage environment and the prese nce of
3058 // current v8 context is not guaranteed. Avoid calling v8 then. 3058 // current v8 context is not guaranteed. Avoid calling v8 then.
3059 if (m_externallyAllocatedMemory) { 3059 if (m_externallyAllocatedMemory) {
3060 ASSERT(v8::Isolate::GetCurrent()); 3060 ASSERT(v8::Isolate::GetCurrent());
3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
3062 } 3062 }
3063 } 3063 }
3064 3064
3065 } // namespace blink 3065 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.txt ('k') | Source/core/fileapi/File.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698