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

Side by Side Diff: third_party/WebKit/Source/core/testing/RecordTest.h

Issue 2709983004: WIP bindings: Add support for the record<K,V> WebIDL type. (Closed)
Patch Set: Rebased patch using NativeValueTraits for IDL types Created 3 years, 9 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 2017 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 RecordTest_h
6 #define RecordTest_h
7
8 #include <utility>
9 #include "bindings/core/v8/BooleanOrByteStringByteStringRecord.h"
10 #include "bindings/core/v8/FloatOrStringBooleanRecord.h"
11 #include "bindings/core/v8/FloatOrStringElementRecord.h"
12 #include "bindings/core/v8/Nullable.h"
13 #include "bindings/core/v8/ScriptWrappable.h"
14 #include "core/dom/Element.h"
15 #include "platform/heap/Handle.h"
16 #include "wtf/Vector.h"
17 #include "wtf/text/WTFString.h"
18
19 namespace blink {
20
21 class RecordTest final : public GarbageCollectedFinalized<RecordTest>,
22 public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO();
24
25 public:
26 static RecordTest* create() { return new RecordTest; }
27 ~RecordTest();
28
29 void setStringLongRecord(const Vector<std::pair<String, int32_t>>& arg);
30 Vector<std::pair<String, int32_t>> getStringLongRecord();
31
32 void setNullableStringLongRecord(
33 const Nullable<Vector<std::pair<String, int32_t>>>& arg);
34 Nullable<Vector<std::pair<String, int32_t>>> getNullableStringLongRecord();
35
36 Vector<std::pair<String, String>> getByteStringByteStringRecord();
37 void setByteStringByteStringRecord(
38 const Vector<std::pair<String, String>>& arg);
39
40 void setStringElementRecord(
41 const HeapVector<std::pair<String, Member<Element>>>& arg);
42 HeapVector<std::pair<String, Member<Element>>> getStringElementRecord();
43
44 using NestedRecordType =
45 Vector<std::pair<String, Vector<std::pair<String, bool>>>>;
46 void setUSVStringUSVStringBooleanRecordRecord(const NestedRecordType& arg);
47 NestedRecordType getUSVStringUSVStringBooleanRecordRecord();
48
49 bool unionReceivedARecord(const BooleanOrByteStringByteStringRecord& arg);
50
51 // Test the bindings generator code: unions and dictionaries must trace a
52 // record when it's represented as a HeapVector.
53 void setFloatOrStringBooleanRecord(const FloatOrStringBooleanRecord&){};
54 void setFloatOrStringElementRecord(const FloatOrStringElementRecord&){};
55
56 DECLARE_TRACE();
57
58 private:
59 RecordTest();
60
61 Vector<std::pair<String, int32_t>> m_stringLongRecord;
62 Nullable<Vector<std::pair<String, int32_t>>> m_nullableStringLongRecord;
63 Vector<std::pair<String, String>> m_byteStringByteStringRecord;
64 HeapVector<std::pair<String, Member<Element>>> m_stringElementRecord;
65 NestedRecordType m_USVStringUSVStringBooleanRecordRecord;
66 };
67
68 } // namespace blink
69
70 #endif // RecordTest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698