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

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

Issue 214153006: Oilpan: move ImageData to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add ImageData 'explicit' Created 6 years, 8 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
« no previous file with comments | « no previous file | Source/core/html/HTMLCanvasElement.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 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 uint32_t height; 1928 uint32_t height;
1929 uint32_t pixelDataLength; 1929 uint32_t pixelDataLength;
1930 if (!doReadUint32(&width)) 1930 if (!doReadUint32(&width))
1931 return false; 1931 return false;
1932 if (!doReadUint32(&height)) 1932 if (!doReadUint32(&height))
1933 return false; 1933 return false;
1934 if (!doReadUint32(&pixelDataLength)) 1934 if (!doReadUint32(&pixelDataLength))
1935 return false; 1935 return false;
1936 if (m_position + pixelDataLength > m_length) 1936 if (m_position + pixelDataLength > m_length)
1937 return false; 1937 return false;
1938 RefPtr<ImageData> imageData = ImageData::create(IntSize(width, height)); 1938 RefPtrWillBeRawPtr<ImageData> imageData = ImageData::create(IntSize(widt h, height));
1939 Uint8ClampedArray* pixelArray = imageData->data(); 1939 Uint8ClampedArray* pixelArray = imageData->data();
1940 ASSERT(pixelArray); 1940 ASSERT(pixelArray);
1941 ASSERT(pixelArray->length() >= pixelDataLength); 1941 ASSERT(pixelArray->length() >= pixelDataLength);
1942 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength); 1942 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength);
1943 m_position += pixelDataLength; 1943 m_position += pixelDataLength;
1944 *value = toV8(imageData.release(), v8::Handle<v8::Object>(), m_isolate); 1944 *value = toV8(imageData.release(), v8::Handle<v8::Object>(), m_isolate);
1945 return true; 1945 return true;
1946 } 1946 }
1947 1947
1948 PassRefPtr<ArrayBuffer> doReadArrayBuffer() 1948 PassRefPtr<ArrayBuffer> doReadArrayBuffer()
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 // If the allocated memory was not registered before, then this class is lik ely 2939 // If the allocated memory was not registered before, then this class is lik ely
2940 // used in a context other then Worker's onmessage environment and the prese nce of 2940 // used in a context other then Worker's onmessage environment and the prese nce of
2941 // current v8 context is not guaranteed. Avoid calling v8 then. 2941 // current v8 context is not guaranteed. Avoid calling v8 then.
2942 if (m_externallyAllocatedMemory) { 2942 if (m_externallyAllocatedMemory) {
2943 ASSERT(v8::Isolate::GetCurrent()); 2943 ASSERT(v8::Isolate::GetCurrent());
2944 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 2944 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
2945 } 2945 }
2946 } 2946 }
2947 2947
2948 } // namespace WebCore 2948 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698