OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebCommon_h | 31 #ifndef WebCommon_h |
32 #define WebCommon_h | 32 #define WebCommon_h |
33 | 33 |
34 // ----------------------------------------------------------------------------- | |
35 // Default configuration | |
36 | |
37 #if !defined(WEBKIT_IMPLEMENTATION) | 34 #if !defined(WEBKIT_IMPLEMENTATION) |
38 #define WEBKIT_IMPLEMENTATION 0 | 35 #define WEBKIT_IMPLEMENTATION 0 |
39 #endif | 36 #endif |
40 | 37 |
41 // ----------------------------------------------------------------------------- | 38 #if defined(WEBKIT_DLL) |
42 // Exported symbols need to be annotated with WEBKIT_EXPORT | 39 #if defined(WIN32) |
| 40 #if WEBKIT_IMPLEMENTATION |
| 41 #define WEBKIT_EXPORT __declspec(dllexport) |
| 42 #else // WEBKIT_IMPLEMENTATION |
| 43 #define WEBKIT_EXPORT __declspec(dllimport) |
| 44 #endif |
| 45 #else // defined(WIN32) |
| 46 #define WEBKIT_EXPORT __attribute__((visibility("default"))) |
| 47 #endif |
| 48 #else // defined(WEBKIT_DLL) |
| 49 #define WEBKIT_EXPORT |
| 50 #endif |
43 | 51 |
44 #if defined(WEBKIT_DLL) | 52 #if !defined(BLINK_COMMON_IMPLEMENTATION) |
45 #if defined(WIN32) | 53 #define BLINK_COMMON_IMPLEMENTATION 0 |
46 #if WEBKIT_IMPLEMENTATION | |
47 #define WEBKIT_EXPORT __declspec(dllexport) | |
48 #else | |
49 #define WEBKIT_EXPORT __declspec(dllimport) | |
50 #endif | |
51 #else | |
52 #define WEBKIT_EXPORT __attribute__((visibility("default"))) | |
53 #endif | |
54 #else | |
55 #define WEBKIT_EXPORT | |
56 #endif | 54 #endif |
57 | 55 |
| 56 #if defined(COMPONENT_BUILD) |
| 57 #if defined(WIN32) |
| 58 #if BLINK_COMMON_IMPLEMENTATION |
| 59 #define BLINK_COMMON_EXPORT __declspec(dllexport) |
| 60 #else // BLINK_COMMON_IMPLEMENTATION |
| 61 #define BLINK_COMMON_EXPORT __declspec(dllimport) |
| 62 #endif |
| 63 #else // defined(WIN32) |
| 64 #define BLINK_COMMON_EXPORT __attribute__((visibility("default"))) |
| 65 #endif |
| 66 #else // defined(COMPONENT_BUILD) |
| 67 #define BLINK_COMMON_EXPORT |
| 68 #endif |
| 69 |
| 70 |
58 // ----------------------------------------------------------------------------- | 71 // ----------------------------------------------------------------------------- |
59 // Basic types | 72 // Basic types |
60 | 73 |
61 #include <stddef.h> // For size_t | 74 #include <stddef.h> // For size_t |
62 | 75 |
63 #if defined(WIN32) | 76 #if defined(WIN32) |
64 // Visual Studio doesn't have stdint.h. | 77 // Visual Studio doesn't have stdint.h. |
65 typedef short int16_t; | 78 typedef short int16_t; |
66 typedef unsigned short uint16_t; | 79 typedef unsigned short uint16_t; |
67 typedef int int32_t; | 80 typedef int int32_t; |
68 typedef unsigned int uint32_t; | 81 typedef unsigned int uint32_t; |
69 #endif | 82 #endif |
70 | 83 |
71 namespace WebKit { | 84 namespace WebKit { |
72 | 85 |
73 // UTF-16 character type | 86 // UTF-16 character type |
74 #if defined(WIN32) | 87 #if defined(WIN32) |
75 typedef wchar_t WebUChar; | 88 typedef wchar_t WebUChar; |
76 #else | 89 #else |
77 typedef unsigned short WebUChar; | 90 typedef unsigned short WebUChar; |
78 #endif | 91 #endif |
79 | 92 |
80 // Latin-1 character type | 93 // Latin-1 character type |
81 typedef unsigned char WebLChar; | 94 typedef unsigned char WebLChar; |
82 | 95 |
83 // ----------------------------------------------------------------------------- | 96 // ----------------------------------------------------------------------------- |
84 // Assertions | 97 // Assertions |
85 | 98 |
86 WEBKIT_EXPORT void failedAssertion(const char* file, int line, const char* funct
ion, const char* assertion); | 99 BLINK_COMMON_EXPORT void failedAssertion(const char* file, int line, const char*
function, const char* assertion); |
87 | 100 |
88 } // namespace WebKit | 101 } // namespace WebKit |
89 | 102 |
90 // Ideally, only use inside the public directory but outside of WEBKIT_IMPLEMENT
ATION blocks. (Otherwise use WTF's ASSERT.) | 103 // Ideally, only use inside the public directory but outside of INSIDE_WEBKIT bl
ocks. (Otherwise use WTF's ASSERT.) |
91 #if defined(NDEBUG) | 104 #if defined(NDEBUG) |
92 #define WEBKIT_ASSERT(assertion) ((void)0) | 105 #define WEBKIT_ASSERT(assertion) ((void)0) |
93 #else | 106 #else |
94 #define WEBKIT_ASSERT(assertion) do { \ | 107 #define WEBKIT_ASSERT(assertion) do { \ |
95 if (!(assertion)) \ | 108 if (!(assertion)) \ |
96 failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ | 109 failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ |
97 } while (0) | 110 } while (0) |
98 #endif | 111 #endif |
99 | 112 |
100 #define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0) | 113 #define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0) |
101 | 114 |
102 #endif | 115 #endif |
OLD | NEW |