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

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

Issue 11030044: Merge 159454 - Flush at the end of local file writing in FileWriter API. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | content/browser/download/base_file.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 if (content_size > 0) { 337 if (content_size > 0) {
338 wrote = file->WriteSync(reinterpret_cast<char*>((*i)->contents()), 338 wrote = file->WriteSync(reinterpret_cast<char*>((*i)->contents()),
339 content_size); 339 content_size);
340 if (wrote != content_size) { 340 if (wrote != content_size) {
341 NOTREACHED() << "error writing"; 341 NOTREACHED() << "error writing";
342 return false; 342 return false;
343 } 343 }
344 } 344 }
345 } 345 }
346 file->Flush(); 346 file->FlushSync();
347 return true; 347 return true;
348 } 348 }
349 349
350 SessionBackend::~SessionBackend() { 350 SessionBackend::~SessionBackend() {
351 if (current_session_file_.get()) { 351 if (current_session_file_.get()) {
352 // Close() performs file IO. crbug.com/112512. 352 // Close() performs file IO. crbug.com/112512.
353 base::ThreadRestrictions::ScopedAllowIO allow_io; 353 base::ThreadRestrictions::ScopedAllowIO allow_io;
354 current_session_file_->CloseSync(); 354 current_session_file_->CloseSync();
355 } 355 }
356 } 356 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 398 }
399 399
400 FilePath SessionBackend::GetCurrentSessionPath() { 400 FilePath SessionBackend::GetCurrentSessionPath() {
401 FilePath path = path_to_dir_; 401 FilePath path = path_to_dir_;
402 if (type_ == BaseSessionService::TAB_RESTORE) 402 if (type_ == BaseSessionService::TAB_RESTORE)
403 path = path.AppendASCII(kCurrentTabSessionFileName); 403 path = path.AppendASCII(kCurrentTabSessionFileName);
404 else 404 else
405 path = path.AppendASCII(kCurrentSessionFileName); 405 path = path.AppendASCII(kCurrentSessionFileName);
406 return path; 406 return path;
407 } 407 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/base_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698