0

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:
dimaa
2017-03-06 11:57:12 -08:00
committed by Commit bot
parent e8cf2b3e52
commit aba30978d6
2 changed files with 4 additions and 2 deletions

@ -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());