Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h

Issue 1732913002: Revert of toBlob: If idle image encoding is postponed for too long, switch to main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
index 0ac104d548994a9c6976cdaa0af541dc7d2ad08a..391a9ce9a387789b3fe74163480054a777b39a63 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -5,7 +5,6 @@
#include "core/CoreExport.h"
#include "core/dom/DOMTypedArray.h"
#include "core/fileapi/BlobCallback.h"
-#include "platform/Task.h"
#include "platform/geometry/IntSize.h"
#include "platform/heap/Handle.h"
#include "wtf/OwnPtr.h"
@@ -24,32 +23,11 @@
static PassRefPtr<CanvasAsyncBlobCreator> create(PassRefPtr<DOMUint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const IntSize&, BlobCallback*);
void scheduleAsyncBlobCreation(bool canUseIdlePeriodScheduling, double quality = 0.0);
virtual ~CanvasAsyncBlobCreator();
- enum IdleTaskStatus {
- IdleTaskNotStarted,
- IdleTaskStarted,
- IdleTaskCompleted,
- IdleTaskFailed,
- IdleTaskSwitchedToMainThreadTask,
- Default // Idle tasks are not implemented for some image types
- };
- virtual void signalTaskSwitchInStartTimeoutEventForTesting() { }
- virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() { }
-
-protected:
- CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize&, BlobCallback*);
- virtual void scheduleInitiatePngEncoding();
- virtual void idleEncodeRowsPng(double deadlineSeconds);
- virtual void postDelayedTaskToMainThread(const WebTraceLocation&, Task*, double delayMs);
- virtual void clearAlternativeSelfReference();
- virtual void createBlobAndCall();
- virtual void createNullptrAndCall();
-
- void clearSelfReference();
- void initiatePngEncoding(double deadlineSeconds);
- IdleTaskStatus m_idleTaskStatus;
private:
- friend class CanvasAsyncBlobCreatorTest;
+ CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize&, BlobCallback*);
+ void scheduleCreateBlobAndCallOnMainThread();
+ void scheduleCreateNullptrAndCallOnMainThread();
OwnPtr<PNGImageEncoderState> m_pngEncoderState;
OwnPtr<JPEGImageEncoderState> m_jpegEncoderState;
@@ -62,22 +40,18 @@
const String m_mimeType;
CrossThreadPersistent<BlobCallback> m_callback;
- // To keep this asyncBlobCreator alive before async encoding task completes
- // Used by all image types
RefPtr<CanvasAsyncBlobCreator> m_selfRef;
- // To keep this asyncBlobCreator alive before the alternative code path (for
- // the case when idle task is postponed for too long) is confirmed not to
- // continue any more; Used by png image type only
- RefPtr<CanvasAsyncBlobCreator> m_alternativeSelfRef;
+ void clearSelfReference();
- bool initializePngStruct();
- void encodeRowsPngOnMainThread(); // Similar to idleEncodeRowsPng without deadline
- void encodeImageOnEncoderThread(double quality);
+ void initiatePngEncoding(double deadlineSeconds);
+ void scheduleIdleEncodeRowsPng();
+ void idleEncodeRowsPng(double deadlineSeconds);
void initiateJpegEncoding(const double& quality);
- void idleTaskStartTimeoutEvent(double quality);
- void idleTaskCompleteTimeoutEvent();
+ void createBlobAndCall();
+
+ void encodeImageOnEncoderThread(double quality);
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698