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