| Index: third_party/WebKit/Source/bindings/modules/v8/TransferableOffscreenCanvasExtractor.h
|
| diff --git a/third_party/WebKit/Source/bindings/modules/v8/TransferableOffscreenCanvasExtractor.h b/third_party/WebKit/Source/bindings/modules/v8/TransferableOffscreenCanvasExtractor.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a7a96f9ff22d5eca02d1634118afb231f31ec0a6
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/bindings/modules/v8/TransferableOffscreenCanvasExtractor.h
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef TransferableOffscreenCanvasExtractor_h
|
| +#define TransferableOffscreenCanvasExtractor_h
|
| +
|
| +#include "bindings/core/v8/TransferableExtractor.h"
|
| +#include "bindings/modules/v8/TransferableOffscreenCanvas.h"
|
| +#include "bindings/modules/v8/V8OffscreenCanvas.h"
|
| +#include "modules/ModulesExport.h"
|
| +#include "modules/offscreencanvas/OffscreenCanvas.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class MODULES_EXPORT TransferableOffscreenCanvasExtractor : public TransferableExtractor {
|
| +public:
|
| + ~TransferableOffscreenCanvasExtractor() override { }
|
| + bool extract(v8::Local<v8::Value> transferrable, v8::Isolate* isolate, TransferableArray& transferables, ExceptionState& exceptionState, const unsigned i) override
|
| + {
|
| + if (V8OffscreenCanvas::hasInstance(transferrable, isolate)) {
|
| + OffscreenCanvas* offscreenCanvas = V8OffscreenCanvas::toImpl(v8::Local<v8::Object>::Cast(transferrable));
|
| + TransferableOffscreenCanvas* offscreenCanvases = TransferableOffscreenCanvas::ensure(transferables);
|
| + if (offscreenCanvases->contains(offscreenCanvas)) {
|
| + exceptionState.throwDOMException(DataCloneError, "OffscreenCanvas at index " + String::number(i) + " is a duplicate of an earlier OffscreenCanvas.");
|
| + return false;
|
| + }
|
| + offscreenCanvases->append(offscreenCanvas);
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // TransferableOffscreenCanvasExtractor_h
|
|
|