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

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

Issue 2420203002: Implement convertToBlob() in OffscreenCanvas (Closed)
Patch Set: webgl layout test Created 4 years, 2 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 178a267f26468c7b492235b1cf632cfe44d4cc1a..c20fcef5976d5927619942b0b05de73ae58f7454 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "core/CoreExport.h"
#include "core/dom/DOMTypedArray.h"
#include "core/fileapi/BlobCallback.h"
@@ -28,9 +29,9 @@ class CORE_EXPORT CanvasAsyncBlobCreator
const IntSize&,
BlobCallback*,
double,
- Document&);
- void scheduleAsyncBlobCreation(bool canUseIdlePeriodScheduling,
- const double& quality = 0.0);
+ Document*,
+ ScriptPromiseResolver*);
+ void scheduleAsyncBlobCreation(const double& quality);
virtual ~CanvasAsyncBlobCreator();
enum MimeType {
MimeTypePng,
@@ -50,6 +51,13 @@ class CORE_EXPORT CanvasAsyncBlobCreator
// types
IdleTaskCount, // Should not be seen in production
};
+
+ enum ToBlobFunctionType {
+ HTMLCanvasToBlobCallback,
+ OffscreenCanvasToBlobPromise,
+ NumberOfToBlobFunctionTypes
+ };
+
// Methods are virtual for mocking in unit tests
virtual void signalTaskSwitchInStartTimeoutEventForTesting() {}
virtual void signalTaskSwitchInCompleteTimeoutEventForTesting() {}
@@ -62,7 +70,8 @@ class CORE_EXPORT CanvasAsyncBlobCreator
const IntSize&,
BlobCallback*,
double,
- Document&);
+ Document*,
+ ScriptPromiseResolver*);
// Methods are virtual for unit testing
virtual void scheduleInitiatePngEncoding();
virtual void scheduleInitiateJpegEncoding(const double&);
@@ -94,12 +103,19 @@ class CORE_EXPORT CanvasAsyncBlobCreator
const IntSize m_size;
size_t m_pixelRowStride;
const MimeType m_mimeType;
- Member<BlobCallback> m_callback;
double m_startTime;
double m_scheduleInitiateStartTime;
double m_elapsedTime;
+
+ ToBlobFunctionType m_functionType;
+
+ // Used for HTMLCanvasElement only
+ Member<BlobCallback> m_callback;
Member<ParentFrameTaskRunners> m_parentFrameTaskRunner;
+ // Used for OffscreenCanvas only
+ Member<ScriptPromiseResolver> m_scriptPromiseResolver;
+
// PNG
bool initializePngStruct();
void

Powered by Google App Engine
This is Rietveld 408576698