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

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

Issue 2503813002: Fix and refactor downloaded file handling in the loading stack (Closed)
Patch Set: +RunUntilIdle Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/loader/downloaded_temp_file_impl.h"
6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 #include "storage/browser/blob/shareable_file_reference.h"
9
10 namespace content {
11
12 DownloadedTempFileImpl::DownloadedTempFileImpl(ResourceDispatcherHostImpl* rdh,
13 int child_id,
14 int request_id,
15 const base::FilePath& path)
16 : binding_(this),
17 rdh_(rdh),
18 child_id_(child_id),
19 request_id_(request_id),
20 reference_(storage::ShareableFileReference::Get(path)) {
21 DCHECK(rdh_);
22 DCHECK(reference_);
23 }
24
25 DownloadedTempFileImpl::~DownloadedTempFileImpl() {}
26
27 void DownloadedTempFileImpl::OnConnectionError() {
28 rdh_->UnregisterDownloadedTempFile(child_id_, request_id_);
29 }
30
31 mojo::InterfacePtr<mojom::DownloadedTempFile>
32 DownloadedTempFileImpl::CreateInterfacePtrAndBind() {
33 auto ptr = binding_.CreateInterfacePtrAndBind();
34 binding_.set_connection_error_handler(base::Bind(
35 &DownloadedTempFileImpl::OnConnectionError, base::Unretained(this)));
36 return ptr;
37 }
38
39 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698