1 // Copyright 2018 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 PLATFORM_BASE_MACROS_H_
6 #define PLATFORM_BASE_MACROS_H_
7 
8 #ifdef DISALLOW_COPY
9 #define OSP_DISALLOW_COPY DISALLOW_COPY
10 #else
11 #define OSP_DISALLOW_COPY(ClassName) ClassName(const ClassName&) = delete
12 #endif
13 
14 #ifdef DISALLOW_ASSIGN
15 #define OSP_DISALLOW_ASSIGN DISALLOW_ASSIGN
16 #else
17 #define OSP_DISALLOW_ASSIGN(ClassName) \
18   ClassName& operator=(const ClassName&) = delete
19 #endif
20 
21 #ifdef DISALLOW_COPY_AND_ASSIGN
22 #define OSP_DISALLOW_COPY_AND_ASSIGN DISALLOW_COPY_AND_ASSIGN
23 #else
24 #define OSP_DISALLOW_COPY_AND_ASSIGN(ClassName) \
25   OSP_DISALLOW_COPY(ClassName);                 \
26   OSP_DISALLOW_ASSIGN(ClassName)
27 #endif
28 
29 #ifdef DISALLOW_IMPLICIT_CONSTRUCTORS
30 #define OSP_DISALLOW_IMPLICIT_CONSTRUCTORS DISALLOW_IMPLICIT_CONSTRUCTORS
31 #else
32 #define OSP_DISALLOW_IMPLICIT_CONSTRUCTORS(ClassName) \
33   ClassName() = delete;                               \
34   OSP_DISALLOW_COPY_AND_ASSIGN(ClassName)
35 #endif
36 
37 #ifdef NOINLINE
38 #define OSP_NOINLINE NOINLINE
39 #else
40 #define OSP_NOINLINE __attribute__((noinline))
41 #endif
42 
43 #endif  // PLATFORM_BASE_MACROS_H_
44