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

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

Issue 2642933005: Have VisitorHelper<> handle moving object registration. (Closed)
Patch Set: msvc compile fix Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/SparseHeapBitmap.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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); 276 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline);
277 } 277 }
278 278
279 void registerWeakMembers(const void* object, WeakCallback callback) { 279 void registerWeakMembers(const void* object, WeakCallback callback) {
280 Derived::fromHelper(this)->registerWeakMembers(object, object, callback); 280 Derived::fromHelper(this)->registerWeakMembers(object, object, callback);
281 } 281 }
282 282
283 void registerBackingStoreReference(void* slot) { 283 void registerBackingStoreReference(void* slot) {
284 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) 284 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction)
285 return; 285 return;
286 Derived::fromHelper(this)->registerMovingObjectReference( 286 heap().registerMovingObjectReference(
287 reinterpret_cast<MovableReference*>(slot)); 287 reinterpret_cast<MovableReference*>(slot));
288 } 288 }
289 289
290 void registerBackingStoreCallback(void* backingStore, 290 void registerBackingStoreCallback(void* backingStore,
291 MovingObjectCallback callback, 291 MovingObjectCallback callback,
292 void* callbackData) { 292 void* callbackData) {
293 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) 293 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction)
294 return; 294 return;
295 Derived::fromHelper(this)->registerMovingObjectCallback( 295 heap().registerMovingObjectCallback(
296 reinterpret_cast<MovableReference>(backingStore), callback, 296 reinterpret_cast<MovableReference>(backingStore), callback,
297 callbackData); 297 callbackData);
298 } 298 }
299 299
300 inline ThreadState* state() const { return m_state; } 300 inline ThreadState* state() const { return m_state; }
301 inline ThreadHeap& heap() const { return state()->heap(); } 301 inline ThreadHeap& heap() const { return state()->heap(); }
302 302
303 inline VisitorMarkingMode getMarkingMode() const { return m_markingMode; } 303 inline VisitorMarkingMode getMarkingMode() const { return m_markingMode; }
304 304
305 inline bool isGlobalMarking() const { 305 inline bool isGlobalMarking() const {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 virtual void registerWeakTable(const void*, 381 virtual void registerWeakTable(const void*,
382 EphemeronCallback, 382 EphemeronCallback,
383 EphemeronCallback) = 0; 383 EphemeronCallback) = 0;
384 #if DCHECK_IS_ON() 384 #if DCHECK_IS_ON()
385 virtual bool weakTableRegistered(const void*) = 0; 385 virtual bool weakTableRegistered(const void*) = 0;
386 #endif 386 #endif
387 387
388 virtual bool ensureMarked(const void*) = 0; 388 virtual bool ensureMarked(const void*) = 0;
389 389
390 virtual void registerMovingObjectReference(MovableReference*) = 0;
391
392 virtual void registerMovingObjectCallback(MovableReference,
393 MovingObjectCallback,
394 void*) = 0;
395
396 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; 390 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0;
397 391
398 protected: 392 protected:
399 Visitor(ThreadState*, VisitorMarkingMode); 393 Visitor(ThreadState*, VisitorMarkingMode);
400 394
401 private: 395 private:
402 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { 396 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) {
403 return static_cast<Visitor*>(helper); 397 return static_cast<Visitor*>(helper);
404 } 398 }
405 }; 399 };
406 400
407 } // namespace blink 401 } // namespace blink
408 402
409 #endif // Visitor_h 403 #endif // Visitor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/SparseHeapBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698