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

Side by Side Diff: chromecast/crash/linux/synchronized_minidump_manager.cc

Issue 1240843003: Reland of place system IO calls in chromecast/crash with Chrome utilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix: Guard thread-restricted test with #define Created 5 years, 5 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 | « chromecast/crash/linux/minidump_generator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromecast/crash/linux/synchronized_minidump_manager.h" 5 #include "chromecast/crash/linux/synchronized_minidump_manager.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <grp.h> 10 #include <grp.h>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 std::ifstream in(lockfile_path_); 146 std::ifstream in(lockfile_path_);
147 if (!in.is_open()) { 147 if (!in.is_open()) {
148 NOTREACHED(); 148 NOTREACHED();
149 LOG(ERROR) << lockfile_path_ << " could not be opened."; 149 LOG(ERROR) << lockfile_path_ << " could not be opened.";
150 return -1; 150 return -1;
151 } 151 }
152 152
153 // Grab each entry. 153 // Grab each entry.
154 while (std::getline(in, entry)) { 154 while (std::getline(in, entry)) {
155 scoped_ptr<DumpInfo> info(new DumpInfo(entry)); 155 scoped_ptr<DumpInfo> info(new DumpInfo(entry));
156 if (info->valid() && info->crashed_process_dump().size() > 0) { 156 if (info->valid() && info->crashed_process_dump().size() > 0)
157 dumps->push_back(info.Pass()); 157 dumps->push_back(info.Pass());
158 } else { 158 else
159 LOG(WARNING) << "Entry is not valid: " << entry; 159 LOG(WARNING) << "Ignoring invalid entry: " << entry;
160 return -1;
161 }
162 } 160 }
163 161
164 dump_metadata_ = dumps.Pass(); 162 dump_metadata_ = dumps.Pass();
165 return 0; 163 return 0;
166 } 164 }
167 165
168 int SynchronizedMinidumpManager::AddEntryToLockFile(const DumpInfo& dump_info) { 166 int SynchronizedMinidumpManager::AddEntryToLockFile(const DumpInfo& dump_info) {
169 DCHECK_LE(0, lockfile_fd_); 167 DCHECK_LE(0, lockfile_fd_);
170 168
171 // Make sure dump_info is valid. 169 // Make sure dump_info is valid.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 close(lockfile_fd_); 208 close(lockfile_fd_);
211 209
212 // We may use this object again, so we should reset this. 210 // We may use this object again, so we should reset this.
213 lockfile_fd_ = -1; 211 lockfile_fd_ = -1;
214 } 212 }
215 213
216 dump_metadata_.reset(); 214 dump_metadata_.reset();
217 } 215 }
218 216
219 } // namespace chromecast 217 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/crash/linux/minidump_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698