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