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

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

Issue 2057283002: Fix canvas-related crash caused by bad object teardown sequence (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test crash Created 4 years, 6 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 | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('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) 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 class ImageBufferSurface; 63 class ImageBufferSurface;
64 class ImageData; 64 class ImageData;
65 class IntSize; 65 class IntSize;
66 66
67 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI mageBitmapRenderingContext; 67 class CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrI mageBitmapRenderingContext;
68 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO rImageBitmapRenderingContext RenderingContext; 68 typedef CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextO rImageBitmapRenderingContext RenderingContext;
69 69
70 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi fecycleObserver, public PageLifecycleObserver, public CanvasImageSource, public ImageBufferClient, public ImageBitmapSource { 70 class CORE_EXPORT HTMLCanvasElement final : public HTMLElement, public ContextLi fecycleObserver, public PageLifecycleObserver, public CanvasImageSource, public ImageBufferClient, public ImageBitmapSource {
71 DEFINE_WRAPPERTYPEINFO(); 71 DEFINE_WRAPPERTYPEINFO();
72 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement); 72 USING_GARBAGE_COLLECTED_MIXIN(HTMLCanvasElement);
73 USING_PRE_FINALIZER(HTMLCanvasElement, dispose);
73 public: 74 public:
74 using Node::getExecutionContext; 75 using Node::getExecutionContext;
75 76
76 DECLARE_NODE_FACTORY(HTMLCanvasElement); 77 DECLARE_NODE_FACTORY(HTMLCanvasElement);
77 ~HTMLCanvasElement() override; 78 ~HTMLCanvasElement() override;
78 79
79 // Attributes and functions exposed to script 80 // Attributes and functions exposed to script
80 int width() const { return size().width(); } 81 int width() const { return size().width(); }
81 int height() const { return size().height(); } 82 int height() const { return size().height(); }
82 83
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 // For Canvas HitRegions 197 // For Canvas HitRegions
197 bool isSupportedInteractiveCanvasFallback(const Element&); 198 bool isSupportedInteractiveCanvasFallback(const Element&);
198 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi nt&); 199 std::pair<Element*, String> getControlAndIdIfHitRegionExists(const LayoutPoi nt&);
199 String getIdFromControl(const Element*); 200 String getIdFromControl(const Element*);
200 201
201 // For OffscreenCanvas that controls this html canvas element 202 // For OffscreenCanvas that controls this html canvas element
202 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { return m_surfaceLayer Bridge.get(); } 203 CanvasSurfaceLayerBridge* surfaceLayerBridge() const { return m_surfaceLayer Bridge.get(); }
203 void createSurfaceLayerBridge(); 204 void createSurfaceLayerBridge();
204 205
206 void detachContext() { m_context = nullptr; }
207
205 protected: 208 protected:
206 void didMoveToNewDocument(Document& oldDocument) override; 209 void didMoveToNewDocument(Document& oldDocument) override;
207 210
208 private: 211 private:
209 explicit HTMLCanvasElement(Document&); 212 explicit HTMLCanvasElement(Document&);
213 void dispose();
210 214
211 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 215 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>;
212 static ContextFactoryVector& renderingContextFactories(); 216 static ContextFactoryVector& renderingContextFactories();
213 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 217 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
214 218
215 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override; 219 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override;
216 LayoutObject* createLayoutObject(const ComputedStyle&) override; 220 LayoutObject* createLayoutObject(const ComputedStyle&) override;
217 bool areAuthorShadowsAllowed() const override { return false; } 221 bool areAuthorShadowsAllowed() const override { return false; }
218 222
219 void reset(); 223 void reset();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 256
253 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 257 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
254 258
255 // Used for OffscreenCanvas that controls this HTML canvas element 259 // Used for OffscreenCanvas that controls this HTML canvas element
256 OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; 260 OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge;
257 }; 261 };
258 262
259 } // namespace blink 263 } // namespace blink
260 264
261 #endif // HTMLCanvasElement_h 265 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698