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

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

Issue 4188008: Use make_scoped_refptr for NewRunnableMethod if the raw ptr type is derivd from RefCountedThreadSafe (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: address comment Created 10 years, 1 month 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) 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/download_file_manager.h" 5 #include "chrome/browser/download/download_file_manager.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 NewRunnableFunction(&download_util::CancelDownloadRequest, 169 NewRunnableFunction(&download_util::CancelDownloadRequest,
170 resource_dispatcher_host_, 170 resource_dispatcher_host_,
171 info->child_id, 171 info->child_id,
172 info->request_id)); 172 info->request_id));
173 delete info; 173 delete info;
174 return; 174 return;
175 } 175 }
176 176
177 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 177 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
178 NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile, 178 NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile,
179 info, manager)); 179 info, make_scoped_refptr(manager)));
180 } 180 }
181 181
182 // We don't forward an update to the UI thread here, since we want to throttle 182 // We don't forward an update to the UI thread here, since we want to throttle
183 // the UI update rate via a periodic timer. If the user has cancelled the 183 // the UI update rate via a periodic timer. If the user has cancelled the
184 // download (in the UI thread), we may receive a few more updates before the IO 184 // download (in the UI thread), we may receive a few more updates before the IO
185 // thread gets the cancel message: we just delete the data since the 185 // thread gets the cancel message: we just delete the data since the
186 // DownloadFile has been deleted. 186 // DownloadFile has been deleted.
187 void DownloadFileManager::UpdateDownload(int id, DownloadBuffer* buffer) { 187 void DownloadFileManager::UpdateDownload(int id, DownloadBuffer* buffer) {
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
189 std::vector<DownloadBuffer::Contents> contents; 189 std::vector<DownloadBuffer::Contents> contents;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (!download_manager) { 357 if (!download_manager) {
358 download->CancelDownloadRequest(resource_dispatcher_host_); 358 download->CancelDownloadRequest(resource_dispatcher_host_);
359 return; 359 return;
360 } 360 }
361 361
362 BrowserThread::PostTask( 362 BrowserThread::PostTask(
363 BrowserThread::UI, FROM_HERE, 363 BrowserThread::UI, FROM_HERE,
364 NewRunnableMethod(download_manager, 364 NewRunnableMethod(download_manager,
365 &DownloadManager::DownloadCancelled, id)); 365 &DownloadManager::DownloadCancelled, id));
366 } 366 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_http_protocol_handler.cc ('k') | chrome/browser/file_path_watcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698