Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: base/files/file.cc

Issue 2797283002: Fixing std::swap(x, x) in base. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/files/file_unittest.cc » ('j') | base/pickle.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_tracing.h" 7 #include "base/files/file_tracing.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/timer/elapsed_timer.h" 9 #include "base/timer/elapsed_timer.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // static 64 // static
65 File File::CreateForAsyncHandle(PlatformFile platform_file) { 65 File File::CreateForAsyncHandle(PlatformFile platform_file) {
66 File file(platform_file); 66 File file(platform_file);
67 // It would be nice if we could validate that |platform_file| was opened with 67 // It would be nice if we could validate that |platform_file| was opened with
68 // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to be possible. 68 // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to be possible.
69 file.async_ = true; 69 file.async_ = true;
70 return file; 70 return file;
71 } 71 }
72 72
73 File& File::operator=(File&& other) { 73 File& File::operator=(File&& other) {
74 DCHECK_NE(this, &other);
75 Close(); 74 Close();
danakj 2017/04/05 19:17:40 I don't understand how this wouldn't close the fil
76 SetPlatformFile(other.TakePlatformFile()); 75 SetPlatformFile(other.TakePlatformFile());
77 tracing_path_ = other.tracing_path_; 76 tracing_path_ = other.tracing_path_;
78 error_details_ = other.error_details(); 77 error_details_ = other.error_details();
79 created_ = other.created(); 78 created_ = other.created();
80 async_ = other.async_; 79 async_ = other.async_;
81 return *this; 80 return *this;
82 } 81 }
83 82
84 #if !defined(OS_NACL) 83 #if !defined(OS_NACL)
85 void File::Initialize(const FilePath& path, uint32_t flags) { 84 void File::Initialize(const FilePath& path, uint32_t flags) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return "FILE_ERROR_IO"; 131 return "FILE_ERROR_IO";
133 case FILE_ERROR_MAX: 132 case FILE_ERROR_MAX:
134 break; 133 break;
135 } 134 }
136 135
137 NOTREACHED(); 136 NOTREACHED();
138 return ""; 137 return "";
139 } 138 }
140 139
141 } // namespace base 140 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/files/file_unittest.cc » ('j') | base/pickle.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698