Bug 1139173 - ipc/chromium: Remove ScopedTempDir. r=froydnj
authorFelix Janda <felix.janda@posteo.de>
Wed, 15 Apr 2015 23:57:40 +0200
changeset 240635 1e75c69141cadfd8ea35f5f60e32cb7320d297ab
parent 240634 62325b792c42746df0c4322d47c6c3e965ec6aaa
child 240636 9b6b694dd82e1a3f7652c35d3e8b264d701ec253
push id28639
push usercbook@mozilla.com
push dateThu, 23 Apr 2015 13:34:21 +0000
treeherdermozilla-central@3574449bd314 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1139173
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1139173 - ipc/chromium: Remove ScopedTempDir. r=froydnj
ipc/chromium/moz.build
ipc/chromium/src/base/scoped_temp_dir.cc
ipc/chromium/src/base/scoped_temp_dir.h
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -45,17 +45,16 @@ UNIFIED_SOURCES += [
     'src/base/lock.cc',
     'src/base/logging.cc',
     'src/base/message_loop.cc',
     'src/base/message_pump_default.cc',
     'src/base/non_thread_safe.cc',
     'src/base/pickle.cc',
     'src/base/rand_util.cc',
     'src/base/revocable_store.cc',
-    'src/base/scoped_temp_dir.cc',
     'src/base/string_piece.cc',
     'src/base/string_util.cc',
     'src/base/thread.cc',
     'src/base/thread_collision_warner.cc',
     'src/base/time.cc',
     'src/base/timer.cc',
     'src/base/tracked.cc',
     'src/base/tracked_objects.cc',
deleted file mode 100644
--- a/ipc/chromium/src/base/scoped_temp_dir.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2009 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 "base/scoped_temp_dir.h"
-
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/string_util.h"
-
-ScopedTempDir::ScopedTempDir() {
-}
-
-ScopedTempDir::~ScopedTempDir() {
-  if (!path_.empty() && !file_util::Delete(path_, true))
-    CHROMIUM_LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
-}
-
-bool ScopedTempDir::CreateUniqueTempDir() {
-  // This "scoped_dir" prefix is only used on Windows and serves as a template
-  // for the unique name.
-  if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_dir"),
-                                         &path_))
-    return false;
-
-  return true;
-}
-
-bool ScopedTempDir::Set(const FilePath& path) {
-  DCHECK(path_.empty());
-  if (!file_util::DirectoryExists(path) &&
-      !file_util::CreateDirectory(path)) {
-    return false;
-  }
-  path_ = path;
-  return true;
-}
-
-FilePath ScopedTempDir::Take() {
-  FilePath ret = path_;
-  path_ = FilePath();
-  return ret;
-}
-
-bool ScopedTempDir::IsValid() const {
-  return !path_.empty() && file_util::DirectoryExists(path_);
-}
deleted file mode 100644
--- a/ipc/chromium/src/base/scoped_temp_dir.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2009 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.
-
-#ifndef BASE_SCOPED_TEMP_DIR_H_
-#define BASE_SCOPED_TEMP_DIR_H_
-
-// An object representing a temporary / scratch directory that should be cleaned
-// up (recursively) when this object goes out of scope.  Note that since
-// deletion occurs during the destructor, no further error handling is possible
-// if the directory fails to be deleted.  As a result, deletion is not
-// guaranteed by this class.
-
-#include "base/file_path.h"
-
-class ScopedTempDir {
- public:
-  // No directory is owned/created initially.
-  ScopedTempDir();
-
-  // Recursively delete path_
-  ~ScopedTempDir();
-
-  // Creates a unique directory in TempPath, and takes ownership of it.
-  // See file_util::CreateNewTemporaryDirectory.
-  bool CreateUniqueTempDir();
-
-  // Takes ownership of directory at |path|, creating it if necessary.
-  // Don't call multiple times unless Take() has been called first.
-  bool Set(const FilePath& path);
-
-  // Caller takes ownership of the temporary directory so it won't be destroyed
-  // when this object goes out of scope.
-  FilePath Take();
-
-  const FilePath& path() const { return path_; }
-
-  // Returns true if path_ is non-empty and exists.
-  bool IsValid() const;
-
- private:
-  FilePath path_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScopedTempDir);
-};
-
-#endif  // BASE_SCOPED_TEMP_DIR_H_