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

Side by Side Diff: content/browser/loader/temporary_file_stream.cc

Issue 2133083002: Remove all remaining traces of MessageLoopProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/loader/temporary_file_stream.h" 5 #include "content/browser/loader/temporary_file_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 14 matching lines...) Expand all
25 base::File::Error error_code, 25 base::File::Error error_code,
26 const base::FilePath& file_path) { 26 const base::FilePath& file_path) {
27 DCHECK_CURRENTLY_ON(BrowserThread::IO); 27 DCHECK_CURRENTLY_ON(BrowserThread::IO);
28 28
29 if (!file_proxy->IsValid()) { 29 if (!file_proxy->IsValid()) {
30 callback.Run(error_code, std::unique_ptr<net::FileStream>(), NULL); 30 callback.Run(error_code, std::unique_ptr<net::FileStream>(), NULL);
31 return; 31 return;
32 } 32 }
33 33
34 scoped_refptr<base::TaskRunner> task_runner = 34 scoped_refptr<base::TaskRunner> task_runner =
35 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); 35 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE);
36 36
37 // Cancelled or not, create the deletable_file so the temporary is cleaned up. 37 // Cancelled or not, create the deletable_file so the temporary is cleaned up.
38 scoped_refptr<ShareableFileReference> deletable_file = 38 scoped_refptr<ShareableFileReference> deletable_file =
39 ShareableFileReference::GetOrCreate( 39 ShareableFileReference::GetOrCreate(
40 file_path, 40 file_path,
41 ShareableFileReference::DELETE_ON_FINAL_RELEASE, 41 ShareableFileReference::DELETE_ON_FINAL_RELEASE,
42 task_runner.get()); 42 task_runner.get());
43 43
44 std::unique_ptr<net::FileStream> file_stream( 44 std::unique_ptr<net::FileStream> file_stream(
45 new net::FileStream(file_proxy->TakeFile(), task_runner)); 45 new net::FileStream(file_proxy->TakeFile(), task_runner));
46 46
47 callback.Run(error_code, std::move(file_stream), deletable_file.get()); 47 callback.Run(error_code, std::move(file_stream), deletable_file.get());
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 void CreateTemporaryFileStream( 52 void CreateTemporaryFileStream(
53 const CreateTemporaryFileStreamCallback& callback) { 53 const CreateTemporaryFileStreamCallback& callback) {
54 DCHECK_CURRENTLY_ON(BrowserThread::IO); 54 DCHECK_CURRENTLY_ON(BrowserThread::IO);
55 55
56 std::unique_ptr<base::FileProxy> file_proxy(new base::FileProxy( 56 std::unique_ptr<base::FileProxy> file_proxy(new base::FileProxy(
57 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get())); 57 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()));
58 base::FileProxy* proxy = file_proxy.get(); 58 base::FileProxy* proxy = file_proxy.get();
59 proxy->CreateTemporary( 59 proxy->CreateTemporary(
60 base::File::FLAG_ASYNC, 60 base::File::FLAG_ASYNC,
61 base::Bind(&DidCreateTemporaryFile, callback, Passed(&file_proxy))); 61 base::Bind(&DidCreateTemporaryFile, callback, Passed(&file_proxy)));
62 } 62 }
63 63
64 } // namespace content 64 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/media/android/browser_demuxer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698