OLD | NEW |
---|---|
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // ImageBitmapSource implementation | 162 // ImageBitmapSource implementation |
163 IntSize bitmapSourceSize() const override; | 163 IntSize bitmapSourceSize() const override; |
164 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, ExceptionState&) override; | 164 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, ExceptionState&) override; |
165 | 165 |
166 DECLARE_VIRTUAL_TRACE(); | 166 DECLARE_VIRTUAL_TRACE(); |
167 | 167 |
168 void createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface>) ; | 168 void createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface>) ; |
169 | 169 |
170 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); | 170 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); |
171 void updateExternallyAllocatedMemory() const; | 171 void updateExternallyAllocatedMemory() const; |
172 static void updateTotalMemoryForAcceleratedCanvases(intptr_t diffFromCurrAll ocatedMemory); | |
172 | 173 |
173 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle); | 174 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle); |
174 | 175 |
175 protected: | 176 protected: |
176 void didMoveToNewDocument(Document& oldDocument) override; | 177 void didMoveToNewDocument(Document& oldDocument) override; |
177 | 178 |
178 private: | 179 private: |
179 explicit HTMLCanvasElement(Document&); | 180 explicit HTMLCanvasElement(Document&); |
180 | 181 |
181 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; | 182 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; |
(...skipping 20 matching lines...) Expand all Loading... | |
202 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; | 203 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; |
203 | 204 |
204 IntSize m_size; | 205 IntSize m_size; |
205 | 206 |
206 OwnPtrWillBeMember<CanvasRenderingContext> m_context; | 207 OwnPtrWillBeMember<CanvasRenderingContext> m_context; |
207 | 208 |
208 bool m_ignoreReset; | 209 bool m_ignoreReset; |
209 FloatRect m_dirtyRect; | 210 FloatRect m_dirtyRect; |
210 | 211 |
211 mutable intptr_t m_externallyAllocatedMemory; | 212 mutable intptr_t m_externallyAllocatedMemory; |
212 | 213 static intptr_t s_totalMemoryForAcceleratedCanvases; |
danakj
2015/11/30 23:07:03
I would maybe suggest tying this to a single blink
xlai (Olivia)
2015/12/01 21:50:25
I did some experiments and confirmed that this var
danakj
2015/12/01 22:13:35
Chrome will put tabs in different processes in dif
| |
214 | |
213 bool m_originClean; | 215 bool m_originClean; |
214 | 216 |
215 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer | 217 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer |
216 // after the first attempt failed. | 218 // after the first attempt failed. |
217 mutable bool m_didFailToCreateImageBuffer; | 219 mutable bool m_didFailToCreateImageBuffer; |
218 bool m_imageBufferIsClear; | 220 bool m_imageBufferIsClear; |
219 OwnPtr<ImageBuffer> m_imageBuffer; | 221 OwnPtr<ImageBuffer> m_imageBuffer; |
220 | 222 |
221 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 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 }; | 224 }; |
223 | 225 |
224 } // namespace blink | 226 } // namespace blink |
225 | 227 |
226 #endif // HTMLCanvasElement_h | 228 #endif // HTMLCanvasElement_h |
OLD | NEW |