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 5306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5394 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) | 5392 TEST(HeapTest, NonNodeAllocatingNodeInDestructor) |
5395 { | 5393 { |
5396 new NonNodeAllocatingNodeInDestructor(); | 5394 new NonNodeAllocatingNodeInDestructor(); |
5397 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 5395 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
5398 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); | 5396 EXPECT_EQ(10, (*NonNodeAllocatingNodeInDestructor::s_node)->value()); |
5399 delete NonNodeAllocatingNodeInDestructor::s_node; | 5397 delete NonNodeAllocatingNodeInDestructor::s_node; |
5400 NonNodeAllocatingNodeInDestructor::s_node = 0; | 5398 NonNodeAllocatingNodeInDestructor::s_node = 0; |
5401 } | 5399 } |
5402 | 5400 |
5403 } // namespace blink | 5401 } // namespace blink |
OLD | NEW |