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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h

Issue 2063473002: Make 2D canvas disable gpu acceleration when getImageData is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test build fix 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 }; 186 };
187 187
188 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int Size&, int msaaSampleCount, OpacityMode, AccelerationMode); 188 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int Size&, int msaaSampleCount, OpacityMode, AccelerationMode);
189 gpu::gles2::GLES2Interface* contextGL(); 189 gpu::gles2::GLES2Interface* contextGL();
190 void startRecording(); 190 void startRecording();
191 void skipQueuedDrawCommands(); 191 void skipQueuedDrawCommands();
192 void flushRecordingOnly(); 192 void flushRecordingOnly();
193 void unregisterTaskObserver(); 193 void unregisterTaskObserver();
194 void reportSurfaceCreationFailure(); 194 void reportSurfaceCreationFailure();
195 195
196 void disableAcceleration();
197
196 // WebThread::TaskOberver implementation 198 // WebThread::TaskOberver implementation
197 void willProcessTask() override; 199 void willProcessTask() override;
198 void didProcessTask() override; 200 void didProcessTask() override;
199 201
200 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); 202 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration);
201 bool shouldAccelerate(AccelerationHint) const; 203 bool shouldAccelerate(AccelerationHint) const;
202 204
203 // Returns the GL filter associated with |m_filterQuality|. 205 // Returns the GL filter associated with |m_filterQuality|.
204 GLenum getGLFilter(); 206 GLenum getGLFilter();
205 207
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 SkFilterQuality m_filterQuality; 252 SkFilterQuality m_filterQuality;
251 bool m_isHidden; 253 bool m_isHidden;
252 bool m_isDeferralEnabled; 254 bool m_isDeferralEnabled;
253 bool m_isRegisteredTaskObserver; 255 bool m_isRegisteredTaskObserver;
254 bool m_renderingTaskCompletedForCurrentFrame; 256 bool m_renderingTaskCompletedForCurrentFrame;
255 bool m_softwareRenderingWhileHidden; 257 bool m_softwareRenderingWhileHidden;
256 bool m_surfaceCreationFailedAtLeastOnce = false; 258 bool m_surfaceCreationFailedAtLeastOnce = false;
257 bool m_hibernationScheduled = false; 259 bool m_hibernationScheduled = false;
258 260
259 friend class Canvas2DLayerBridgeTest; 261 friend class Canvas2DLayerBridgeTest;
262 friend class CanvasRenderingContext2DTest;
260 263
261 uint32_t m_lastImageId; 264 uint32_t m_lastImageId;
262 265
263 enum { 266 enum {
264 // We should normally not have more that two active mailboxes at a time, 267 // We should normally not have more that two active mailboxes at a time,
265 // but sometime we may have three due to the async nature of mailbox han dling. 268 // but sometime we may have three due to the async nature of mailbox han dling.
266 MaxActiveMailboxes = 3, 269 MaxActiveMailboxes = 3,
267 }; 270 };
268 271
269 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; 272 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes;
270 GLenum m_lastFilter; 273 GLenum m_lastFilter;
271 AccelerationMode m_accelerationMode; 274 AccelerationMode m_accelerationMode;
272 OpacityMode m_opacityMode; 275 OpacityMode m_opacityMode;
273 const IntSize m_size; 276 const IntSize m_size;
274 int m_recordingPixelCount; 277 int m_recordingPixelCount;
275 278
276 #if USE_IOSURFACE_FOR_2D_CANVAS 279 #if USE_IOSURFACE_FOR_2D_CANVAS
277 // Each element in this vector represents an IOSurface backed texture that 280 // Each element in this vector represents an IOSurface backed texture that
278 // is ready to be reused. 281 // is ready to be reused.
279 // Elements in this vector can safely be purged in low memory conditions. 282 // Elements in this vector can safely be purged in low memory conditions.
280 Vector<ImageInfo> m_imageInfoCache; 283 Vector<ImageInfo> m_imageInfoCache;
281 #endif // USE_IOSURFACE_FOR_2D_CANVAS 284 #endif // USE_IOSURFACE_FOR_2D_CANVAS
282 }; 285 };
283 286
284 } // namespace blink 287 } // namespace blink
285 288
286 #endif 289 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698