OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ | 5 #ifndef IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ |
6 #define IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ | 6 #define IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
10 | 13 |
11 #define ALWAYS_INLINE inline __attribute__((always_inline)) | 14 #define ALWAYS_INLINE inline __attribute__((always_inline)) |
12 | 15 |
13 #define DEFINE_STATIC_LOCAL_STRING(name, arguments) \ | 16 #define DEFINE_STATIC_LOCAL_STRING(name, arguments) \ |
14 static const WebCore::LChar* name = (const WebCore::LChar*)arguments; \ | 17 static const WebCore::LChar* name = (const WebCore::LChar*)arguments; \ |
15 static const size_t name##Length = (arraysize(arguments) - 1); \ | 18 static const size_t name##Length = (arraysize(arguments) - 1); \ |
16 DCHECK(name##Length == strlen((const char*)name)) | 19 DCHECK(name##Length == strlen((const char*)name)) |
17 | 20 |
18 #define WTF_MAKE_NONCOPYABLE(x) DISALLOW_COPY_AND_ASSIGN(x) | 21 #define WTF_MAKE_NONCOPYABLE(x) DISALLOW_COPY_AND_ASSIGN(x) |
19 | 22 |
20 #define ASSERT(x) DCHECK(x) | 23 #define ASSERT(x) DCHECK(x) |
21 #define ASSERT_NOT_REACHED NOTREACHED | 24 #define ASSERT_NOT_REACHED NOTREACHED |
22 | 25 |
23 #define notImplemented() | 26 #define notImplemented() |
24 | 27 |
25 namespace WebCore { | 28 namespace WebCore { |
26 typedef uint16 UChar; | 29 typedef uint16_t UChar; |
27 typedef uint8 LChar; | 30 typedef uint8_t LChar; |
28 | 31 |
29 template <typename CharType> | 32 template <typename CharType> |
30 inline bool isASCIIUpper(CharType c) { | 33 inline bool isASCIIUpper(CharType c) { |
31 return c >= 'A' && c <= 'Z'; | 34 return c >= 'A' && c <= 'Z'; |
32 } | 35 } |
33 | 36 |
34 template <typename CharType> | 37 template <typename CharType> |
35 inline bool isASCIILower(CharType c) { | 38 inline bool isASCIILower(CharType c) { |
36 return c >= 'a' && c <= 'z'; | 39 return c >= 'a' && c <= 'z'; |
37 } | 40 } |
38 | 41 |
39 template <typename CharType> | 42 template <typename CharType> |
40 inline CharType toLowerCase(CharType c) { | 43 inline CharType toLowerCase(CharType c) { |
41 ASSERT(isASCIIUpper(c)); | 44 ASSERT(isASCIIUpper(c)); |
42 const int lowerCaseOffset = 0x20; | 45 const int lowerCaseOffset = 0x20; |
43 return c + lowerCaseOffset; | 46 return c + lowerCaseOffset; |
44 } | 47 } |
45 | 48 |
46 inline UChar ByteSwap(UChar c) { | 49 inline UChar ByteSwap(UChar c) { |
47 return ((c & 0x00ff) << 8) | ((c & 0xff00) >> 8); | 50 return ((c & 0x00ff) << 8) | ((c & 0xff00) >> 8); |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
51 #endif // IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ | 54 #endif // IOS_THIRD_PARTY_BLINK_SRC_TOKENIZER_ADAPTER_H_ |
OLD | NEW |