OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "core/CoreExport.h" | 5 #include "core/CoreExport.h" |
6 #include "core/dom/DOMTypedArray.h" | 6 #include "core/dom/DOMTypedArray.h" |
7 #include "core/fileapi/BlobCallback.h" | 7 #include "core/fileapi/BlobCallback.h" |
8 #include "platform/geometry/IntSize.h" | 8 #include "platform/geometry/IntSize.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "wtf/OwnPtr.h" | 10 #include "wtf/OwnPtr.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 NumberOfMimeTypeSupported | 28 NumberOfMimeTypeSupported |
29 }; | 29 }; |
30 enum IdleTaskStatus { | 30 enum IdleTaskStatus { |
31 IdleTaskNotStarted, | 31 IdleTaskNotStarted, |
32 IdleTaskStarted, | 32 IdleTaskStarted, |
33 IdleTaskCompleted, | 33 IdleTaskCompleted, |
34 IdleTaskFailed, | 34 IdleTaskFailed, |
35 IdleTaskSwitchedToMainThreadTask, | 35 IdleTaskSwitchedToMainThreadTask, |
36 IdleTaskNotSupported // Idle tasks are not implemented for some image ty
pes | 36 IdleTaskNotSupported // Idle tasks are not implemented for some image ty
pes |
37 }; | 37 }; |
| 38 // enum used histogram |
| 39 enum IdleTaskTimeoutType { |
| 40 IdleTaskStartTimeout, |
| 41 IdleTaskCompleteTimeout, |
| 42 IdleTaskTimeoutSupported |
| 43 }; |
38 // Methods are virtual for mocking in unit tests | 44 // Methods are virtual for mocking in unit tests |
39 virtual void signalTaskSwitchInStartTimeoutEventForTesting() { } | 45 virtual void signalTaskSwitchInStartTimeoutEventForTesting() { } |
40 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() { } | 46 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() { } |
41 | 47 |
42 DEFINE_INLINE_VIRTUAL_TRACE() | 48 DEFINE_INLINE_VIRTUAL_TRACE() |
43 { | 49 { |
44 visitor->trace(m_data); | 50 visitor->trace(m_data); |
45 } | 51 } |
46 | 52 |
47 protected: | 53 protected: |
(...skipping 18 matching lines...) Expand all Loading... |
66 OwnPtr<PNGImageEncoderState> m_pngEncoderState; | 72 OwnPtr<PNGImageEncoderState> m_pngEncoderState; |
67 OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; | 73 OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; |
68 Member<DOMUint8ClampedArray> m_data; | 74 Member<DOMUint8ClampedArray> m_data; |
69 OwnPtr<Vector<unsigned char>> m_encodedImage; | 75 OwnPtr<Vector<unsigned char>> m_encodedImage; |
70 int m_numRowsCompleted; | 76 int m_numRowsCompleted; |
71 | 77 |
72 const IntSize m_size; | 78 const IntSize m_size; |
73 size_t m_pixelRowStride; | 79 size_t m_pixelRowStride; |
74 const MimeType m_mimeType; | 80 const MimeType m_mimeType; |
75 CrossThreadPersistent<BlobCallback> m_callback; | 81 CrossThreadPersistent<BlobCallback> m_callback; |
| 82 double m_startTime; |
| 83 void recordTimeoutEvent(IdleTaskTimeoutType); |
76 | 84 |
77 // PNG | 85 // PNG |
78 bool initializePngStruct(); | 86 bool initializePngStruct(); |
79 void encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without de
adline | 87 void encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without de
adline |
80 | 88 |
81 // JPEG | 89 // JPEG |
82 bool initializeJpegStruct(double quality); | 90 bool initializeJpegStruct(double quality); |
83 void encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without
deadline | 91 void encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without
deadline |
84 | 92 |
85 // WEBP | 93 // WEBP |
86 void encodeImageOnEncoderThread(double quality); | 94 void encodeImageOnEncoderThread(double quality); |
87 | 95 |
88 void idleTaskStartTimeoutEvent(double quality); | 96 void idleTaskStartTimeoutEvent(double quality, double startTime); |
89 void idleTaskCompleteTimeoutEvent(); | 97 void idleTaskCompleteTimeoutEvent(double startTime); |
90 }; | 98 }; |
91 | 99 |
92 } // namespace blink | 100 } // namespace blink |
OLD | NEW |