| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 unsigned hash() { return IntHash<int>::hash(m_x); } | 67 unsigned hash() { return IntHash<int>::hash(m_x); } |
| 68 | 68 |
| 69 IntWrapper(int x) : m_x(x) { } | 69 IntWrapper(int x) : m_x(x) { } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 IntWrapper(); | 72 IntWrapper(); |
| 73 int m_x; | 73 int m_x; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 USED_FROM_MULTIPLE_THREADS(IntWrapper); | |
| 77 | |
| 78 class ThreadMarker { | 76 class ThreadMarker { |
| 79 public: | 77 public: |
| 80 ThreadMarker() : m_creatingThread(reinterpret_cast<ThreadState*>(0)), m_num(
0) { } | 78 ThreadMarker() : m_creatingThread(reinterpret_cast<ThreadState*>(0)), m_num(
0) { } |
| 81 ThreadMarker(unsigned i) : m_creatingThread(ThreadState::current()), m_num(i
) { } | 79 ThreadMarker(unsigned i) : m_creatingThread(ThreadState::current()), m_num(i
) { } |
| 82 ThreadMarker(WTF::HashTableDeletedValueType deleted) : m_creatingThread(rein
terpret_cast<ThreadState*>(-1)), m_num(0) { } | 80 ThreadMarker(WTF::HashTableDeletedValueType deleted) : m_creatingThread(rein
terpret_cast<ThreadState*>(-1)), m_num(0) { } |
| 83 ~ThreadMarker() | 81 ~ThreadMarker() |
| 84 { | 82 { |
| 85 EXPECT_TRUE((m_creatingThread == ThreadState::current()) | 83 EXPECT_TRUE((m_creatingThread == ThreadState::current()) |
| 86 || (m_creatingThread == reinterpret_cast<ThreadState*>(0)) | 84 || (m_creatingThread == reinterpret_cast<ThreadState*>(0)) |
| 87 || (m_creatingThread == reinterpret_cast<ThreadState*>(-1))); | 85 || (m_creatingThread == reinterpret_cast<ThreadState*>(-1))); |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 Persistent<Node> typedHeapObject = Node::create(0); | 1725 Persistent<Node> typedHeapObject = Node::create(0); |
| 1728 EXPECT_NE(pageHeaderFromObject(generalHeapObject.get()), | 1726 EXPECT_NE(pageHeaderFromObject(generalHeapObject.get()), |
| 1729 pageHeaderFromObject(typedHeapObject.get())); | 1727 pageHeaderFromObject(typedHeapObject.get())); |
| 1730 } | 1728 } |
| 1731 | 1729 |
| 1732 TEST(HeapTest, NoAllocation) | 1730 TEST(HeapTest, NoAllocation) |
| 1733 { | 1731 { |
| 1734 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); | 1732 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); |
| 1735 { | 1733 { |
| 1736 // Disallow allocation | 1734 // Disallow allocation |
| 1737 NoAllocationScope<AnyThread> noAllocationScope; | 1735 NoAllocationScope<AnyThreadAffinity> noAllocationScope; |
| 1738 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed()); | 1736 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed()); |
| 1739 } | 1737 } |
| 1740 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); | 1738 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); |
| 1741 } | 1739 } |
| 1742 | 1740 |
| 1743 TEST(HeapTest, Members) | 1741 TEST(HeapTest, Members) |
| 1744 { | 1742 { |
| 1745 Bar::s_live = 0; | 1743 Bar::s_live = 0; |
| 1746 { | 1744 { |
| 1747 Persistent<Baz> h1; | 1745 Persistent<Baz> h1; |
| (...skipping 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5397 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) | 5395 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) |
| 5398 { | 5396 { |
| 5399 new NonNodeAllocatingNodeInDestructor(); | 5397 new NonNodeAllocatingNodeInDestructor(); |
| 5400 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 5398 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 5401 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); | 5399 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); |
| 5402 delete NonNodeAllocatingNodeInDestructor::s_node; | 5400 delete NonNodeAllocatingNodeInDestructor::s_node; |
| 5403 NonNodeAllocatingNodeInDestructor::s_node = 0; | 5401 NonNodeAllocatingNodeInDestructor::s_node = 0; |
| 5404 } | 5402 } |
| 5405 | 5403 |
| 5406 } // namespace blink | 5404 } // namespace blink |
| OLD | NEW |