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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/TransferableImageBitmap.h

Issue 1893983002: Simplify handling of Transferable objects while (de)serializing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove Transferable.cpp, not needed after all. 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 TransferableImageBitmap_h
6 #define TransferableImageBitmap_h
7
8 #include "bindings/core/v8/Transferable.h"
9 #include "core/CoreExport.h"
10 #include "core/frame/ImageBitmap.h"
11
12 namespace blink {
13
14 class CORE_EXPORT TransferableImageBitmap : public Transferable {
15 public:
16 ~TransferableImageBitmap() override { }
17 void append(ImageBitmap* imageBitmap)
18 {
19 m_imageBitmapArray.append(imageBitmap);
20 }
21 bool contains(ImageBitmap* imageBitmap)
22 {
23 return m_imageBitmapArray.contains(imageBitmap);
24 }
25 static TransferableImageBitmap* ensure(TransferableArray& transferables)
26 {
27 if (transferables.size() <= TransferableImageBitmapType) {
28 transferables.resize(TransferableImageBitmapType + 1);
29 transferables[TransferableImageBitmapType] = new TransferableImageBi tmap();
30 }
31 return static_cast<TransferableImageBitmap*>(transferables[TransferableI mageBitmapType].get());
32 }
33 static TransferableImageBitmap* get(TransferableArray& transferables)
34 {
35 if (transferables.size() <= TransferableImageBitmapType)
36 return nullptr;
37 return static_cast<TransferableImageBitmap*>(transferables[TransferableI mageBitmapType].get());
38 }
39 HeapVector<Member<ImageBitmap>, 1>& getArray()
40 {
41 return m_imageBitmapArray;
42 }
43 DEFINE_INLINE_TRACE()
44 {
45 visitor->trace(m_imageBitmapArray);
46 Transferable::trace(visitor);
47 }
48 private:
49 HeapVector<Member<ImageBitmap>, 1> m_imageBitmapArray;
50 };
51
52 } // namespace blink
53
54 #endif // TransferableImageBitmap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698