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