| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "bindings/v8/custom/V8Uint32ArrayCustom.h" | 55 #include "bindings/v8/custom/V8Uint32ArrayCustom.h" |
| 56 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" | 56 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" |
| 57 #include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" | 57 #include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" |
| 58 #include "core/dom/ExceptionCode.h" | 58 #include "core/dom/ExceptionCode.h" |
| 59 #include "core/dom/MessagePort.h" | 59 #include "core/dom/MessagePort.h" |
| 60 #include "core/fileapi/Blob.h" | 60 #include "core/fileapi/Blob.h" |
| 61 #include "core/fileapi/File.h" | 61 #include "core/fileapi/File.h" |
| 62 #include "core/fileapi/FileList.h" | 62 #include "core/fileapi/FileList.h" |
| 63 #include "core/html/ImageData.h" | 63 #include "core/html/ImageData.h" |
| 64 #include "core/html/canvas/DataView.h" | 64 #include "core/html/canvas/DataView.h" |
| 65 #include "heap/Handle.h" |
| 65 #include "platform/SharedBuffer.h" | 66 #include "platform/SharedBuffer.h" |
| 66 #include "wtf/ArrayBuffer.h" | 67 #include "wtf/ArrayBuffer.h" |
| 67 #include "wtf/ArrayBufferContents.h" | 68 #include "wtf/ArrayBufferContents.h" |
| 68 #include "wtf/ArrayBufferView.h" | 69 #include "wtf/ArrayBufferView.h" |
| 69 #include "wtf/Assertions.h" | 70 #include "wtf/Assertions.h" |
| 70 #include "wtf/ByteOrder.h" | 71 #include "wtf/ByteOrder.h" |
| 71 #include "wtf/Float32Array.h" | 72 #include "wtf/Float32Array.h" |
| 72 #include "wtf/Float64Array.h" | 73 #include "wtf/Float64Array.h" |
| 73 #include "wtf/Int16Array.h" | 74 #include "wtf/Int16Array.h" |
| 74 #include "wtf/Int32Array.h" | 75 #include "wtf/Int32Array.h" |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 return false; | 1849 return false; |
| 1849 String uuid; | 1850 String uuid; |
| 1850 String type; | 1851 String type; |
| 1851 uint64_t size; | 1852 uint64_t size; |
| 1852 if (!readWebCoreString(&uuid)) | 1853 if (!readWebCoreString(&uuid)) |
| 1853 return false; | 1854 return false; |
| 1854 if (!readWebCoreString(&type)) | 1855 if (!readWebCoreString(&type)) |
| 1855 return false; | 1856 return false; |
| 1856 if (!doReadUint64(&size)) | 1857 if (!doReadUint64(&size)) |
| 1857 return false; | 1858 return false; |
| 1858 RefPtr<Blob> blob = Blob::create(getOrCreateBlobDataHandle(uuid, type, s
ize)); | 1859 RefPtrWillBeRawPtr<Blob> blob = Blob::create(getOrCreateBlobDataHandle(u
uid, type, size)); |
| 1859 *value = toV8(blob.release(), v8::Handle<v8::Object>(), m_isolate); | 1860 *value = toV8(blob.release(), v8::Handle<v8::Object>(), m_isolate); |
| 1860 return true; | 1861 return true; |
| 1861 } | 1862 } |
| 1862 | 1863 |
| 1863 bool readDOMFileSystem(v8::Handle<v8::Value>* value) | 1864 bool readDOMFileSystem(v8::Handle<v8::Value>* value) |
| 1864 { | 1865 { |
| 1865 uint32_t type; | 1866 uint32_t type; |
| 1866 String name; | 1867 String name; |
| 1867 String url; | 1868 String url; |
| 1868 if (!doReadUint32(&type)) | 1869 if (!doReadUint32(&type)) |
| 1869 return false; | 1870 return false; |
| 1870 if (!readWebCoreString(&name)) | 1871 if (!readWebCoreString(&name)) |
| 1871 return false; | 1872 return false; |
| 1872 if (!readWebCoreString(&url)) | 1873 if (!readWebCoreString(&url)) |
| 1873 return false; | 1874 return false; |
| 1874 RefPtr<DOMFileSystem> fs = DOMFileSystem::create(currentExecutionContext
(m_isolate), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLStr
ing, url)); | 1875 RefPtr<DOMFileSystem> fs = DOMFileSystem::create(currentExecutionContext
(m_isolate), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLStr
ing, url)); |
| 1875 *value = toV8(fs.release(), v8::Handle<v8::Object>(), m_isolate); | 1876 *value = toV8(fs.release(), v8::Handle<v8::Object>(), m_isolate); |
| 1876 return true; | 1877 return true; |
| 1877 } | 1878 } |
| 1878 | 1879 |
| 1879 bool readFile(v8::Handle<v8::Value>* value) | 1880 bool readFile(v8::Handle<v8::Value>* value) |
| 1880 { | 1881 { |
| 1881 RefPtr<File> file = doReadFileHelper(); | 1882 RefPtrWillBeRawPtr<File> file = doReadFileHelper(); |
| 1882 if (!file) | 1883 if (!file) |
| 1883 return false; | 1884 return false; |
| 1884 *value = toV8(file.release(), v8::Handle<v8::Object>(), m_isolate); | 1885 *value = toV8(file.release(), v8::Handle<v8::Object>(), m_isolate); |
| 1885 return true; | 1886 return true; |
| 1886 } | 1887 } |
| 1887 | 1888 |
| 1888 bool readFileList(v8::Handle<v8::Value>* value) | 1889 bool readFileList(v8::Handle<v8::Value>* value) |
| 1889 { | 1890 { |
| 1890 if (m_version < 3) | 1891 if (m_version < 3) |
| 1891 return false; | 1892 return false; |
| 1892 uint32_t length; | 1893 uint32_t length; |
| 1893 if (!doReadUint32(&length)) | 1894 if (!doReadUint32(&length)) |
| 1894 return false; | 1895 return false; |
| 1895 RefPtr<FileList> fileList = FileList::create(); | 1896 RefPtrWillBeRawPtr<FileList> fileList = FileList::create(); |
| 1896 for (unsigned i = 0; i < length; ++i) { | 1897 for (unsigned i = 0; i < length; ++i) { |
| 1897 RefPtr<File> file = doReadFileHelper(); | 1898 RefPtrWillBeRawPtr<File> file = doReadFileHelper(); |
| 1898 if (!file) | 1899 if (!file) |
| 1899 return false; | 1900 return false; |
| 1900 fileList->append(file.release()); | 1901 fileList->append(file.release()); |
| 1901 } | 1902 } |
| 1902 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate); | 1903 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate); |
| 1903 return true; | 1904 return true; |
| 1904 } | 1905 } |
| 1905 | 1906 |
| 1906 PassRefPtr<File> doReadFileHelper() | 1907 PassRefPtrWillBeRawPtr<File> doReadFileHelper() |
| 1907 { | 1908 { |
| 1908 if (m_version < 3) | 1909 if (m_version < 3) |
| 1909 return nullptr; | 1910 return nullptr; |
| 1910 String path; | 1911 String path; |
| 1911 String name; | 1912 String name; |
| 1912 String relativePath; | 1913 String relativePath; |
| 1913 String uuid; | 1914 String uuid; |
| 1914 String type; | 1915 String type; |
| 1915 uint32_t hasSnapshot = 0; | 1916 uint32_t hasSnapshot = 0; |
| 1916 uint64_t size = 0; | 1917 uint64_t size = 0; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 // If the allocated memory was not registered before, then this class is lik
ely | 2454 // If the allocated memory was not registered before, then this class is lik
ely |
| 2454 // used in a context other then Worker's onmessage environment and the prese
nce of | 2455 // used in a context other then Worker's onmessage environment and the prese
nce of |
| 2455 // current v8 context is not guaranteed. Avoid calling v8 then. | 2456 // current v8 context is not guaranteed. Avoid calling v8 then. |
| 2456 if (m_externallyAllocatedMemory) { | 2457 if (m_externallyAllocatedMemory) { |
| 2457 ASSERT(v8::Isolate::GetCurrent()); | 2458 ASSERT(v8::Isolate::GetCurrent()); |
| 2458 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 2459 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
| 2459 } | 2460 } |
| 2460 } | 2461 } |
| 2461 | 2462 |
| 2462 } // namespace WebCore | 2463 } // namespace WebCore |
| OLD | NEW |