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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/TransferableMessagePort.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 TransferableMessagePort_h
6 #define TransferableMessagePort_h
7
8 #include "bindings/core/v8/Transferable.h"
9 #include "core/CoreExport.h"
10 #include "core/dom/MessagePort.h"
11
12 namespace blink {
13
14 class CORE_EXPORT TransferableMessagePort : public Transferable {
15 public:
16 ~TransferableMessagePort() override { }
17 void append(MessagePort* messagePort)
18 {
19 m_messagePortArray.append(messagePort);
20 }
21 bool contains(MessagePort* messagePort)
22 {
23 return m_messagePortArray.contains(messagePort);
24 }
25 static TransferableMessagePort* ensure(TransferableArray& transferables)
26 {
27 if (transferables.size() <= TransferableMessagePortType) {
28 transferables.resize(TransferableMessagePortType + 1);
29 transferables[TransferableMessagePortType] = new TransferableMessage Port();
30 }
31 return static_cast<TransferableMessagePort*>(transferables[TransferableM essagePortType].get());
32 }
33 static TransferableMessagePort* get(const TransferableArray& transferables)
34 {
35 if (transferables.size() <= TransferableMessagePortType)
36 return nullptr;
37 return static_cast<TransferableMessagePort*>(transferables[TransferableM essagePortType].get());
38 }
39 HeapVector<Member<MessagePort>, 1>& getArray()
40 {
41 return m_messagePortArray;
42 }
43 DEFINE_INLINE_TRACE()
44 {
45 visitor->trace(m_messagePortArray);
46 Transferable::trace(visitor);
47 }
48 private:
49 HeapVector<Member<MessagePort>, 1> m_messagePortArray;
50 };
51
52 } // namespace blink
53
54 #endif // TransferableMessagePort_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698