Clean up g_memory_coordinator after each MemoryCoordinatorImpl test
MemoryCoordinatorImpl tests fail the first time and should be re-run separately. g_memory_coordinator need to be cleaned up between tests, otherwise the subsequent tests will crash trying to reset g_memory_coordinator. This CL implements reset method which called after each MemoryCoordinatorImpl in destructor. BUG=698282 Review-Url: https://codereview.chromium.org/2726983006 Cr-Commit-Position: refs/heads/master@{#454926}
This commit is contained in:
@ -26,7 +26,7 @@ MemoryCoordinatorProxy* MemoryCoordinatorProxy::GetInstance() {
|
||||
// static
|
||||
void MemoryCoordinatorProxy::SetMemoryCoordinator(
|
||||
MemoryCoordinator* coordinator) {
|
||||
DCHECK(!g_memory_coordinator);
|
||||
DCHECK(!g_memory_coordinator || !coordinator);
|
||||
g_memory_coordinator = coordinator;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,9 @@ MemoryCoordinatorImpl::MemoryCoordinatorImpl(
|
||||
base::MemoryCoordinatorProxy::SetMemoryCoordinator(this);
|
||||
}
|
||||
|
||||
MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {}
|
||||
MemoryCoordinatorImpl::~MemoryCoordinatorImpl() {
|
||||
base::MemoryCoordinatorProxy::SetMemoryCoordinator(nullptr);
|
||||
}
|
||||
|
||||
void MemoryCoordinatorImpl::Start() {
|
||||
DCHECK(CalledOnValidThread());
|
||||
|
Reference in New Issue
Block a user