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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.h

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverting some behavior changes Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); 190 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount);
191 void createImageBuffer(); 191 void createImageBuffer();
192 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e); 192 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e);
193 bool shouldUseDisplayList(const IntSize& deviceSize); 193 bool shouldUseDisplayList(const IntSize& deviceSize);
194 194
195 void setSurfaceSize(const IntSize&); 195 void setSurfaceSize(const IntSize&);
196 196
197 bool paintsIntoCanvasBuffer() const; 197 bool paintsIntoCanvasBuffer() const;
198 198
199 ImageData* toImageData(SourceDrawingBuffer) const; 199 ImageData* toImageData(SourceDrawingBuffer, ExceptionState&) const;
200 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; 200 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer, ExceptionState&) const;
201 201
202 static void encodeImageAsync(DOMUint8ClampedArray* imagedata, IntSize imageS ize, FileCallback*, const String& mimeType, double quality); 202 static void encodeImageAsync(DOMUint8ClampedArray* imagedata, IntSize imageS ize, FileCallback*, const String& mimeType, double quality);
203 static void createBlobAndCall(PassOwnPtr<Vector<char>> encodedImage, const S tring& mimeType, FileCallback*); 203 static void createBlobAndCall(PassOwnPtr<Vector<char>> encodedImage, const S tring& mimeType, FileCallback*);
204 204
205 IntSize m_size; 205 IntSize m_size;
206 206
207 OwnPtrWillBeMember<CanvasRenderingContext> m_context; 207 OwnPtrWillBeMember<CanvasRenderingContext> m_context;
208 208
209 bool m_ignoreReset; 209 bool m_ignoreReset;
210 FloatRect m_dirtyRect; 210 FloatRect m_dirtyRect;
211 211
212 mutable intptr_t m_externallyAllocatedMemory; 212 mutable intptr_t m_externallyAllocatedMemory;
213 213
214 bool m_originClean; 214 bool m_originClean;
215 215
216 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer 216 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer
217 // after the first attempt failed. 217 // after the first attempt failed.
218 mutable bool m_didFailToCreateImageBuffer; 218 mutable bool m_didFailToCreateImageBuffer;
219 bool m_imageBufferIsClear; 219 bool m_imageBufferIsClear;
220 OwnPtr<ImageBuffer> m_imageBuffer; 220 OwnPtr<ImageBuffer> m_imageBuffer;
221 221
222 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 222 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
223 }; 223 };
224 224
225 } // namespace blink 225 } // namespace blink
226 226
227 #endif // HTMLCanvasElement_h 227 #endif // HTMLCanvasElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698