Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: Source/heap/ThreadState.h

Issue 187483002: Oilpan: We need to collect all garbage before shutting down the worker thread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 static void shutdown(); 231 static void shutdown();
232 232
233 // Trace all GC roots, called when marking the managed heap objects. 233 // Trace all GC roots, called when marking the managed heap objects.
234 static void visitRoots(Visitor*); 234 static void visitRoots(Visitor*);
235 235
236 // Associate ThreadState object with the current thread. After this 236 // Associate ThreadState object with the current thread. After this
237 // call thread can start using the garbage collected heap infrastructure. 237 // call thread can start using the garbage collected heap infrastructure.
238 // It also has to periodically check for safepoints. 238 // It also has to periodically check for safepoints.
239 static void attach(); 239 static void attach();
240 240
241 // When ThreadState is detaching from non-main thread its
Mads Ager (chromium) 2014/03/05 07:40:34 Please keep this comment.
242 // heap is expected to be empty (because it is going away).
243 // Perform registered cleanup tasks and garbage collection
244 // to sweep away any objects that are left on this heap.
245 // We assert that nothing must remain after this cleanup.
246 // If assertion does not hold we crash as we are potentially
247 // in the dangling pointer situation.
248 void cleanup();
249
250 // Disassociate attached ThreadState from the current thread. The thread 241 // Disassociate attached ThreadState from the current thread. The thread
251 // can no longer use the garbage collected heap after this call. 242 // can no longer use the garbage collected heap after this call.
252 static void detach(); 243 static void detach();
253 244
254 static ThreadState* current() { return **s_threadSpecific; } 245 static ThreadState* current() { return **s_threadSpecific; }
255 static ThreadState* mainThreadState() 246 static ThreadState* mainThreadState()
256 { 247 {
257 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); 248 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage);
258 } 249 }
259 250
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 friend class SafePointBarrier; 485 friend class SafePointBarrier;
495 486
496 void enterSafePoint(StackState, void*); 487 void enterSafePoint(StackState, void*);
497 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 488 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
498 void clearSafePointScopeMarker() 489 void clearSafePointScopeMarker()
499 { 490 {
500 m_safePointStackCopy.clear(); 491 m_safePointStackCopy.clear();
501 m_safePointScopeMarker = 0; 492 m_safePointScopeMarker = 0;
502 } 493 }
503 494
495 void cleanup();
496
504 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; 497 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific;
505 static SafePointBarrier* s_safePointBarrier; 498 static SafePointBarrier* s_safePointBarrier;
506 499
507 // This variable is flipped to true after all threads are stoped 500 // This variable is flipped to true after all threads are stoped
508 // and outermost GC has started. 501 // and outermost GC has started.
509 static bool s_inGC; 502 static bool s_inGC;
510 503
511 // We can't create a static member of type ThreadState here 504 // We can't create a static member of type ThreadState here
512 // because it will introduce global constructor and destructor. 505 // because it will introduce global constructor and destructor.
513 // We would like to manage lifetime of the ThreadState attached 506 // We would like to manage lifetime of the ThreadState attached
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 }; 548 };
556 549
557 template<> class ThreadStateFor<AnyThread> { 550 template<> class ThreadStateFor<AnyThread> {
558 public: 551 public:
559 static ThreadState* state() { return ThreadState::current(); } 552 static ThreadState* state() { return ThreadState::current(); }
560 }; 553 };
561 554
562 } 555 }
563 556
564 #endif // ThreadState_h 557 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698