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

Side by Side Diff: chrome/browser/download/base_file.cc

Issue 3348010: Revert 58196 - GTTF: Clean up DownloadFileManager... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « chrome/browser/download/base_file.h ('k') | chrome/browser/download/base_file_unittest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/download/base_file.h" 5 #include "chrome/browser/download/base_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/file_stream.h" 9 #include "net/base/file_stream.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "chrome/browser/chrome_thread.h" 11 #include "chrome/browser/chrome_thread.h"
12 #include "chrome/browser/download/download_util.h" 12 #include "chrome/browser/download/download_util.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 #include "chrome/common/win_safe_util.h" 15 #include "chrome/common/win_safe_util.h"
16 #elif defined(OS_MACOSX) 16 #elif defined(OS_MACOSX)
17 #include "chrome/browser/cocoa/file_metadata.h" 17 #include "chrome/browser/cocoa/file_metadata.h"
18 #endif 18 #endif
19 19
20 BaseFile::BaseFile(const FilePath& full_path, 20 BaseFile::BaseFile(const FilePath& full_path,
21 const GURL& source_url, 21 const GURL& source_url,
22 const GURL& referrer_url, 22 const GURL& referrer_url,
23 int64 received_bytes,
24 const linked_ptr<net::FileStream>& file_stream) 23 const linked_ptr<net::FileStream>& file_stream)
25 : full_path_(full_path), 24 : full_path_(full_path),
26 path_renamed_(false), 25 path_renamed_(false),
27 source_url_(source_url), 26 source_url_(source_url),
28 referrer_url_(referrer_url), 27 referrer_url_(referrer_url),
29 file_stream_(file_stream), 28 file_stream_(file_stream),
30 bytes_so_far_(received_bytes), 29 bytes_so_far_(0),
31 power_save_blocker_(true) { 30 power_save_blocker_(true) {
32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 31 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
33 } 32 }
34 33
35 BaseFile::~BaseFile() { 34 BaseFile::~BaseFile() {
36 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 35 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
37 if (in_progress()) 36 if (in_progress())
38 Cancel(); 37 Cancel();
39 Close(); 38 Close();
40 } 39 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 if (file_stream_.get()) { 186 if (file_stream_.get()) {
188 #if defined(OS_CHROMEOS) 187 #if defined(OS_CHROMEOS)
189 // Currently we don't really care about the return value, since if it fails 188 // Currently we don't really care about the return value, since if it fails
190 // theres not much we can do. But we might in the future. 189 // theres not much we can do. But we might in the future.
191 file_stream_->Flush(); 190 file_stream_->Flush();
192 #endif 191 #endif
193 file_stream_->Close(); 192 file_stream_->Close();
194 file_stream_.reset(); 193 file_stream_.reset();
195 } 194 }
196 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/download/base_file.h ('k') | chrome/browser/download/base_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698