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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/modules/UnionTypesModules.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 UnionTypeModules_h
8 #define UnionTypeModules_h
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/UnionTypesCore.h"
13 #include "bindings/core/v8/V8Binding.h"
14 #include "modules/ModulesExport.h"
15 #include "platform/heap/Handle.h"
16
17 namespace blink {
18
19
20 class MODULES_EXPORT BooleanOrString final {
21 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
22 public:
23 BooleanOrString();
24 bool isNull() const { return m_type == SpecificTypeNone; }
25
26 bool isBoolean() const { return m_type == SpecificTypeBoolean; }
27 bool getAsBoolean() const;
28 void setBoolean(bool);
29 static BooleanOrString fromBoolean(bool);
30
31 bool isString() const { return m_type == SpecificTypeString; }
32 String getAsString() const;
33 void setString(String);
34 static BooleanOrString fromString(String);
35
36 BooleanOrString(const BooleanOrString&);
37 ~BooleanOrString();
38 BooleanOrString& operator=(const BooleanOrString&);
39 DECLARE_TRACE();
40
41 private:
42 enum SpecificTypes {
43 SpecificTypeNone,
44 SpecificTypeBoolean,
45 SpecificTypeString,
46 };
47 SpecificTypes m_type;
48
49 bool m_boolean;
50 String m_string;
51
52 friend MODULES_EXPORT v8::Local<v8::Value> toV8(const BooleanOrString&, v8:: Local<v8::Object>, v8::Isolate*);
53 };
54
55 class V8BooleanOrString final {
56 public:
57 MODULES_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, Boolea nOrString&, UnionTypeConversionMode, ExceptionState&);
58 };
59
60 MODULES_EXPORT v8::Local<v8::Value> toV8(const BooleanOrString&, v8::Local<v8::O bject>, v8::Isolate*);
61
62 template <class CallbackInfo>
63 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, BooleanOrString& impl)
64 {
65 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
66 }
67
68 template <>
69 struct NativeValueTraits<BooleanOrString> {
70 MODULES_EXPORT static BooleanOrString nativeValue(v8::Isolate*, v8::Local<v8 ::Value>, ExceptionState&);
71 };
72
73 } // namespace blink
74
75 // We need to set canInitializeWithMemset=true because HeapVector supports
76 // items that can initialize with memset or have a vtable. It is safe to
77 // set canInitializeWithMemset=true for a union type object in practice.
78 // See https://codereview.chromium.org/1118993002/#msg5 for more details.
79 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::BooleanOrString);
80
81 #endif // UnionTypeModules_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698