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 "core/workers/ParentFrameTaskRunners.h" | 8 #include "core/workers/ParentFrameTaskRunners.h" |
9 #include "platform/geometry/IntSize.h" | 9 #include "platform/geometry/IntSize.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 Document&); | 31 Document&); |
32 void scheduleAsyncBlobCreation(bool canUseIdlePeriodScheduling, | 32 void scheduleAsyncBlobCreation(bool canUseIdlePeriodScheduling, |
33 const double& quality = 0.0); | 33 const double& quality = 0.0); |
34 virtual ~CanvasAsyncBlobCreator(); | 34 virtual ~CanvasAsyncBlobCreator(); |
35 enum MimeType { | 35 enum MimeType { |
36 MimeTypePng, | 36 MimeTypePng, |
37 MimeTypeJpeg, | 37 MimeTypeJpeg, |
38 MimeTypeWebp, | 38 MimeTypeWebp, |
39 NumberOfMimeTypeSupported | 39 NumberOfMimeTypeSupported |
40 }; | 40 }; |
41 // This enum is used to back an UMA histogram, and should therefore be treated
as append-only. | 41 // This enum is used to back an UMA histogram, and should therefore be treated |
| 42 // as append-only. |
42 enum IdleTaskStatus { | 43 enum IdleTaskStatus { |
43 IdleTaskNotStarted, | 44 IdleTaskNotStarted, |
44 IdleTaskStarted, | 45 IdleTaskStarted, |
45 IdleTaskCompleted, | 46 IdleTaskCompleted, |
46 IdleTaskFailed, | 47 IdleTaskFailed, |
47 IdleTaskSwitchedToMainThreadTask, | 48 IdleTaskSwitchedToMainThreadTask, |
48 IdleTaskNotSupported, // Idle tasks are not implemented for some image type
s | 49 IdleTaskNotSupported, // Idle tasks are not implemented for some image |
| 50 // types |
49 IdleTaskCount, // Should not be seen in production | 51 IdleTaskCount, // Should not be seen in production |
50 }; | 52 }; |
51 // Methods are virtual for mocking in unit tests | 53 // Methods are virtual for mocking in unit tests |
52 virtual void signalTaskSwitchInStartTimeoutEventForTesting() {} | 54 virtual void signalTaskSwitchInStartTimeoutEventForTesting() {} |
53 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() {} | 55 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() {} |
54 | 56 |
55 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
56 | 58 |
57 protected: | 59 protected: |
58 CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, | 60 CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 double m_elapsedTime; | 100 double m_elapsedTime; |
99 Member<ParentFrameTaskRunners> m_parentFrameTaskRunner; | 101 Member<ParentFrameTaskRunners> m_parentFrameTaskRunner; |
100 | 102 |
101 // PNG | 103 // PNG |
102 bool initializePngStruct(); | 104 bool initializePngStruct(); |
103 void | 105 void |
104 encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without deadline | 106 encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without deadline |
105 | 107 |
106 // JPEG | 108 // JPEG |
107 bool initializeJpegStruct(double quality); | 109 bool initializeJpegStruct(double quality); |
108 void | 110 void encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without |
109 encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without deadli
ne | 111 // deadline |
110 | 112 |
111 // WEBP | 113 // WEBP |
112 void encodeImageOnEncoderThread(double quality); | 114 void encodeImageOnEncoderThread(double quality); |
113 | 115 |
114 void idleTaskStartTimeoutEvent(double quality); | 116 void idleTaskStartTimeoutEvent(double quality); |
115 void idleTaskCompleteTimeoutEvent(); | 117 void idleTaskCompleteTimeoutEvent(); |
116 void recordIdleTaskStatusHistogram(); | 118 void recordIdleTaskStatusHistogram(); |
117 }; | 119 }; |
118 | 120 |
119 } // namespace blink | 121 } // namespace blink |
OLD | NEW |