Extract code from LazyInstance::Pointer() to a helper function.
This will ease reuse of this code in other classes.
Bug: 730170
Change-Id: I13b59fa864c0b1ddecef5e66d4ff0cf6a14d6fcb
Reviewed-on: https://chromium-review.googlesource.com/530984
Commit-Queue: Francois Doray <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#478723}
diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc
index 5468065..c18cf52 100644
--- a/base/lazy_instance.cc
+++ b/base/lazy_instance.cc
@@ -38,16 +38,16 @@
void CompleteLazyInstance(subtle::AtomicWord* state,
subtle::AtomicWord new_instance,
- void* lazy_instance,
- void (*dtor)(void*)) {
+ void (*destructor)(void*),
+ void* destructor_arg) {
// Instance is created, go from CREATING to CREATED.
// Releases visibility over private_buf_ to readers. Pairing Acquire_Load's
// are in NeedsInstance() and Pointer().
subtle::Release_Store(state, new_instance);
// Make sure that the lazily instantiated object will get destroyed at exit.
- if (dtor)
- AtExitManager::RegisterCallback(dtor, lazy_instance);
+ if (destructor)
+ AtExitManager::RegisterCallback(destructor, destructor_arg);
}
} // namespace internal