| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Paul Pedriana <ppedriana@ea.com>. All rights reserve
d. | 2 * Copyright (C) 2008, 2009 Paul Pedriana <ppedriana@ea.com>. All rights reserve
d. |
| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // | 42 // |
| 43 // struct Data { | 43 // struct Data { |
| 44 // WTF_MAKE_FAST_ALLOCATED | 44 // WTF_MAKE_FAST_ALLOCATED |
| 45 // public: | 45 // public: |
| 46 // ... | 46 // ... |
| 47 // }; | 47 // }; |
| 48 // | 48 // |
| 49 | 49 |
| 50 #include <new> | 50 #include <new> |
| 51 #include <stdint.h> | 51 #include <stdint.h> |
| 52 #include <wtf/Assertions.h> | 52 #include "wtf/Assertions.h" |
| 53 #include <wtf/FastMalloc.h> | 53 #include "wtf/FastMalloc.h" |
| 54 #include <wtf/StdLibExtras.h> | 54 #include "wtf/StdLibExtras.h" |
| 55 | 55 |
| 56 // This needs to exist because some classes (e.g. StringImpl) want to use | 56 // This needs to exist because some classes (e.g. StringImpl) want to use |
| 57 // fastMalloc() to return an object pointer and then have it deleted (as | 57 // fastMalloc() to return an object pointer and then have it deleted (as |
| 58 // opposed to free'd) by the RefPtr machinery. | 58 // opposed to free'd) by the RefPtr machinery. |
| 59 #define NEW_DELETE_SAME_AS_MALLOC_FREE \ | 59 #define NEW_DELETE_SAME_AS_MALLOC_FREE \ |
| 60 public: \ | 60 public: \ |
| 61 void* operator new(size_t, void* p) { return p; } \ | 61 void* operator new(size_t, void* p) { return p; } \ |
| 62 void* operator new[](size_t, void* p) { return p; } \ | 62 void* operator new[](size_t, void* p) { return p; } \ |
| 63 \ | 63 \ |
| 64 void* operator new(size_t size) \ | 64 void* operator new(size_t size) \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 94 private: \ | 94 private: \ |
| 95 typedef int __thisIsHereToForceASemicolonAfterThisMacro | 95 typedef int __thisIsHereToForceASemicolonAfterThisMacro |
| 96 | 96 |
| 97 #if !USE(SYSTEM_MALLOC) | 97 #if !USE(SYSTEM_MALLOC) |
| 98 #define WTF_MAKE_FAST_ALLOCATED NEW_DELETE_SAME_AS_MALLOC_FREE | 98 #define WTF_MAKE_FAST_ALLOCATED NEW_DELETE_SAME_AS_MALLOC_FREE |
| 99 #else | 99 #else |
| 100 #define WTF_MAKE_FAST_ALLOCATED | 100 #define WTF_MAKE_FAST_ALLOCATED |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 #endif // FastAllocBase_h | 103 #endif // FastAllocBase_h |
| OLD | NEW |