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 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 return false; | 1848 return false; |
1848 String uuid; | 1849 String uuid; |
1849 String type; | 1850 String type; |
1850 uint64_t size; | 1851 uint64_t size; |
1851 if (!readWebCoreString(&uuid)) | 1852 if (!readWebCoreString(&uuid)) |
1852 return false; | 1853 return false; |
1853 if (!readWebCoreString(&type)) | 1854 if (!readWebCoreString(&type)) |
1854 return false; | 1855 return false; |
1855 if (!doReadUint64(&size)) | 1856 if (!doReadUint64(&size)) |
1856 return false; | 1857 return false; |
1857 RefPtr<Blob> blob = Blob::create(getOrCreateBlobDataHandle(uuid, type, s
ize)); | 1858 RefPtrWillBeRawPtr<Blob> blob = Blob::create(getOrCreateBlobDataHandle(u
uid, type, size)); |
1858 *value = toV8(blob.release(), v8::Handle<v8::Object>(), m_isolate); | 1859 *value = toV8(blob.release(), v8::Handle<v8::Object>(), m_isolate); |
1859 return true; | 1860 return true; |
1860 } | 1861 } |
1861 | 1862 |
1862 bool readDOMFileSystem(v8::Handle<v8::Value>* value) | 1863 bool readDOMFileSystem(v8::Handle<v8::Value>* value) |
1863 { | 1864 { |
1864 uint32_t type; | 1865 uint32_t type; |
1865 String name; | 1866 String name; |
1866 String url; | 1867 String url; |
1867 if (!doReadUint32(&type)) | 1868 if (!doReadUint32(&type)) |
1868 return false; | 1869 return false; |
1869 if (!readWebCoreString(&name)) | 1870 if (!readWebCoreString(&name)) |
1870 return false; | 1871 return false; |
1871 if (!readWebCoreString(&url)) | 1872 if (!readWebCoreString(&url)) |
1872 return false; | 1873 return false; |
1873 RefPtr<DOMFileSystem> fs = DOMFileSystem::create(currentExecutionContext
(m_isolate), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLStr
ing, url)); | 1874 RefPtr<DOMFileSystem> fs = DOMFileSystem::create(currentExecutionContext
(m_isolate), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLStr
ing, url)); |
1874 *value = toV8(fs.release(), v8::Handle<v8::Object>(), m_isolate); | 1875 *value = toV8(fs.release(), v8::Handle<v8::Object>(), m_isolate); |
1875 return true; | 1876 return true; |
1876 } | 1877 } |
1877 | 1878 |
1878 bool readFile(v8::Handle<v8::Value>* value) | 1879 bool readFile(v8::Handle<v8::Value>* value) |
1879 { | 1880 { |
1880 RefPtr<File> file = doReadFileHelper(); | 1881 RefPtrWillBeRawPtr<File> file = doReadFileHelper(); |
1881 if (!file) | 1882 if (!file) |
1882 return false; | 1883 return false; |
1883 *value = toV8(file.release(), v8::Handle<v8::Object>(), m_isolate); | 1884 *value = toV8(file.release(), v8::Handle<v8::Object>(), m_isolate); |
1884 return true; | 1885 return true; |
1885 } | 1886 } |
1886 | 1887 |
1887 bool readFileList(v8::Handle<v8::Value>* value) | 1888 bool readFileList(v8::Handle<v8::Value>* value) |
1888 { | 1889 { |
1889 if (m_version < 3) | 1890 if (m_version < 3) |
1890 return false; | 1891 return false; |
1891 uint32_t length; | 1892 uint32_t length; |
1892 if (!doReadUint32(&length)) | 1893 if (!doReadUint32(&length)) |
1893 return false; | 1894 return false; |
1894 RefPtr<FileList> fileList = FileList::create(); | 1895 RefPtrWillBeRawPtr<FileList> fileList = FileList::create(); |
1895 for (unsigned i = 0; i < length; ++i) { | 1896 for (unsigned i = 0; i < length; ++i) { |
1896 RefPtr<File> file = doReadFileHelper(); | 1897 RefPtrWillBeRawPtr<File> file = doReadFileHelper(); |
1897 if (!file) | 1898 if (!file) |
1898 return false; | 1899 return false; |
1899 fileList->append(file.release()); | 1900 fileList->append(file.release()); |
1900 } | 1901 } |
1901 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate); | 1902 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate); |
1902 return true; | 1903 return true; |
1903 } | 1904 } |
1904 | 1905 |
1905 PassRefPtr<File> doReadFileHelper() | 1906 PassRefPtrWillBeRawPtr<File> doReadFileHelper() |
1906 { | 1907 { |
1907 if (m_version < 3) | 1908 if (m_version < 3) |
1908 return nullptr; | 1909 return nullptr; |
1909 String path; | 1910 String path; |
1910 String name; | 1911 String name; |
1911 String relativePath; | 1912 String relativePath; |
1912 String uuid; | 1913 String uuid; |
1913 String type; | 1914 String type; |
1914 uint32_t hasSnapshot = 0; | 1915 uint32_t hasSnapshot = 0; |
1915 uint64_t size = 0; | 1916 uint64_t size = 0; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 // If the allocated memory was not registered before, then this class is lik
ely | 2444 // If the allocated memory was not registered before, then this class is lik
ely |
2444 // used in a context other then Worker's onmessage environment and the prese
nce of | 2445 // used in a context other then Worker's onmessage environment and the prese
nce of |
2445 // current v8 context is not guaranteed. Avoid calling v8 then. | 2446 // current v8 context is not guaranteed. Avoid calling v8 then. |
2446 if (m_externallyAllocatedMemory) { | 2447 if (m_externallyAllocatedMemory) { |
2447 ASSERT(v8::Isolate::GetCurrent()); | 2448 ASSERT(v8::Isolate::GetCurrent()); |
2448 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 2449 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
2449 } | 2450 } |
2450 } | 2451 } |
2451 | 2452 |
2452 } // namespace WebCore | 2453 } // namespace WebCore |
OLD | NEW |