OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef RecordingImageBufferSurface_h | 5 #ifndef RecordingImageBufferSurface_h |
6 #define RecordingImageBufferSurface_h | 6 #define RecordingImageBufferSurface_h |
7 | 7 |
8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
9 #include "platform/graphics/ImageBufferSurface.h" | 9 #include "platform/graphics/ImageBufferSurface.h" |
10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // This enum is used in a UMA histogram. | 88 // This enum is used in a UMA histogram. |
89 enum FallbackReason { | 89 enum FallbackReason { |
90 FallbackReasonUnknown = | 90 FallbackReasonUnknown = |
91 0, // This value should never appear in production histograms | 91 0, // This value should never appear in production histograms |
92 FallbackReasonCanvasNotClearedBetweenFrames = 1, | 92 FallbackReasonCanvasNotClearedBetweenFrames = 1, |
93 FallbackReasonRunawayStateStack = 2, | 93 FallbackReasonRunawayStateStack = 2, |
94 FallbackReasonWritePixels = 3, | 94 FallbackReasonWritePixels = 3, |
95 FallbackReasonFlushInitialClear = 4, | 95 FallbackReasonFlushInitialClear = 4, |
96 FallbackReasonFlushForDrawImageOfWebGL = 5, | 96 FallbackReasonFlushForDrawImageOfWebGL = 5, |
97 FallbackReasonSnapshotForGetImageData = 6, | 97 FallbackReasonSnapshotForGetImageData = 6, |
98 FallbackReasonSnapshotForCopyToWebGLTexture = 7, | |
99 FallbackReasonSnapshotForPaint = 8, | 98 FallbackReasonSnapshotForPaint = 8, |
100 FallbackReasonSnapshotForToDataURL = 9, | 99 FallbackReasonSnapshotForToDataURL = 9, |
101 FallbackReasonSnapshotForToBlob = 10, | 100 FallbackReasonSnapshotForToBlob = 10, |
102 FallbackReasonSnapshotForCanvasListenerCapture = 11, | 101 FallbackReasonSnapshotForCanvasListenerCapture = 11, |
103 FallbackReasonSnapshotForDrawImage = 12, | 102 FallbackReasonSnapshotForDrawImage = 12, |
104 FallbackReasonSnapshotForCreatePattern = 13, | 103 FallbackReasonSnapshotForCreatePattern = 13, |
105 FallbackReasonExpensiveOverdrawHeuristic = 14, | 104 FallbackReasonExpensiveOverdrawHeuristic = 14, |
106 FallbackReasonTextureBackedPattern = 15, | 105 FallbackReasonTextureBackedPattern = 15, |
107 FallbackReasonDrawImageOfVideo = 16, | 106 FallbackReasonDrawImageOfVideo = 16, |
108 FallbackReasonDrawImageOfAnimated2dCanvas = 17, | 107 FallbackReasonDrawImageOfAnimated2dCanvas = 17, |
109 FallbackReasonSubPixelTextAntiAliasingSupport = 18, | 108 FallbackReasonSubPixelTextAntiAliasingSupport = 18, |
110 FallbackReasonDrawImageWithTextureBackedSourceImage = 19, | 109 FallbackReasonDrawImageWithTextureBackedSourceImage = 19, |
111 FallbackReasonSnapshotForTransferToImageBitmap = 20, | 110 FallbackReasonSnapshotForTransferToImageBitmap = 20, |
112 FallbackReasonSnapshotForUnitTests = | 111 FallbackReasonSnapshotForUnitTests = |
113 21, // This value should never appear in production histograms | 112 21, // This value should never appear in production histograms |
114 FallbackReasonSnapshotGetCopiedImage = 22, | 113 FallbackReasonSnapshotGetCopiedImage = 22, |
115 FallbackReasonSnapshotWebGLDrawImageIntoBuffer = 23, | 114 FallbackReasonSnapshotWebGLDrawImageIntoBuffer = 23, |
| 115 FallbackReasonSnapshotForWebGLTexImage2D = 24, |
| 116 FallbackReasonSnapshotForWebGLTexSubImage2D = 25, |
| 117 FallbackReasonSnapshotForWebGLTexImage3D = 26, |
| 118 FallbackReasonSnapshotForWebGLTexSubImage3D = 27, |
| 119 FallbackReasonSnapshotForCopyToClipboard = 28, |
| 120 FallbackReasonSnapshotForCreateImageBitmap = 29, |
116 FallbackReasonCount, | 121 FallbackReasonCount, |
117 }; | 122 }; |
118 | 123 |
119 private: | 124 private: |
120 friend class RecordingImageBufferSurfaceTest; // for unit testing | 125 friend class RecordingImageBufferSurfaceTest; // for unit testing |
121 void fallBackToRasterCanvas(FallbackReason); | 126 void fallBackToRasterCanvas(FallbackReason); |
122 void initializeCurrentFrame(); | 127 void initializeCurrentFrame(); |
123 bool finalizeFrameInternal(FallbackReason*); | 128 bool finalizeFrameInternal(FallbackReason*); |
124 int approximateOpCount(); | 129 int approximateOpCount(); |
125 | 130 |
126 std::unique_ptr<SkPictureRecorder> m_currentFrame; | 131 std::unique_ptr<SkPictureRecorder> m_currentFrame; |
127 sk_sp<SkPicture> m_previousFrame; | 132 sk_sp<SkPicture> m_previousFrame; |
128 std::unique_ptr<ImageBufferSurface> m_fallbackSurface; | 133 std::unique_ptr<ImageBufferSurface> m_fallbackSurface; |
129 ImageBuffer* m_imageBuffer; | 134 ImageBuffer* m_imageBuffer; |
130 int m_initialSaveCount; | 135 int m_initialSaveCount; |
131 int m_currentFramePixelCount; | 136 int m_currentFramePixelCount; |
132 int m_previousFramePixelCount; | 137 int m_previousFramePixelCount; |
133 bool m_frameWasCleared; | 138 bool m_frameWasCleared; |
134 bool m_didRecordDrawCommandsInCurrentFrame; | 139 bool m_didRecordDrawCommandsInCurrentFrame; |
135 bool m_currentFrameHasExpensiveOp; | 140 bool m_currentFrameHasExpensiveOp; |
136 bool m_previousFrameHasExpensiveOp; | 141 bool m_previousFrameHasExpensiveOp; |
137 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; | 142 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> m_fallbackFactory; |
138 }; | 143 }; |
139 | 144 |
140 } // namespace blink | 145 } // namespace blink |
141 | 146 |
142 #endif | 147 #endif |
OLD | NEW |