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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h

Issue 2294383002: Make OffscreenCanvas a member of CanvasImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class Font; 53 class Font;
54 class FontMetrics; 54 class FontMetrics;
55 class HitRegion; 55 class HitRegion;
56 class HitRegionOptions; 56 class HitRegionOptions;
57 class HitRegionManager; 57 class HitRegionManager;
58 class HitTestCanvasResult; 58 class HitTestCanvasResult;
59 class Path2D; 59 class Path2D;
60 class SVGMatrixTearOff; 60 class SVGMatrixTearOff;
61 class TextMetrics; 61 class TextMetrics;
62 62
63 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmap Canva sImageSourceUnion; 63 typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffs creenCanvas CanvasImageSourceUnion;
64 64
65 class MODULES_EXPORT CanvasRenderingContext2D final : public CanvasRenderingCont ext, public BaseRenderingContext2D, public WebThread::TaskObserver, public SVGRe sourceClient { 65 class MODULES_EXPORT CanvasRenderingContext2D final : public CanvasRenderingCont ext, public BaseRenderingContext2D, public WebThread::TaskObserver, public SVGRe sourceClient {
66 DEFINE_WRAPPERTYPEINFO(); 66 DEFINE_WRAPPERTYPEINFO();
67 USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2D); 67 USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext2D);
68 USING_PRE_FINALIZER(CanvasRenderingContext2D, dispose); 68 USING_PRE_FINALIZER(CanvasRenderingContext2D, dispose);
69 public: 69 public:
70 class Factory : public CanvasRenderingContextFactory { 70 class Factory : public CanvasRenderingContextFactory {
71 WTF_MAKE_NONCOPYABLE(Factory); 71 WTF_MAKE_NONCOPYABLE(Factory);
72 public: 72 public:
73 Factory() {} 73 Factory() {}
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 AffineTransform baseTransform() const final; 161 AffineTransform baseTransform() const final;
162 void didDraw(const SkIRect& dirtyRect) final; 162 void didDraw(const SkIRect& dirtyRect) final;
163 163
164 bool stateHasFilter() final; 164 bool stateHasFilter() final;
165 SkImageFilter* stateGetFilter() final; 165 SkImageFilter* stateGetFilter() final;
166 void snapshotStateForFilter() final; 166 void snapshotStateForFilter() final;
167 167
168 void validateStateStack() final; 168 void validateStateStack() final;
169 169
170 PassRefPtr<Image> getImage(SnapshotReason) const final;
171
170 bool isAccelerationOptimalForCanvasContent() const; 172 bool isAccelerationOptimalForCanvasContent() const;
171 173
172 void resetUsageTracking(); 174 void resetUsageTracking();
173 175
174 void incrementFrameCount() { m_usageCounters.numFramesSinceReset++; }; 176 void incrementFrameCount() { m_usageCounters.numFramesSinceReset++; }
177
178 bool isPaintable() const final { return hasImageBuffer(); }
175 179
176 private: 180 private:
177 friend class CanvasRenderingContext2DAutoRestoreSkCanvas; 181 friend class CanvasRenderingContext2DAutoRestoreSkCanvas;
178 182
179 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&); 183 CanvasRenderingContext2D(HTMLCanvasElement*, const CanvasContextCreationAttr ibutes& attrs, Document&);
180 184
181 void dispose(); 185 void dispose();
182 186
183 void dispatchContextLostEvent(TimerBase*); 187 void dispatchContextLostEvent(TimerBase*);
184 void dispatchContextRestoredEvent(TimerBase*); 188 void dispatchContextRestoredEvent(TimerBase*);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 LostContextMode m_contextLostMode; 221 LostContextMode m_contextLostMode;
218 bool m_contextRestorable; 222 bool m_contextRestorable;
219 unsigned m_tryRestoreContextAttemptCount; 223 unsigned m_tryRestoreContextAttemptCount;
220 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; 224 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer;
221 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; 225 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer;
222 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; 226 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer;
223 227
224 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle; 228 HashMap<String, Font> m_fontsResolvedUsingCurrentStyle;
225 bool m_pruneLocalFontCacheScheduled; 229 bool m_pruneLocalFontCacheScheduled;
226 ListHashSet<String> m_fontLRUList; 230 ListHashSet<String> m_fontLRUList;
227
228 bool isPaintable() const final
229 {
230 NOTREACHED();
231 return false;
232 }
233 }; 231 };
234 232
235 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, 233 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context,
236 context->is2d() && context->canvas(), context.is2d() && context.canvas()); 234 context->is2d() && context->canvas(), context.is2d() && context.canvas());
237 235
238 } // namespace blink 236 } // namespace blink
239 237
240 #endif // CanvasRenderingContext2D_h 238 #endif // CanvasRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698