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

Side by Side Diff: chrome/common/important_file_writer.cc

Issue 8477018: Pull back some CHECK calls which were removed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment tweak Created 9 years, 1 month 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 | chrome/common/mac/cfbundle_blocker.mm » ('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 (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 "chrome/common/important_file_writer.h" 5 #include "chrome/common/important_file_writer.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE; 45 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE;
46 base::PlatformFile tmp_file = 46 base::PlatformFile tmp_file =
47 base::CreatePlatformFile(tmp_file_path, flags, NULL, NULL); 47 base::CreatePlatformFile(tmp_file_path, flags, NULL, NULL);
48 if (tmp_file == base::kInvalidPlatformFileValue) { 48 if (tmp_file == base::kInvalidPlatformFileValue) {
49 LogFailure(FAILED_OPENING, "could not open temporary file"); 49 LogFailure(FAILED_OPENING, "could not open temporary file");
50 return; 50 return;
51 } 51 }
52 52
53 DCHECK_LE(data_.length(), static_cast<size_t>(kint32max)); 53 // If this happens in the wild something really bad is going on.
54 CHECK_LE(data_.length(), static_cast<size_t>(kint32max));
54 int bytes_written = base::WritePlatformFile( 55 int bytes_written = base::WritePlatformFile(
55 tmp_file, 0, data_.data(), static_cast<int>(data_.length())); 56 tmp_file, 0, data_.data(), static_cast<int>(data_.length()));
56 base::FlushPlatformFile(tmp_file); // Ignore return value. 57 base::FlushPlatformFile(tmp_file); // Ignore return value.
57 58
58 if (!base::ClosePlatformFile(tmp_file)) { 59 if (!base::ClosePlatformFile(tmp_file)) {
59 LogFailure(FAILED_CLOSING, "failed to close temporary file"); 60 LogFailure(FAILED_CLOSING, "failed to close temporary file");
60 file_util::Delete(tmp_file_path, false); 61 file_util::Delete(tmp_file_path, false);
61 return; 62 return;
62 } 63 }
63 64
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DCHECK(serializer_); 162 DCHECK(serializer_);
162 std::string data; 163 std::string data;
163 if (serializer_->SerializeData(&data)) { 164 if (serializer_->SerializeData(&data)) {
164 WriteNow(data); 165 WriteNow(data);
165 } else { 166 } else {
166 DLOG(WARNING) << "failed to serialize data to be saved in " 167 DLOG(WARNING) << "failed to serialize data to be saved in "
167 << path_.value(); 168 << path_.value();
168 } 169 }
169 serializer_ = NULL; 170 serializer_ = NULL;
170 } 171 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/mac/cfbundle_blocker.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698