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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge. 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
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 28 matching lines...) Expand all
39 #include "core/html/canvas/CanvasImageSource.h" 39 #include "core/html/canvas/CanvasImageSource.h"
40 #include "core/imagebitmap/ImageBitmapSource.h" 40 #include "core/imagebitmap/ImageBitmapSource.h"
41 #include "core/page/PageLifecycleObserver.h" 41 #include "core/page/PageLifecycleObserver.h"
42 #include "platform/geometry/FloatRect.h" 42 #include "platform/geometry/FloatRect.h"
43 #include "platform/geometry/IntSize.h" 43 #include "platform/geometry/IntSize.h"
44 #include "platform/graphics/CanvasSurfaceLayerBridge.h" 44 #include "platform/graphics/CanvasSurfaceLayerBridge.h"
45 #include "platform/graphics/GraphicsTypes.h" 45 #include "platform/graphics/GraphicsTypes.h"
46 #include "platform/graphics/GraphicsTypes3D.h" 46 #include "platform/graphics/GraphicsTypes3D.h"
47 #include "platform/graphics/ImageBufferClient.h" 47 #include "platform/graphics/ImageBufferClient.h"
48 #include "platform/heap/Handle.h" 48 #include "platform/heap/Handle.h"
49 #include <memory>
49 50
50 #define CanvasDefaultInterpolationQuality InterpolationLow 51 #define CanvasDefaultInterpolationQuality InterpolationLow
51 52
52 namespace blink { 53 namespace blink {
53 54
54 class AffineTransform; 55 class AffineTransform;
55 class CanvasContextCreationAttributes; 56 class CanvasContextCreationAttributes;
56 class CanvasRenderingContext; 57 class CanvasRenderingContext;
57 class CanvasRenderingContextFactory; 58 class CanvasRenderingContextFactory;
58 class GraphicsContext; 59 class GraphicsContext;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void doDeferredPaintInvalidation(); 178 void doDeferredPaintInvalidation();
178 179
179 // ImageBitmapSource implementation 180 // ImageBitmapSource implementation
180 IntSize bitmapSourceSize() const override; 181 IntSize bitmapSourceSize() const override;
181 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; 182 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override;
182 183
183 DECLARE_VIRTUAL_TRACE(); 184 DECLARE_VIRTUAL_TRACE();
184 185
185 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 186 DECLARE_VIRTUAL_TRACE_WRAPPERS();
186 187
187 void createImageBufferUsingSurfaceForTesting(PassOwnPtr<ImageBufferSurface>) ; 188 void createImageBufferUsingSurfaceForTesting(std::unique_ptr<ImageBufferSurf ace>);
188 189
189 static void registerRenderingContextFactory(PassOwnPtr<CanvasRenderingContex tFactory>); 190 static void registerRenderingContextFactory(std::unique_ptr<CanvasRenderingC ontextFactory>);
190 void updateExternallyAllocatedMemory() const; 191 void updateExternallyAllocatedMemory() const;
191 192
192 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle); 193 void styleDidChange(const ComputedStyle* oldStyle, const ComputedStyle& newS tyle);
193 194
194 void notifyListenersCanvasChanged(); 195 void notifyListenersCanvasChanged();
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
205 protected: 206 protected:
206 void didMoveToNewDocument(Document& oldDocument) override; 207 void didMoveToNewDocument(Document& oldDocument) override;
207 208
208 private: 209 private:
209 explicit HTMLCanvasElement(Document&); 210 explicit HTMLCanvasElement(Document&);
210 211
211 using ContextFactoryVector = Vector<OwnPtr<CanvasRenderingContextFactory>>; 212 using ContextFactoryVector = Vector<std::unique_ptr<CanvasRenderingContextFa ctory>>;
212 static ContextFactoryVector& renderingContextFactories(); 213 static ContextFactoryVector& renderingContextFactories();
213 static CanvasRenderingContextFactory* getRenderingContextFactory(int); 214 static CanvasRenderingContextFactory* getRenderingContextFactory(int);
214 215
215 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override; 216 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override;
216 LayoutObject* createLayoutObject(const ComputedStyle&) override; 217 LayoutObject* createLayoutObject(const ComputedStyle&) override;
217 bool areAuthorShadowsAllowed() const override { return false; } 218 bool areAuthorShadowsAllowed() const override { return false; }
218 219
219 void reset(); 220 void reset();
220 221
221 PassOwnPtr<ImageBufferSurface> createImageBufferSurface(const IntSize& devic eSize, int* msaaSampleCount); 222 std::unique_ptr<ImageBufferSurface> createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount);
222 void createImageBuffer(); 223 void createImageBuffer();
223 void createImageBufferInternal(PassOwnPtr<ImageBufferSurface> externalSurfac e); 224 void createImageBufferInternal(std::unique_ptr<ImageBufferSurface> externalS urface);
224 bool shouldUseDisplayList(const IntSize& deviceSize); 225 bool shouldUseDisplayList(const IntSize& deviceSize);
225 226
226 void setSurfaceSize(const IntSize&); 227 void setSurfaceSize(const IntSize&);
227 228
228 bool paintsIntoCanvasBuffer() const; 229 bool paintsIntoCanvasBuffer() const;
229 230
230 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const; 231 ImageData* toImageData(SourceDrawingBuffer, SnapshotReason) const;
231 232
232 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const; 233 String toDataURLInternal(const String& mimeType, const double& quality, Sour ceDrawingBuffer) const;
233 234
234 HeapHashSet<WeakMember<CanvasDrawListener>> m_listeners; 235 HeapHashSet<WeakMember<CanvasDrawListener>> m_listeners;
235 236
236 IntSize m_size; 237 IntSize m_size;
237 238
238 Member<CanvasRenderingContext> m_context; 239 Member<CanvasRenderingContext> m_context;
239 240
240 bool m_ignoreReset; 241 bool m_ignoreReset;
241 FloatRect m_dirtyRect; 242 FloatRect m_dirtyRect;
242 243
243 mutable intptr_t m_externallyAllocatedMemory; 244 mutable intptr_t m_externallyAllocatedMemory;
244 245
245 bool m_originClean; 246 bool m_originClean;
246 247
247 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer 248 // It prevents HTMLCanvasElement::buffer() from continuously re-attempting t o allocate an imageBuffer
248 // after the first attempt failed. 249 // after the first attempt failed.
249 mutable bool m_didFailToCreateImageBuffer; 250 mutable bool m_didFailToCreateImageBuffer;
250 bool m_imageBufferIsClear; 251 bool m_imageBufferIsClear;
251 OwnPtr<ImageBuffer> m_imageBuffer; 252 std::unique_ptr<ImageBuffer> m_imageBuffer;
252 253
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). 254 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 255
255 // Used for OffscreenCanvas that controls this HTML canvas element 256 // Used for OffscreenCanvas that controls this HTML canvas element
256 OwnPtr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge; 257 std::unique_ptr<CanvasSurfaceLayerBridge> m_surfaceLayerBridge;
257 }; 258 };
258 259
259 } // namespace blink 260 } // namespace blink
260 261
261 #endif // HTMLCanvasElement_h 262 #endif // HTMLCanvasElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698