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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptValue.cpp ('k') | Source/bindings/v8/V8EventListenerList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength); 1723 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength);
1724 m_position += pixelDataLength; 1724 m_position += pixelDataLength;
1725 *value = toV8(imageData.release(), v8::Handle<v8::Object>(), m_isolate); 1725 *value = toV8(imageData.release(), v8::Handle<v8::Object>(), m_isolate);
1726 return true; 1726 return true;
1727 } 1727 }
1728 1728
1729 PassRefPtr<ArrayBuffer> doReadArrayBuffer() 1729 PassRefPtr<ArrayBuffer> doReadArrayBuffer()
1730 { 1730 {
1731 uint32_t byteLength; 1731 uint32_t byteLength;
1732 if (!doReadUint32(&byteLength)) 1732 if (!doReadUint32(&byteLength))
1733 return 0; 1733 return nullptr;
1734 if (m_position + byteLength > m_length) 1734 if (m_position + byteLength > m_length)
1735 return 0; 1735 return nullptr;
1736 const void* bufferStart = m_buffer + m_position; 1736 const void* bufferStart = m_buffer + m_position;
1737 RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(bufferStart, byteL ength); 1737 RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(bufferStart, byteL ength);
1738 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver:: instanceTemplate()); 1738 arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver:: instanceTemplate());
1739 m_position += byteLength; 1739 m_position += byteLength;
1740 return arrayBuffer.release(); 1740 return arrayBuffer.release();
1741 } 1741 }
1742 1742
1743 bool readArrayBuffer(v8::Handle<v8::Value>* value) 1743 bool readArrayBuffer(v8::Handle<v8::Value>* value)
1744 { 1744 {
1745 RefPtr<ArrayBuffer> arrayBuffer = doReadArrayBuffer(); 1745 RefPtr<ArrayBuffer> arrayBuffer = doReadArrayBuffer();
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 return false; 1902 return false;
1903 fileList->append(file.release()); 1903 fileList->append(file.release());
1904 } 1904 }
1905 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate); 1905 *value = toV8(fileList.release(), v8::Handle<v8::Object>(), m_isolate);
1906 return true; 1906 return true;
1907 } 1907 }
1908 1908
1909 PassRefPtr<File> doReadFileHelper() 1909 PassRefPtr<File> doReadFileHelper()
1910 { 1910 {
1911 if (m_version < 3) 1911 if (m_version < 3)
1912 return 0; 1912 return nullptr;
1913 String path; 1913 String path;
1914 String name; 1914 String name;
1915 String relativePath; 1915 String relativePath;
1916 String uuid; 1916 String uuid;
1917 String type; 1917 String type;
1918 uint32_t hasSnapshot = 0; 1918 uint32_t hasSnapshot = 0;
1919 uint64_t size = 0; 1919 uint64_t size = 0;
1920 double lastModified = 0; 1920 double lastModified = 0;
1921 if (!readWebCoreString(&path)) 1921 if (!readWebCoreString(&path))
1922 return 0; 1922 return nullptr;
1923 if (m_version >= 4 && !readWebCoreString(&name)) 1923 if (m_version >= 4 && !readWebCoreString(&name))
1924 return 0; 1924 return nullptr;
1925 if (m_version >= 4 && !readWebCoreString(&relativePath)) 1925 if (m_version >= 4 && !readWebCoreString(&relativePath))
1926 return 0; 1926 return nullptr;
1927 if (!readWebCoreString(&uuid)) 1927 if (!readWebCoreString(&uuid))
1928 return 0; 1928 return nullptr;
1929 if (!readWebCoreString(&type)) 1929 if (!readWebCoreString(&type))
1930 return 0; 1930 return nullptr;
1931 if (m_version >= 4 && !doReadUint32(&hasSnapshot)) 1931 if (m_version >= 4 && !doReadUint32(&hasSnapshot))
1932 return 0; 1932 return nullptr;
1933 if (hasSnapshot) { 1933 if (hasSnapshot) {
1934 if (!doReadUint64(&size)) 1934 if (!doReadUint64(&size))
1935 return 0; 1935 return nullptr;
1936 if (!doReadNumber(&lastModified)) 1936 if (!doReadNumber(&lastModified))
1937 return 0; 1937 return nullptr;
1938 } 1938 }
1939 return File::create(path, name, relativePath, hasSnapshot > 0, size, las tModified, getOrCreateBlobDataHandle(uuid, type)); 1939 return File::create(path, name, relativePath, hasSnapshot > 0, size, las tModified, getOrCreateBlobDataHandle(uuid, type));
1940 } 1940 }
1941 1941
1942 template<class T> 1942 template<class T>
1943 bool doReadUintHelper(T* value) 1943 bool doReadUintHelper(T* value)
1944 { 1944 {
1945 *value = 0; 1945 *value = 0;
1946 uint8_t currentByte; 1946 uint8_t currentByte;
1947 int shift = 0; 1947 int shift = 0;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 // If the allocated memory was not registered before, then this class is lik ely 2452 // 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 2453 // 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. 2454 // current v8 context is not guaranteed. Avoid calling v8 then.
2455 if (m_externallyAllocatedMemory) { 2455 if (m_externallyAllocatedMemory) {
2456 ASSERT(v8::Isolate::GetCurrent()); 2456 ASSERT(v8::Isolate::GetCurrent());
2457 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 2457 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
2458 } 2458 }
2459 } 2459 }
2460 2460
2461 } // namespace WebCore 2461 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptValue.cpp ('k') | Source/bindings/v8/V8EventListenerList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698