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

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

Issue 1660993002: Revert of Simplify CanvasAsyncBlobCreator by removing ContextObserver and related tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 0a714c7002f366c818430f0f8bd78ac9cb854c6a..df7f1d787ee125dfa55e9135f2ee1bb74509d8fc 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -4,6 +4,7 @@
#include "core/CoreExport.h"
#include "core/dom/DOMTypedArray.h"
+#include "core/dom/ExecutionContext.h"
#include "core/fileapi/BlobCallback.h"
#include "platform/geometry/IntSize.h"
#include "platform/heap/Handle.h"
@@ -19,15 +20,19 @@
class CORE_EXPORT CanvasAsyncBlobCreator
: public RefCounted<CanvasAsyncBlobCreator> {
public:
- static PassRefPtr<CanvasAsyncBlobCreator> create(PassRefPtr<DOMUint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const IntSize&, BlobCallback*);
+ static PassRefPtr<CanvasAsyncBlobCreator> create(PassRefPtr<DOMUint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const IntSize&, BlobCallback*, ExecutionContext*);
void scheduleAsyncBlobCreation(bool canUseIdlePeriodScheduling, double quality = 0.0);
virtual ~CanvasAsyncBlobCreator();
+protected:
+ CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize&, BlobCallback*);
+ virtual void scheduleCreateBlobAndCallOnMainThread();
+ virtual void scheduleCreateNullptrAndCallOnMainThread();
+ virtual void scheduleClearSelfRefOnMainThread();
+ std::atomic<bool> m_cancelled;
+
private:
- CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize&, BlobCallback*);
- void scheduleCreateBlobAndCallOnMainThread();
- void scheduleCreateNullptrAndCallOnMainThread();
- void scheduleClearSelfRefOnMainThread();
+ friend class CanvasAsyncBlobCreatorTest;
OwnPtr<PNGImageEncoderState> m_encoderState;
RefPtr<DOMUint8ClampedArray> m_data;
@@ -49,6 +54,13 @@
void createBlobAndCall();
void encodeImageOnEncoderThread(double quality);
+ bool initializeEncodeImageOnEncoderThread();
+ void nonprogressiveEncodeImageOnEncoderThread(double quality);
+ void progressiveEncodeImageOnEncoderThread();
+
+ class ContextObserver;
+ void createContextObserver(ExecutionContext*);
+ OwnPtrWillBePersistent<ContextObserver> m_contextObserver;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698