| 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 24 matching lines...) Expand all Loading... |
| 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 // Methods are virtual for mocking in unit tests | 38 // Methods are virtual for mocking in unit tests |
| 39 virtual void signalTaskSwitchInStartTimeoutEventForTesting() { } | 39 virtual void signalTaskSwitchInStartTimeoutEventForTesting() { } |
| 40 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() { } | 40 virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() { } |
| 41 | 41 |
| 42 DEFINE_INLINE_VIRTUAL_TRACE() | 42 DEFINE_INLINE_VIRTUAL_TRACE() |
| 43 { | 43 { |
| 44 visitor->trace(m_data); | 44 visitor->trace(m_data); |
| 45 visitor->trace(m_callback); |
| 45 } | 46 } |
| 46 | 47 |
| 47 protected: | 48 protected: |
| 48 CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, MimeType, const IntSize&,
BlobCallback*); | 49 CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, MimeType, const IntSize&,
BlobCallback*); |
| 49 // Methods are virtual for unit testing | 50 // Methods are virtual for unit testing |
| 50 virtual void scheduleInitiatePngEncoding(); | 51 virtual void scheduleInitiatePngEncoding(); |
| 51 virtual void scheduleInitiateJpegEncoding(const double&); | 52 virtual void scheduleInitiateJpegEncoding(const double&); |
| 52 virtual void idleEncodeRowsPng(double deadlineSeconds); | 53 virtual void idleEncodeRowsPng(double deadlineSeconds); |
| 53 virtual void idleEncodeRowsJpeg(double deadlineSeconds); | 54 virtual void idleEncodeRowsJpeg(double deadlineSeconds); |
| 54 virtual void postDelayedTaskToMainThread(const WebTraceLocation&, std::uniqu
e_ptr<SameThreadClosure>, double delayMs); | 55 virtual void postDelayedTaskToMainThread(const WebTraceLocation&, std::uniqu
e_ptr<SameThreadClosure>, double delayMs); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 OwnPtr<PNGImageEncoderState> m_pngEncoderState; | 67 OwnPtr<PNGImageEncoderState> m_pngEncoderState; |
| 67 OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; | 68 OwnPtr<JPEGImageEncoderState> m_jpegEncoderState; |
| 68 Member<DOMUint8ClampedArray> m_data; | 69 Member<DOMUint8ClampedArray> m_data; |
| 69 OwnPtr<Vector<unsigned char>> m_encodedImage; | 70 OwnPtr<Vector<unsigned char>> m_encodedImage; |
| 70 int m_numRowsCompleted; | 71 int m_numRowsCompleted; |
| 71 | 72 |
| 72 const IntSize m_size; | 73 const IntSize m_size; |
| 73 size_t m_pixelRowStride; | 74 size_t m_pixelRowStride; |
| 74 const MimeType m_mimeType; | 75 const MimeType m_mimeType; |
| 75 CrossThreadPersistent<BlobCallback> m_callback; | 76 Member<BlobCallback> m_callback; |
| 76 | 77 |
| 77 // PNG | 78 // PNG |
| 78 bool initializePngStruct(); | 79 bool initializePngStruct(); |
| 79 void encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without de
adline | 80 void encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without de
adline |
| 80 | 81 |
| 81 // JPEG | 82 // JPEG |
| 82 bool initializeJpegStruct(double quality); | 83 bool initializeJpegStruct(double quality); |
| 83 void encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without
deadline | 84 void encodeRowsJpegOnMainThread(); // Similar to idleEncodeRowsJpeg without
deadline |
| 84 | 85 |
| 85 // WEBP | 86 // WEBP |
| 86 void encodeImageOnEncoderThread(double quality); | 87 void encodeImageOnEncoderThread(double quality); |
| 87 | 88 |
| 88 void idleTaskStartTimeoutEvent(double quality); | 89 void idleTaskStartTimeoutEvent(double quality); |
| 89 void idleTaskCompleteTimeoutEvent(); | 90 void idleTaskCompleteTimeoutEvent(); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |