| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // with the object as an argument. Tracing objects will mark all of the | 323 // with the object as an argument. Tracing objects will mark all of the |
| 324 // contained pointers and push them on the marking stack. | 324 // contained pointers and push them on the marking stack. |
| 325 class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { | 325 class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| 326 public: | 326 public: |
| 327 friend class VisitorHelper<Visitor>; | 327 friend class VisitorHelper<Visitor>; |
| 328 friend class InlinedGlobalMarkingVisitor; | 328 friend class InlinedGlobalMarkingVisitor; |
| 329 | 329 |
| 330 enum MarkingMode { | 330 enum MarkingMode { |
| 331 GlobalMarking, | 331 GlobalMarking, |
| 332 ThreadLocalMarking, | 332 ThreadLocalMarking, |
| 333 WeakProcessing, |
| 333 }; | 334 }; |
| 334 | 335 |
| 335 virtual ~Visitor() { } | 336 virtual ~Visitor() { } |
| 336 | 337 |
| 337 using VisitorHelper<Visitor>::mark; | 338 using VisitorHelper<Visitor>::mark; |
| 338 | 339 |
| 339 // This method marks an object and adds it to the set of objects | 340 // This method marks an object and adds it to the set of objects |
| 340 // that should have their trace method called. Since not all | 341 // that should have their trace method called. Since not all |
| 341 // objects have vtables we have to have the callback as an | 342 // objects have vtables we have to have the callback as an |
| 342 // explicit argument, but we can use the templated one-argument | 343 // explicit argument, but we can use the templated one-argument |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 virtual bool ensureMarked(const void*) = 0; | 386 virtual bool ensureMarked(const void*) = 0; |
| 386 | 387 |
| 387 #if ENABLE(GC_PROFILING) | 388 #if ENABLE(GC_PROFILING) |
| 388 void setHostInfo(void* object, const String& name) | 389 void setHostInfo(void* object, const String& name) |
| 389 { | 390 { |
| 390 m_hostObject = object; | 391 m_hostObject = object; |
| 391 m_hostName = name; | 392 m_hostName = name; |
| 392 } | 393 } |
| 393 #endif | 394 #endif |
| 394 | 395 |
| 395 inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor
; } | 396 inline MarkingMode markingMode() const { return m_markingMode; } |
| 396 | 397 |
| 397 protected: | 398 protected: |
| 398 explicit Visitor(MarkingMode markingMode) | 399 explicit Visitor(MarkingMode markingMode) |
| 399 : m_isGlobalMarkingVisitor(markingMode == GlobalMarking) | 400 : m_markingMode(markingMode) |
| 400 { } | 401 { } |
| 401 | 402 |
| 402 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; | 403 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; |
| 403 #if ENABLE(GC_PROFILING) | 404 #if ENABLE(GC_PROFILING) |
| 404 virtual void recordObjectGraphEdge(const void*) = 0; | 405 virtual void recordObjectGraphEdge(const void*) = 0; |
| 405 | 406 |
| 406 void* m_hostObject; | 407 void* m_hostObject; |
| 407 String m_hostName; | 408 String m_hostName; |
| 408 #endif | 409 #endif |
| 409 | 410 |
| 410 #if ENABLE(ASSERT) | 411 #if ENABLE(ASSERT) |
| 411 virtual void checkMarkingAllowed() { } | 412 virtual void checkMarkingAllowed() { } |
| 412 #endif | 413 #endif |
| 413 | 414 |
| 414 private: | 415 private: |
| 415 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } | 416 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } |
| 416 | 417 |
| 418 const MarkingMode m_markingMode; |
| 417 bool m_isGlobalMarkingVisitor; | 419 bool m_isGlobalMarkingVisitor; |
| 418 }; | 420 }; |
| 419 | 421 |
| 420 #if ENABLE(GC_PROFILING) | 422 #if ENABLE(GC_PROFILING) |
| 421 template<typename T> | 423 template<typename T> |
| 422 struct TypenameStringTrait { | 424 struct TypenameStringTrait { |
| 423 static const String& get() | 425 static const String& get() |
| 424 { | 426 { |
| 425 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun
ctionName(WTF::extractNameFunction<T>()))); | 427 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun
ctionName(WTF::extractNameFunction<T>()))); |
| 426 return typenameString; | 428 return typenameString; |
| 427 } | 429 } |
| 428 }; | 430 }; |
| 429 #endif | 431 #endif |
| 430 | 432 |
| 431 } // namespace blink | 433 } // namespace blink |
| 432 | 434 |
| 433 #endif // Visitor_h | 435 #endif // Visitor_h |
| OLD | NEW |