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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/TransferableOffscreenCanvasExtractor.h

Issue 1862033002: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, compiles but crashes some layout tests Created 4 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef TransferableOffscreenCanvasExtractor_h
6 #define TransferableOffscreenCanvasExtractor_h
7
8 #include "bindings/core/v8/TransferableExtractor.h"
9 #include "bindings/modules/v8/TransferableOffscreenCanvas.h"
10 #include "bindings/modules/v8/V8OffscreenCanvas.h"
11 #include "modules/ModulesExport.h"
12 #include "modules/offscreencanvas/OffscreenCanvas.h"
13
14 namespace blink {
15
16 class MODULES_EXPORT TransferableOffscreenCanvasExtractor : public TransferableE xtractor {
17 public:
18 ~TransferableOffscreenCanvasExtractor() override { }
19 bool extract(v8::Local<v8::Value> transferableObject, v8::Isolate* isolate, Transferables& transferables, ExceptionState& exceptionState, const unsigned i) override
20 {
21 if (V8OffscreenCanvas::hasInstance(transferableObject, isolate)) {
22 OffscreenCanvas* offscreenCanvas = V8OffscreenCanvas::toImpl(v8::Loc al<v8::Object>::Cast(transferableObject));
23 auto& offscreenCanvases = static_cast<TransferableOffscreenCanvas*>( &transferables)->offscreenCanvases;
24 if (offscreenCanvases.contains(offscreenCanvas)) {
25 exceptionState.throwDOMException(DataCloneError, "OffscreenCanva s at index " + String::number(i) + " is a duplicate of an earlier OffscreenCanva s.");
26 return false;
27 }
28 offscreenCanvases.append(offscreenCanvas);
29 return true;
30 }
31 return false;
32 }
33 };
34
35 } // namespace blink
36
37 #endif // TransferableOffscreenCanvasExtractor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698