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

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

Issue 11028131: Shift passage of FileStream in downloads system to be by scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Al's comments. 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
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/download_file_impl.h" 5 #include "content/browser/download/download_file_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 using content::DownloadId; 24 using content::DownloadId;
25 using content::DownloadManager; 25 using content::DownloadManager;
26 26
27 const int kUpdatePeriodMs = 500; 27 const int kUpdatePeriodMs = 500;
28 const int kMaxTimeBlockingFileThreadMs = 1000; 28 const int kMaxTimeBlockingFileThreadMs = 1000;
29 29
30 DownloadFileImpl::DownloadFileImpl( 30 DownloadFileImpl::DownloadFileImpl(
31 const DownloadCreateInfo* info, 31 scoped_ptr<DownloadCreateInfo> info,
32 scoped_ptr<content::ByteStreamReader> stream, 32 scoped_ptr<content::ByteStreamReader> stream,
33 DownloadRequestHandleInterface* request_handle, 33 scoped_ptr<DownloadRequestHandleInterface> request_handle,
34 scoped_refptr<DownloadManager> download_manager, 34 scoped_refptr<DownloadManager> download_manager,
35 bool calculate_hash, 35 bool calculate_hash,
36 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, 36 scoped_ptr<content::PowerSaveBlocker> power_save_blocker,
37 const net::BoundNetLog& bound_net_log) 37 const net::BoundNetLog& bound_net_log)
38 : file_(info->save_info.file_path, 38 : file_(info->save_info->file_path,
39 info->url(), 39 info->url(),
40 info->referrer_url, 40 info->referrer_url,
41 info->received_bytes, 41 info->received_bytes,
42 calculate_hash, 42 calculate_hash,
43 info->save_info.hash_state, 43 info->save_info->hash_state,
44 info->save_info.file_stream, 44 info->save_info->file_stream.Pass(),
45 bound_net_log), 45 bound_net_log),
46 stream_reader_(stream.Pass()), 46 stream_reader_(stream.Pass()),
47 id_(info->download_id), 47 id_(info->download_id),
48 default_download_directory_(info->default_download_directory), 48 default_download_directory_(info->default_download_directory),
49 request_handle_(request_handle), 49 request_handle_(request_handle.Pass()),
50 download_manager_(download_manager), 50 download_manager_(download_manager),
51 bytes_seen_(0), 51 bytes_seen_(0),
52 bound_net_log_(bound_net_log), 52 bound_net_log_(bound_net_log),
53 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 53 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
54 power_save_blocker_(power_save_blocker.Pass()) { 54 power_save_blocker_(power_save_blocker.Pass()) {
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
56 DCHECK(download_manager.get()); 56 DCHECK(download_manager.get());
57 } 57 }
58 58
59 DownloadFileImpl::~DownloadFileImpl() { 59 DownloadFileImpl::~DownloadFileImpl() {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 } 308 }
309 309
310 void DownloadFileImpl::SendUpdate() { 310 void DownloadFileImpl::SendUpdate() {
311 BrowserThread::PostTask( 311 BrowserThread::PostTask(
312 BrowserThread::UI, FROM_HERE, 312 BrowserThread::UI, FROM_HERE,
313 base::Bind(&DownloadManager::UpdateDownload, 313 base::Bind(&DownloadManager::UpdateDownload,
314 download_manager_, id_.local(), 314 download_manager_, id_.local(),
315 BytesSoFar(), CurrentSpeed(), GetHashState())); 315 BytesSoFar(), CurrentSpeed(), GetHashState()));
316 } 316 }
OLDNEW
« no previous file with comments | « content/browser/download/download_file_impl.h ('k') | content/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698