| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 #if !defined(BLINK_PLATFORM_IMPLEMENTATION) | 38 #if !defined(BLINK_PLATFORM_IMPLEMENTATION) |
| 39 #define BLINK_PLATFORM_IMPLEMENTATION 0 | 39 #define BLINK_PLATFORM_IMPLEMENTATION 0 |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #if !defined(BLINK_COMMON_IMPLEMENTATION) | 42 #if !defined(BLINK_COMMON_IMPLEMENTATION) |
| 43 #define BLINK_COMMON_IMPLEMENTATION 0 | 43 #define BLINK_COMMON_IMPLEMENTATION 0 |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if defined(COMPONENT_BUILD) | 46 #if defined(COMPONENT_BUILD) |
| 47 #define BLINK_EXPORT __attribute__((visibility("default"))) | 47 #if defined(WIN32) |
| 48 #define BLINK_PLATFORM_EXPORT __attribute__((visibility("default"))) | 48 #if BLINK_IMPLEMENTATION |
| 49 #define BLINK_COMMON_EXPORT __attribute__((visibility("default"))) | 49 #define BLINK_EXPORT __declspec(dllexport) |
| 50 #else // BLINK_IMPLEMENTATION |
| 51 #define BLINK_EXPORT __declspec(dllimport) |
| 52 #endif |
| 53 #if BLINK_PLATFORM_IMPLEMENTATION |
| 54 #define BLINK_PLATFORM_EXPORT __declspec(dllexport) |
| 55 #else // BLINK_PLATFORM_IMPLEMENTATION |
| 56 #define BLINK_PLATFORM_EXPORT __declspec(dllimport) |
| 57 #endif |
| 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_EXPORT __attribute__((visibility("default"))) |
| 65 #define BLINK_PLATFORM_EXPORT __attribute__((visibility("default"))) |
| 66 #define BLINK_COMMON_EXPORT __attribute__((visibility("default"))) |
| 67 #endif |
| 50 #else // defined(COMPONENT_BUILD) | 68 #else // defined(COMPONENT_BUILD) |
| 51 #define BLINK_EXPORT | 69 #define BLINK_EXPORT |
| 52 #define BLINK_PLATFORM_EXPORT | 70 #define BLINK_PLATFORM_EXPORT |
| 53 #define BLINK_COMMON_EXPORT | 71 #define BLINK_COMMON_EXPORT |
| 54 #endif | 72 #endif |
| 55 | 73 |
| 56 | 74 |
| 57 // ----------------------------------------------------------------------------- | 75 // ----------------------------------------------------------------------------- |
| 58 // Basic types | 76 // Basic types |
| 59 | 77 |
| 60 #include <stddef.h> // For size_t | 78 #include <stddef.h> // For size_t |
| 79 |
| 80 #if defined(WIN32) |
| 81 // Visual Studio doesn't have stdint.h. |
| 82 typedef short int16_t; |
| 83 typedef unsigned short uint16_t; |
| 84 typedef int int32_t; |
| 85 typedef unsigned int uint32_t; |
| 86 typedef unsigned __int64 uint64_t; |
| 87 #else |
| 61 #include <stdint.h> // For int32_t | 88 #include <stdint.h> // For int32_t |
| 89 #endif |
| 62 | 90 |
| 63 namespace blink { | 91 namespace blink { |
| 64 | 92 |
| 65 // UTF-32 character type | 93 // UTF-32 character type |
| 66 typedef int32_t WebUChar32; | 94 typedef int32_t WebUChar32; |
| 67 | 95 |
| 68 // UTF-16 character type | 96 // UTF-16 character type |
| 97 #if defined(WIN32) |
| 98 typedef wchar_t WebUChar; |
| 99 #else |
| 69 typedef unsigned short WebUChar; | 100 typedef unsigned short WebUChar; |
| 101 #endif |
| 70 | 102 |
| 71 // Latin-1 character type | 103 // Latin-1 character type |
| 72 typedef unsigned char WebLChar; | 104 typedef unsigned char WebLChar; |
| 73 | 105 |
| 74 // ----------------------------------------------------------------------------- | 106 // ----------------------------------------------------------------------------- |
| 75 // Assertions | 107 // Assertions |
| 76 | 108 |
| 77 BLINK_COMMON_EXPORT void failedAssertion(const char* file, int line, const char*
function, const char* assertion); | 109 BLINK_COMMON_EXPORT void failedAssertion(const char* file, int line, const char*
function, const char* assertion); |
| 78 | 110 |
| 79 } // namespace blink | 111 } // namespace blink |
| 80 | 112 |
| 81 // Ideally, only use inside the public directory but outside of INSIDE_BLINK blo
cks. (Otherwise use WTF's ASSERT.) | 113 // Ideally, only use inside the public directory but outside of INSIDE_BLINK blo
cks. (Otherwise use WTF's ASSERT.) |
| 82 #if defined(NDEBUG) | 114 #if defined(NDEBUG) |
| 83 #define BLINK_ASSERT(assertion) ((void)0) | 115 #define BLINK_ASSERT(assertion) ((void)0) |
| 84 #else | 116 #else |
| 85 #define BLINK_ASSERT(assertion) do { \ | 117 #define BLINK_ASSERT(assertion) do { \ |
| 86 if (!(assertion)) \ | 118 if (!(assertion)) \ |
| 87 failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ | 119 failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ |
| 88 } while (0) | 120 } while (0) |
| 89 #endif | 121 #endif |
| 90 | 122 |
| 91 #define BLINK_ASSERT_NOT_REACHED() BLINK_ASSERT(0) | 123 #define BLINK_ASSERT_NOT_REACHED() BLINK_ASSERT(0) |
| 92 | 124 |
| 93 #endif | 125 #endif |
| OLD | NEW |