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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); | 217 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); |
218 } | 218 } |
219 | 219 |
220 static ThreadState* fromObject(const void*); | 220 static ThreadState* fromObject(const void*); |
221 | 221 |
222 bool isMainThread() const { return this == mainThreadState(); } | 222 bool isMainThread() const { return this == mainThreadState(); } |
223 #if ENABLE(ASSERT) | 223 #if ENABLE(ASSERT) |
224 bool checkThread() const { return m_thread == currentThread(); } | 224 bool checkThread() const { return m_thread == currentThread(); } |
225 #endif | 225 #endif |
226 | 226 |
227 ThreadHeap& heap() { return *m_heap; } | 227 ThreadHeap& heap() const { return *m_heap; } |
228 | 228 |
229 // When ThreadState is detaching from non-main thread its | 229 // When ThreadState is detaching from non-main thread its |
230 // heap is expected to be empty (because it is going away). | 230 // heap is expected to be empty (because it is going away). |
231 // Perform registered cleanup tasks and garbage collection | 231 // Perform registered cleanup tasks and garbage collection |
232 // to sweep away any objects that are left on this heap. | 232 // to sweep away any objects that are left on this heap. |
233 // We assert that nothing must remain after this cleanup. | 233 // We assert that nothing must remain after this cleanup. |
234 // If assertion does not hold we crash as we are potentially | 234 // If assertion does not hold we crash as we are potentially |
235 // in the dangling pointer situation. | 235 // in the dangling pointer situation. |
236 void runTerminationGC(); | 236 void runTerminationGC(); |
237 | 237 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 706 |
707 template<> class ThreadStateFor<AnyThread> { | 707 template<> class ThreadStateFor<AnyThread> { |
708 STATIC_ONLY(ThreadStateFor); | 708 STATIC_ONLY(ThreadStateFor); |
709 public: | 709 public: |
710 static ThreadState* state() { return ThreadState::current(); } | 710 static ThreadState* state() { return ThreadState::current(); } |
711 }; | 711 }; |
712 | 712 |
713 } // namespace blink | 713 } // namespace blink |
714 | 714 |
715 #endif // ThreadState_h | 715 #endif // ThreadState_h |
OLD | NEW |