summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/bindings/union_base.h
blob: 7db607574975df3c8fe170f96542f5bc15e8f792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_UNION_BASE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_UNION_BASE_H_

#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "v8/include/v8.h"

namespace blink {

class Visitor;

namespace bindings {

// This class is the base class for all IDL dictionary implementations.  This
// is designed to collaborate with NativeValueTraits and ToV8 with supporting
// type dispatching (SFINAE, etc.).
class PLATFORM_EXPORT UnionBase {
  DISALLOW_NEW();

 public:
  virtual ~UnionBase() = default;

  virtual v8::Local<v8::Value> CreateV8Object(
      v8::Isolate* isolate,
      v8::Local<v8::Object> creation_context) const = 0;

  void Trace(Visitor*) const {}

 protected:
  UnionBase() = default;
  UnionBase(const UnionBase&) = default;
  UnionBase(UnionBase&&) = default;
  UnionBase& operator=(const UnionBase&) = default;
  UnionBase& operator=(UnionBase&&) = default;
};

}  // namespace bindings

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_UNION_BASE_H_