| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can | 1394 // DISALLOW_ALLOCATION(): Cannot be allocated with new operators but can |
| 1395 // be a part object. If it has Members you need a trace method and the | 1395 // be a part object. If it has Members you need a trace method and the |
| 1396 // containing object needs to call that trace method. | 1396 // containing object needs to call that trace method. |
| 1397 // | 1397 // |
| 1398 // ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator. | 1398 // ALLOW_ONLY_INLINE_ALLOCATION(): Allows only placement new operator. |
| 1399 // This disallows general allocation of this object but allows to put | 1399 // This disallows general allocation of this object but allows to put |
| 1400 // the object as a value object in collections. If these have Members you | 1400 // the object as a value object in collections. If these have Members you |
| 1401 // need to have a trace method. That trace method will be called | 1401 // need to have a trace method. That trace method will be called |
| 1402 // automatically by the Heap collections. | 1402 // automatically by the Heap collections. |
| 1403 // | 1403 // |
| 1404 #if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) | |
| 1405 #define DISALLOW_ALLOCATION() \ | 1404 #define DISALLOW_ALLOCATION() \ |
| 1406 private: \ | 1405 private: \ |
| 1407 void* operator new(size_t) = delete; \ | 1406 void* operator new(size_t) = delete; \ |
| 1408 void* operator new(size_t, NotNullTag, void*) = delete; \ | 1407 void* operator new(size_t, NotNullTag, void*) = delete; \ |
| 1409 void* operator new(size_t, void*) = delete; | 1408 void* operator new(size_t, void*) = delete; |
| 1410 | 1409 |
| 1411 #define ALLOW_ONLY_INLINE_ALLOCATION()
\ | 1410 #define ALLOW_ONLY_INLINE_ALLOCATION()
\ |
| 1412 public:
\ | 1411 public:
\ |
| 1413 void* operator new(size_t, NotNullTag, void* location) { return location
; } \ | 1412 void* operator new(size_t, NotNullTag, void* location) { return location
; } \ |
| 1414 void* operator new(size_t, void* location) { return location; }
\ | 1413 void* operator new(size_t, void* location) { return location; }
\ |
| 1415 private:
\ | 1414 private:
\ |
| 1416 void* operator new(size_t) = delete; | 1415 void* operator new(size_t) = delete; |
| 1417 | 1416 |
| 1418 #define STATIC_ONLY(Type) \ | 1417 #define STATIC_ONLY(Type) \ |
| 1419 private: \ | 1418 private: \ |
| 1420 Type() = delete; | 1419 Type() = delete; |
| 1421 | 1420 |
| 1422 #else | |
| 1423 | |
| 1424 #define DISALLOW_ALLOCATION() \ | |
| 1425 private: \ | |
| 1426 void* operator new(size_t); \ | |
| 1427 void* operator new(size_t, NotNullTag, void*); \ | |
| 1428 void* operator new(size_t, void*) | |
| 1429 | |
| 1430 #define ALLOW_ONLY_INLINE_ALLOCATION()
\ | |
| 1431 public:
\ | |
| 1432 void* operator new(size_t, NotNullTag, void* location) { return location
; } \ | |
| 1433 void* operator new(size_t, void* location) { return location; }
\ | |
| 1434 private:
\ | |
| 1435 void* operator new(size_t); | |
| 1436 | |
| 1437 #define STATIC_ONLY(Type) \ | |
| 1438 private: \ | |
| 1439 Type(); | |
| 1440 | |
| 1441 #endif | |
| 1442 | |
| 1443 | |
| 1444 // These macros insert annotations that the Blink GC plugin for clang uses for | 1421 // These macros insert annotations that the Blink GC plugin for clang uses for |
| 1445 // verification. STACK_ALLOCATED is used to declare that objects of this type | 1422 // verification. STACK_ALLOCATED is used to declare that objects of this type |
| 1446 // are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin | 1423 // are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin |
| 1447 // ignore a particular class or field when checking for proper usage. When using | 1424 // ignore a particular class or field when checking for proper usage. When using |
| 1448 // GC_PLUGIN_IGNORE a bug-number should be provided as an argument where the | 1425 // GC_PLUGIN_IGNORE a bug-number should be provided as an argument where the |
| 1449 // bug describes what needs to happen to remove the GC_PLUGIN_IGNORE again. | 1426 // bug describes what needs to happen to remove the GC_PLUGIN_IGNORE again. |
| 1450 #if COMPILER(CLANG) | 1427 #if COMPILER(CLANG) |
| 1451 #define STACK_ALLOCATED() \ | 1428 #define STACK_ALLOCATED() \ |
| 1452 private: \ | 1429 private: \ |
| 1453 __attribute__((annotate("blink_stack_allocated"))) \ | 1430 __attribute__((annotate("blink_stack_allocated"))) \ |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 }; | 2534 }; |
| 2558 | 2535 |
| 2559 template<typename T> | 2536 template<typename T> |
| 2560 struct IfWeakMember<WeakMember<T> > { | 2537 struct IfWeakMember<WeakMember<T> > { |
| 2561 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } | 2538 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } |
| 2562 }; | 2539 }; |
| 2563 | 2540 |
| 2564 } | 2541 } |
| 2565 | 2542 |
| 2566 #endif // Heap_h | 2543 #endif // Heap_h |
| OLD | NEW |