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

Side by Side Diff: content/browser/download/drag_download_util.cc

Issue 9349005: net: Rename FileStream::Open/Close with OpenSync/CloseSync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 | Annotate | Revision Log
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 "content/browser/download/drag_download_util.h" 5 #include "content/browser/download/drag_download_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #endif 73 #endif
74 new_file_path = file_path->InsertBeforeExtension(suffix); 74 new_file_path = file_path->InsertBeforeExtension(suffix);
75 } 75 }
76 76
77 // http://crbug.com/110709 77 // http://crbug.com/110709
78 base::ThreadRestrictions::ScopedAllowIO allow_io; 78 base::ThreadRestrictions::ScopedAllowIO allow_io;
79 79
80 // Explicitly (and redundantly check) for file -- despite the fact that our 80 // Explicitly (and redundantly check) for file -- despite the fact that our
81 // open won't overwrite -- just to avoid log spew. 81 // open won't overwrite -- just to avoid log spew.
82 if (!file_util::PathExists(new_file_path) && 82 if (!file_util::PathExists(new_file_path) &&
83 file_stream->Open(new_file_path, base::PLATFORM_FILE_CREATE | 83 file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE |
84 base::PLATFORM_FILE_WRITE) == net::OK) { 84 base::PLATFORM_FILE_WRITE) == net::OK) {
85 *file_path = new_file_path; 85 *file_path = new_file_path;
86 return file_stream.release(); 86 return file_stream.release();
87 } 87 }
88 } 88 }
89 89
90 return NULL; 90 return NULL;
91 } 91 }
92 92
93 PromiseFileFinalizer::PromiseFileFinalizer( 93 PromiseFileFinalizer::PromiseFileFinalizer(
(...skipping 14 matching lines...) Expand all
108 base::Bind(&PromiseFileFinalizer::Cleanup, this)); 108 base::Bind(&PromiseFileFinalizer::Cleanup, this));
109 } 109 }
110 110
111 void PromiseFileFinalizer::OnDownloadAborted() { 111 void PromiseFileFinalizer::OnDownloadAborted() {
112 BrowserThread::PostTask( 112 BrowserThread::PostTask(
113 BrowserThread::UI, FROM_HERE, 113 BrowserThread::UI, FROM_HERE,
114 base::Bind(&PromiseFileFinalizer::Cleanup, this)); 114 base::Bind(&PromiseFileFinalizer::Cleanup, this));
115 } 115 }
116 116
117 } // namespace drag_download_util 117 } // namespace drag_download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698