Minor style updates. Default the build generator to use Python 3. Update file class member initialization to use inline initializers. Remove the unused File::created_ flag. Change-Id: I829b536e214e1ea2f5597046ec448bb7c318d290 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/12080 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/build/full_test.py b/build/full_test.py index 2095ddd..46ba2de 100755 --- a/build/full_test.py +++ b/build/full_test.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 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.
diff --git a/build/gen.py b/build/gen.py index 1f23cc4..265b1f5 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 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.
diff --git a/src/base/files/file.cc b/src/base/files/file.cc index d82911a..cecb76d 100644 --- a/src/base/files/file.cc +++ b/src/base/files/file.cc
@@ -12,34 +12,31 @@ namespace base { -File::Info::Info() : size(0), is_directory(false), is_symbolic_link(false) {} +File::Info::Info() = default; File::Info::~Info() = default; -File::File() - : error_details_(FILE_ERROR_FAILED), created_(false) {} +File::File() = default; File::File(const FilePath& path, uint32_t flags) - : error_details_(FILE_OK), created_(false) { + : error_details_(FILE_OK) { Initialize(path, flags); } File::File(PlatformFile platform_file) : file_(platform_file), - error_details_(FILE_OK), - created_(false) { + error_details_(FILE_OK) { #if defined(OS_POSIX) || defined(OS_FUCHSIA) DCHECK_GE(platform_file, -1); #endif } File::File(Error error_details) - : error_details_(error_details), created_(false) {} + : error_details_(error_details) {} File::File(File&& other) : file_(other.TakePlatformFile()), - error_details_(other.error_details()), - created_(other.created()) {} + error_details_(other.error_details()) {} File::~File() { // Go through the AssertIOAllowed logic. @@ -50,7 +47,6 @@ Close(); SetPlatformFile(other.TakePlatformFile()); error_details_ = other.error_details(); - created_ = other.created(); return *this; }
diff --git a/src/base/files/file.h b/src/base/files/file.h index 737e30a..f579ef5 100644 --- a/src/base/files/file.h +++ b/src/base/files/file.h
@@ -97,14 +97,14 @@ #endif // The size of the file in bytes. Undefined when is_directory is true. - int64_t size; + int64_t size = 0; // True if the file corresponds to a directory. - bool is_directory; + bool is_directory = false; // True if the file corresponds to a symbolic link. For Windows currently // not supported and thus always false. - bool is_symbolic_link; + bool is_symbolic_link = false; // The last modified time of a file. Ticks last_modified; @@ -142,11 +142,6 @@ // ThreadRestrictions::SetIOAllowed(false) threads). bool IsValid() const; - // Returns true if a new file was created (or an old one truncated to zero - // length to simulate a new file, which can happen with - // FLAG_CREATE_ALWAYS), and false otherwise. - bool created() const { return created_; } - // Returns the OS result of opening this file. Note that the way to verify // the success of the operation is to use IsValid(), not this method: // File file(path, flags); @@ -279,8 +274,7 @@ ScopedPlatformFile file_; - Error error_details_; - bool created_; + Error error_details_ = FILE_ERROR_FAILED; DISALLOW_COPY_AND_ASSIGN(File); };
diff --git a/src/base/files/file_win.cc b/src/base/files/file_win.cc index e9c90e3..b68370b 100644 --- a/src/base/files/file_win.cc +++ b/src/base/files/file_win.cc
@@ -300,8 +300,6 @@ if (file_.IsValid()) { error_details_ = FILE_OK; - if (flags & FLAG_CREATE_ALWAYS) - created_ = true; } else { error_details_ = GetLastFileError(); }