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

Side by Side Diff: Source/platform/heap/Visitor.h

Issue 1149943003: Oilpan: Rename weak callback related methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void registerWeakCell(T** cell) 333 void registerWeakCell(T** cell)
334 { 334 {
335 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast <void**>(cell), &handleWeakCell<T>); 335 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast <void**>(cell), &handleWeakCell<T>);
336 } 336 }
337 337
338 template<typename T, void (T::*method)(Visitor*)> 338 template<typename T, void (T::*method)(Visitor*)>
339 void registerWeakMembers(const T* obj) 339 void registerWeakMembers(const T* obj)
340 { 340 {
341 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); 341 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline);
342 } 342 }
343 void registerWeakMembers(const void* object, WeakPointerCallback callback) 343 void registerWeakMembers(const void* object, WeakCallback callback)
344 { 344 {
345 Derived::fromHelper(this)->registerWeakMembers(object, object, callback) ; 345 Derived::fromHelper(this)->registerWeakMembers(object, object, callback) ;
346 } 346 }
347 347
348 template<typename T> inline bool isHeapObjectAlive(T* obj) 348 template<typename T> inline bool isHeapObjectAlive(T* obj)
349 { 349 {
350 static_assert(sizeof(T), "T must be fully defined"); 350 static_assert(sizeof(T), "T must be fully defined");
351 // The strongification of collections relies on the fact that once a 351 // The strongification of collections relies on the fact that once a
352 // collection has been strongified, there is no way that it can contain 352 // collection has been strongified, there is no way that it can contain
353 // non-live entries, so no entries will be removed. Since you can't set 353 // non-live entries, so no entries will be removed. Since you can't set
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Used to delay the marking of objects until the usual marking 412 // Used to delay the marking of objects until the usual marking
413 // including emphemeron iteration is done. This is used to delay 413 // including emphemeron iteration is done. This is used to delay
414 // the marking of collection backing stores until we know if they 414 // the marking of collection backing stores until we know if they
415 // are reachable from locations other than the collection front 415 // are reachable from locations other than the collection front
416 // object. If collection backings are reachable from other 416 // object. If collection backings are reachable from other
417 // locations we strongify them to avoid issues with iterators and 417 // locations we strongify them to avoid issues with iterators and
418 // weak processing. 418 // weak processing.
419 virtual void registerDelayedMarkNoTracing(const void*) = 0; 419 virtual void registerDelayedMarkNoTracing(const void*) = 0;
420 420
421 // If the object calls this during the regular trace callback, then the 421 // If the object calls this during the regular trace callback, then the
422 // WeakPointerCallback argument may be called later, when the strong roots 422 // WeakCallback argument may be called later, when the strong roots
423 // have all been found. The WeakPointerCallback will normally use isAlive 423 // have all been found. The WeakCallback will normally use isAlive
424 // to find out whether some pointers are pointing to dying objects. When 424 // to find out whether some pointers are pointing to dying objects. When
425 // the WeakPointerCallback is done the object must have purged all pointers 425 // the WeakCallback is done the object must have purged all pointers
426 // to objects where isAlive returned false. In the weak callback it is not 426 // to objects where isAlive returned false. In the weak callback it is not
427 // allowed to touch other objects (except using isAlive) or to allocate on 427 // allowed to touch other objects (except using isAlive) or to allocate on
428 // the GC heap. Note that even removing things from HeapHashSet or 428 // the GC heap. Note that even removing things from HeapHashSet or
429 // HeapHashMap can cause an allocation if the backing store resizes, but 429 // HeapHashMap can cause an allocation if the backing store resizes, but
430 // these collections know to remove WeakMember elements safely. 430 // these collections know to remove WeakMember elements safely.
431 // 431 //
432 // The weak pointer callbacks are run on the thread that owns the 432 // The weak pointer callbacks are run on the thread that owns the
433 // object and other threads are not stopped during the 433 // object and other threads are not stopped during the
434 // callbacks. Since isAlive is used in the callback to determine 434 // callbacks. Since isAlive is used in the callback to determine
435 // if objects pointed to are alive it is crucial that the object 435 // if objects pointed to are alive it is crucial that the object
436 // pointed to belong to the same thread as the object receiving 436 // pointed to belong to the same thread as the object receiving
437 // the weak callback. Since other threads have been resumed the 437 // the weak callback. Since other threads have been resumed the
438 // mark bits are not valid for objects from other threads. 438 // mark bits are not valid for objects from other threads.
439 virtual void registerWeakMembers(const void*, const void*, WeakPointerCallba ck) = 0; 439 virtual void registerWeakMembers(const void*, const void*, WeakCallback) = 0 ;
440 using VisitorHelper<Visitor>::registerWeakMembers; 440 using VisitorHelper<Visitor>::registerWeakMembers;
441 441
442 virtual void registerWeakTable(const void*, EphemeronCallback, EphemeronCall back) = 0; 442 virtual void registerWeakTable(const void*, EphemeronCallback, EphemeronCall back) = 0;
443 #if ENABLE(ASSERT) 443 #if ENABLE(ASSERT)
444 virtual bool weakTableRegistered(const void*) = 0; 444 virtual bool weakTableRegistered(const void*) = 0;
445 #endif 445 #endif
446 446
447 virtual bool isMarked(const void*) = 0; 447 virtual bool isMarked(const void*) = 0;
448 virtual bool ensureMarked(const void*) = 0; 448 virtual bool ensureMarked(const void*) = 0;
449 449
450 #if ENABLE(GC_PROFILING) 450 #if ENABLE(GC_PROFILING)
451 void setHostInfo(void* object, const String& name) 451 void setHostInfo(void* object, const String& name)
452 { 452 {
453 m_hostObject = object; 453 m_hostObject = object;
454 m_hostName = name; 454 m_hostName = name;
455 } 455 }
456 #endif 456 #endif
457 457
458 inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor ; } 458 inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor ; }
459 459
460 protected: 460 protected:
461 explicit Visitor(MarkingMode markingMode) 461 explicit Visitor(MarkingMode markingMode)
462 : m_isGlobalMarkingVisitor(markingMode == GlobalMarking) 462 : m_isGlobalMarkingVisitor(markingMode == GlobalMarking)
463 { } 463 { }
464 464
465 virtual void registerWeakCellWithCallback(void**, WeakPointerCallback) = 0; 465 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0;
466 #if ENABLE(GC_PROFILING) 466 #if ENABLE(GC_PROFILING)
467 virtual void recordObjectGraphEdge(const void*) = 0; 467 virtual void recordObjectGraphEdge(const void*) = 0;
468 468
469 void* m_hostObject; 469 void* m_hostObject;
470 String m_hostName; 470 String m_hostName;
471 #endif 471 #endif
472 472
473 #if ENABLE(ASSERT) 473 #if ENABLE(ASSERT)
474 virtual void checkMarkingAllowed() { } 474 virtual void checkMarkingAllowed() { }
475 #endif 475 #endif
(...skipping 20 matching lines...) Expand all
496 { 496 {
497 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun ctionName(WTF::extractNameFunction<T>()))); 497 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun ctionName(WTF::extractNameFunction<T>())));
498 return typenameString; 498 return typenameString;
499 } 499 }
500 }; 500 };
501 #endif 501 #endif
502 502
503 } // namespace blink 503 } // namespace blink
504 504
505 #endif // Visitor_h 505 #endif // Visitor_h
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698