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

Side by Side Diff: chrome/browser/sessions/session_backend.cc

Issue 7044018: This adds a Flush to the session backend to help with data corruption (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/glue_serialize.cc » ('j') | webkit/glue/glue_serialize.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 "chrome/browser/sessions/session_backend.h" 5 #include "chrome/browser/sessions/session_backend.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 if (content_size > 0) { 335 if (content_size > 0) {
336 wrote = file->Write(reinterpret_cast<char*>((*i)->contents()), 336 wrote = file->Write(reinterpret_cast<char*>((*i)->contents()),
337 content_size, NULL); 337 content_size, NULL);
338 if (wrote != content_size) { 338 if (wrote != content_size) {
339 NOTREACHED() << "error writing"; 339 NOTREACHED() << "error writing";
340 return false; 340 return false;
341 } 341 }
342 } 342 }
343 } 343 }
344 file->Flush();
344 return true; 345 return true;
345 } 346 }
346 347
347 SessionBackend::~SessionBackend() { 348 SessionBackend::~SessionBackend() {
348 } 349 }
349 350
350 void SessionBackend::ResetFile() { 351 void SessionBackend::ResetFile() {
351 DCHECK(inited_); 352 DCHECK(inited_);
352 if (current_session_file_.get()) { 353 if (current_session_file_.get()) {
353 // File is already open, truncate it. We truncate instead of closing and 354 // File is already open, truncate it. We truncate instead of closing and
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 391 }
391 392
392 FilePath SessionBackend::GetCurrentSessionPath() { 393 FilePath SessionBackend::GetCurrentSessionPath() {
393 FilePath path = path_to_dir_; 394 FilePath path = path_to_dir_;
394 if (type_ == BaseSessionService::TAB_RESTORE) 395 if (type_ == BaseSessionService::TAB_RESTORE)
395 path = path.AppendASCII(kCurrentTabSessionFileName); 396 path = path.AppendASCII(kCurrentTabSessionFileName);
396 else 397 else
397 path = path.AppendASCII(kCurrentSessionFileName); 398 path = path.AppendASCII(kCurrentSessionFileName);
398 return path; 399 return path;
399 } 400 }
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/glue_serialize.cc » ('j') | webkit/glue/glue_serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698