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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/StringOrArrayBufferOrArrayBufferView.h

Issue 1961883002: Generate separate files for union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 2014 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #ifndef StringOrArrayBufferOrArrayBufferView_h
8 #define StringOrArrayBufferOrArrayBufferView_h
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/V8Binding.h"
13 #include "core/CoreExport.h"
14 #include "platform/heap/Handle.h"
15
16 namespace blink {
17
18 class TestArrayBuffer;
19 class TestArrayBufferView;
20
21 class CORE_EXPORT StringOrArrayBufferOrArrayBufferView final {
22 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
23 public:
24 StringOrArrayBufferOrArrayBufferView();
25 bool isNull() const { return m_type == SpecificTypeNone; }
26
27 bool isString() const { return m_type == SpecificTypeString; }
28 String getAsString() const;
29 void setString(String);
30 static StringOrArrayBufferOrArrayBufferView fromString(String);
31
32 bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; }
33 TestArrayBuffer* getAsArrayBuffer() const;
34 void setArrayBuffer(TestArrayBuffer*);
35 static StringOrArrayBufferOrArrayBufferView fromArrayBuffer(TestArrayBuffer* );
36
37 bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferVie w; }
38 TestArrayBufferView* getAsArrayBufferView() const;
39 void setArrayBufferView(TestArrayBufferView*);
40 static StringOrArrayBufferOrArrayBufferView fromArrayBufferView(TestArrayBuf ferView*);
41
42 StringOrArrayBufferOrArrayBufferView(const StringOrArrayBufferOrArrayBufferV iew&);
43 ~StringOrArrayBufferOrArrayBufferView();
44 StringOrArrayBufferOrArrayBufferView& operator=(const StringOrArrayBufferOrA rrayBufferView&);
45 DECLARE_TRACE();
46
47 private:
48 enum SpecificTypes {
49 SpecificTypeNone,
50 SpecificTypeString,
51 SpecificTypeArrayBuffer,
52 SpecificTypeArrayBufferView,
53 };
54 SpecificTypes m_type;
55
56 String m_string;
57 Member<TestArrayBuffer> m_arrayBuffer;
58 Member<TestArrayBufferView> m_arrayBufferView;
59
60 friend CORE_EXPORT v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArra yBufferView&, v8::Local<v8::Object>, v8::Isolate*);
61 };
62
63 class V8StringOrArrayBufferOrArrayBufferView final {
64 public:
65 CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrA rrayBufferOrArrayBufferView&, UnionTypeConversionMode, ExceptionState&);
66 };
67
68 CORE_EXPORT v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView &, v8::Local<v8::Object>, v8::Isolate*);
69
70 template <class CallbackInfo>
71 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrArrayBuff erOrArrayBufferView& impl)
72 {
73 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
74 }
75
76 template <>
77 struct NativeValueTraits<StringOrArrayBufferOrArrayBufferView> {
78 CORE_EXPORT static StringOrArrayBufferOrArrayBufferView nativeValue(v8::Isol ate*, v8::Local<v8::Value>, ExceptionState&);
79 };
80
81 } // namespace blink
82
83 // We need to set canInitializeWithMemset=true because HeapVector supports
84 // items that can initialize with memset or have a vtable. It is safe to
85 // set canInitializeWithMemset=true for a union type object in practice.
86 // See https://codereview.chromium.org/1118993002/#msg5 for more details.
87 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::StringOrArrayBufferOrArrayBuff erView);
88
89 #endif // StringOrArrayBufferOrArrayBufferView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698