| Index: chrome/test/chromedriver/chrome/scoped_temp_dir_with_retry.cc
|
| diff --git a/chrome/test/chromedriver/chrome/scoped_temp_dir_with_retry.cc b/chrome/test/chromedriver/chrome/scoped_temp_dir_with_retry.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e4f5140f562e3940ef52fd1a7d20821230a5417a
|
| --- /dev/null
|
| +++ b/chrome/test/chromedriver/chrome/scoped_temp_dir_with_retry.cc
|
| @@ -0,0 +1,21 @@
|
| +// 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));
|
| + }
|
| + }
|
| +}
|
|
|