blob: e4f5140f562e3940ef52fd1a7d20821230a5417a [file] [log] [blame]
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/test/chromedriver/chrome/scoped_temp_dir_with_retry.h"
#include "base/threading/platform_thread.h"
ScopedTempDirWithRetry::~ScopedTempDirWithRetry() {
if (IsValid()) {
int retry = 0;
while (!Delete()) {
// Delete failed. Retry up to 100 times, with 10 ms delay between each
// retry (thus maximum delay is about 1 second).
if (++retry > 100) {
DLOG(WARNING) << "Could not delete temp dir after retries.";
break;
}
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
}
}
}