| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 TestTypedHeapClass() { } | 522 TestTypedHeapClass() { } |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 class Bar : public GarbageCollectedFinalized<Bar> { | 525 class Bar : public GarbageCollectedFinalized<Bar> { |
| 526 public: | 526 public: |
| 527 static Bar* create() | 527 static Bar* create() |
| 528 { | 528 { |
| 529 return new Bar(); | 529 return new Bar(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 void finalize() | 532 void finalizeGarbageCollectedObject() |
| 533 { | 533 { |
| 534 EXPECT_TRUE(m_magic == magic); | 534 EXPECT_TRUE(m_magic == magic); |
| 535 m_magic = 0; | 535 m_magic = 0; |
| 536 s_live--; | 536 s_live--; |
| 537 } | 537 } |
| 538 bool hasBeenFinalized() const { return !m_magic; } | 538 bool hasBeenFinalized() const { return !m_magic; } |
| 539 | 539 |
| 540 virtual void trace(Visitor* visitor) { } | 540 virtual void trace(Visitor* visitor) { } |
| 541 static unsigned s_live; | 541 static unsigned s_live; |
| 542 | 542 |
| (...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 // swept away and zapped later in the same sweeping phase. | 3006 // swept away and zapped later in the same sweeping phase. |
| 3007 EXPECT_EQ(42, wrapper->value()); | 3007 EXPECT_EQ(42, wrapper->value()); |
| 3008 | 3008 |
| 3009 wrapper.clear(); | 3009 wrapper.clear(); |
| 3010 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3010 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3011 EXPECT_EQ(10, IntWrapper::s_destructorCalls); | 3011 EXPECT_EQ(10, IntWrapper::s_destructorCalls); |
| 3012 EXPECT_EQ(512, OneKiloByteObject::s_destructorCalls); | 3012 EXPECT_EQ(512, OneKiloByteObject::s_destructorCalls); |
| 3013 } | 3013 } |
| 3014 | 3014 |
| 3015 } // WebCore namespace | 3015 } // WebCore namespace |
| OLD | NEW |