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

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

Issue 246573003: Move the flush in AppendCommandsToFile outside the loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | 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 (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/files/file.h" 10 #include "base/files/file.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return false; 326 return false;
327 } 327 }
328 if (content_size > 0) { 328 if (content_size > 0) {
329 wrote = file->WriteAtCurrentPos(reinterpret_cast<char*>((*i)->contents()), 329 wrote = file->WriteAtCurrentPos(reinterpret_cast<char*>((*i)->contents()),
330 content_size); 330 content_size);
331 if (wrote != content_size) { 331 if (wrote != content_size) {
332 NOTREACHED() << "error writing"; 332 NOTREACHED() << "error writing";
333 return false; 333 return false;
334 } 334 }
335 } 335 }
336 }
336 #if defined(OS_CHROMEOS) 337 #if defined(OS_CHROMEOS)
337 // TODO(gspencer): Remove this once we find a better place to do it. 338 file->Flush();
338 // See issue http://crbug.com/245015
339 file->Flush();
340 #endif 339 #endif
341 }
342 return true; 340 return true;
343 } 341 }
344 342
345 SessionBackend::~SessionBackend() { 343 SessionBackend::~SessionBackend() {
346 if (current_session_file_.get()) { 344 if (current_session_file_.get()) {
347 // Destructor performs file IO because file is open in sync mode. 345 // Destructor performs file IO because file is open in sync mode.
348 // crbug.com/112512. 346 // crbug.com/112512.
349 base::ThreadRestrictions::ScopedAllowIO allow_io; 347 base::ThreadRestrictions::ScopedAllowIO allow_io;
350 current_session_file_.reset(); 348 current_session_file_.reset();
351 } 349 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 395 }
398 396
399 base::FilePath SessionBackend::GetCurrentSessionPath() { 397 base::FilePath SessionBackend::GetCurrentSessionPath() {
400 base::FilePath path = path_to_dir_; 398 base::FilePath path = path_to_dir_;
401 if (type_ == BaseSessionService::TAB_RESTORE) 399 if (type_ == BaseSessionService::TAB_RESTORE)
402 path = path.AppendASCII(kCurrentTabSessionFileName); 400 path = path.AppendASCII(kCurrentTabSessionFileName);
403 else 401 else
404 path = path.AppendASCII(kCurrentSessionFileName); 402 path = path.AppendASCII(kCurrentSessionFileName);
405 return path; 403 return path;
406 } 404 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698