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

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

Issue 1581403004: Fix crash in Canvas2DLayerBridge flushing + reliability metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 years, 11 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/platform/graphics/Canvas2DLayerBridge.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) 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 HibernationAbortedDueToDestructionWhileHibernatePending = 1, 104 HibernationAbortedDueToDestructionWhileHibernatePending = 1,
105 HibernationAbortedDueToPendingDestruction = 2, 105 HibernationAbortedDueToPendingDestruction = 2,
106 HibernationAbortedDueToVisibilityChange = 3, 106 HibernationAbortedDueToVisibilityChange = 3,
107 HibernationAbortedDueGpuContextLoss = 4, 107 HibernationAbortedDueGpuContextLoss = 4,
108 HibernationAbortedDueToSwitchToUnacceleratedRendering = 5, 108 HibernationAbortedDueToSwitchToUnacceleratedRendering = 5,
109 HibernationAbortedDueToAllocationFailure = 6, 109 HibernationAbortedDueToAllocationFailure = 6,
110 HibernationEndedNormally = 7, 110 HibernationEndedNormally = 7,
111 HibernationEndedWithSwitchToBackgroundRendering = 8, 111 HibernationEndedWithSwitchToBackgroundRendering = 8,
112 HibernationEndedWithFallbackToSW = 9, 112 HibernationEndedWithFallbackToSW = 9,
113 HibernationEndedWithTeardown = 10, 113 HibernationEndedWithTeardown = 10,
114 HibernationAbortedBecauseNoSurface = 11,
114 115
115 HibernationEventCount = 11, 116 HibernationEventCount = 12,
116 }; 117 };
117 118
118 class PLATFORM_EXPORT Logger { 119 class PLATFORM_EXPORT Logger {
119 public: 120 public:
120 virtual void reportHibernationEvent(HibernationEvent); 121 virtual void reportHibernationEvent(HibernationEvent);
121 virtual void didStartHibernating() { } 122 virtual void didStartHibernating() { }
122 virtual ~Logger() { } 123 virtual ~Logger() { }
123 }; 124 };
124 125
125 void setLoggerForTesting(PassOwnPtr<Logger>); 126 void setLoggerForTesting(PassOwnPtr<Logger>);
126 127
127 private: 128 private:
128 Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize& , int msaaSampleCount, OpacityMode, AccelerationMode); 129 Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize& , int msaaSampleCount, OpacityMode, AccelerationMode);
129 WebGraphicsContext3D* context(); 130 WebGraphicsContext3D* context();
130 void startRecording(); 131 void startRecording();
131 void skipQueuedDrawCommands(); 132 void skipQueuedDrawCommands();
132 void flushRecordingOnly(); 133 void flushRecordingOnly();
133 void unregisterTaskObserver(); 134 void unregisterTaskObserver();
135 void reportSurfaceCreationFailure();
134 136
135 // WebThread::TaskOberver implementation 137 // WebThread::TaskOberver implementation
136 void willProcessTask() override; 138 void willProcessTask() override;
137 void didProcessTask() override; 139 void didProcessTask() override;
138 140
139 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); 141 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration);
140 bool shouldAccelerate(AccelerationHint) const; 142 bool shouldAccelerate(AccelerationHint) const;
141 143
142 OwnPtr<SkPictureRecorder> m_recorder; 144 OwnPtr<SkPictureRecorder> m_recorder;
143 RefPtr<SkSurface> m_surface; 145 RefPtr<SkSurface> m_surface;
144 RefPtr<SkImage> m_hibernationImage; 146 RefPtr<SkImage> m_hibernationImage;
145 int m_initialSurfaceSaveCount; 147 int m_initialSurfaceSaveCount;
146 OwnPtr<WebExternalTextureLayer> m_layer; 148 OwnPtr<WebExternalTextureLayer> m_layer;
147 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; 149 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider;
148 OwnPtr<SharedContextRateLimiter> m_rateLimiter; 150 OwnPtr<SharedContextRateLimiter> m_rateLimiter;
149 OwnPtr<Logger> m_logger; 151 OwnPtr<Logger> m_logger;
150 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; 152 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory;
151 ImageBuffer* m_imageBuffer; 153 ImageBuffer* m_imageBuffer;
152 int m_msaaSampleCount; 154 int m_msaaSampleCount;
153 size_t m_bytesAllocated; 155 size_t m_bytesAllocated;
154 bool m_haveRecordedDrawCommands; 156 bool m_haveRecordedDrawCommands;
155 bool m_destructionInProgress; 157 bool m_destructionInProgress;
156 SkFilterQuality m_filterQuality; 158 SkFilterQuality m_filterQuality;
157 bool m_isHidden; 159 bool m_isHidden;
158 bool m_isDeferralEnabled; 160 bool m_isDeferralEnabled;
159 bool m_isRegisteredTaskObserver; 161 bool m_isRegisteredTaskObserver;
160 bool m_renderingTaskCompletedForCurrentFrame; 162 bool m_renderingTaskCompletedForCurrentFrame;
161 bool m_softwareRenderingWhileHidden; 163 bool m_softwareRenderingWhileHidden;
164 bool m_surfaceCreationFailedAtLeastOnce = false;
162 165
163 friend class Canvas2DLayerBridgeTest; 166 friend class Canvas2DLayerBridgeTest;
164 167
165 struct MailboxInfo { 168 struct MailboxInfo {
166 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 169 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
167 WebExternalTextureMailbox m_mailbox; 170 WebExternalTextureMailbox m_mailbox;
168 RefPtr<SkImage> m_image; 171 RefPtr<SkImage> m_image;
169 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; 172 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
170 173
171 MailboxInfo(const MailboxInfo&); 174 MailboxInfo(const MailboxInfo&);
(...skipping 12 matching lines...) Expand all
184 GLenum m_lastFilter; 187 GLenum m_lastFilter;
185 AccelerationMode m_accelerationMode; 188 AccelerationMode m_accelerationMode;
186 OpacityMode m_opacityMode; 189 OpacityMode m_opacityMode;
187 IntSize m_size; 190 IntSize m_size;
188 int m_recordingPixelCount; 191 int m_recordingPixelCount;
189 }; 192 };
190 193
191 } // namespace blink 194 } // namespace blink
192 195
193 #endif 196 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698