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

Side by Side Diff: shell/crash/crash_upload.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « shell/context.cc ('k') | shell/filename_util.cc » ('j') | 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 "shell/crash/crash_upload.h" 5 #include "shell/crash/crash_upload.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 last_modified_time = files.GetInfo().GetLastModifiedTime(); 154 last_modified_time = files.GetInfo().GetLastModifiedTime();
155 } 155 }
156 } 156 }
157 } 157 }
158 158
159 if (minidump.empty() || !CanUploadCrash(dumps_path)) 159 if (minidump.empty() || !CanUploadCrash(dumps_path))
160 return MinidumpAndBoundary(); 160 return MinidumpAndBoundary();
161 // Find multipart boundary. 161 // Find multipart boundary.
162 std::string start_of_file; 162 std::string start_of_file;
163 base::ReadFileToString(minidump, &start_of_file, kMaxBoundarySize); 163 base::ReadFileToString(minidump, &start_of_file, kMaxBoundarySize);
164 if (!StartsWithASCII(start_of_file, "--", true)) { 164 if (!base::StartsWith(start_of_file, "--", base::CompareCase::SENSITIVE)) {
165 LOG(WARNING) << "Corrupted minidump: " << minidump.value(); 165 LOG(WARNING) << "Corrupted minidump: " << minidump.value();
166 base::DeleteFile(minidump, false); 166 base::DeleteFile(minidump, false);
167 return MinidumpAndBoundary(); 167 return MinidumpAndBoundary();
168 } 168 }
169 size_t space_index = start_of_file.find_first_of(base::kWhitespaceASCII); 169 size_t space_index = start_of_file.find_first_of(base::kWhitespaceASCII);
170 if (space_index == std::string::npos || space_index <= 2) { 170 if (space_index == std::string::npos || space_index <= 2) {
171 // The boundary is either too big, or too short. 171 // The boundary is either too big, or too short.
172 LOG(WARNING) << "Corrupted minidump: " << minidump.value(); 172 LOG(WARNING) << "Corrupted minidump: " << minidump.value();
173 base::DeleteFile(minidump, false); 173 base::DeleteFile(minidump, false);
174 return MinidumpAndBoundary(); 174 return MinidumpAndBoundary();
175 } 175 }
176 return MinidumpAndBoundary(minidump, 176 return MinidumpAndBoundary(minidump,
177 start_of_file.substr(2, space_index - 2)); 177 start_of_file.substr(2, space_index - 2));
178 } 178 }
179 179
180 } // namespace 180 } // namespace
181 181
182 void UploadCrashes(const base::FilePath& dumps_path, 182 void UploadCrashes(const base::FilePath& dumps_path,
183 scoped_refptr<base::TaskRunner> file_task_runner, 183 scoped_refptr<base::TaskRunner> file_task_runner,
184 mojo::NetworkServicePtr network_service) { 184 mojo::NetworkServicePtr network_service) {
185 base::PostTaskAndReplyWithResult( 185 base::PostTaskAndReplyWithResult(
186 file_task_runner.get(), FROM_HERE, 186 file_task_runner.get(), FROM_HERE,
187 base::Bind(&GetMinidumpAndBoundary, dumps_path), 187 base::Bind(&GetMinidumpAndBoundary, dumps_path),
188 base::Bind(&UploadCrash, file_task_runner, 188 base::Bind(&UploadCrash, file_task_runner,
189 base::Passed(network_service.Pass()), dumps_path)); 189 base::Passed(network_service.Pass()), dumps_path));
190 } 190 }
191 191
192 } // namespace breakpad 192 } // namespace breakpad
OLDNEW
« no previous file with comments | « shell/context.cc ('k') | shell/filename_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698