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

Unified Diff: content/browser/loader/downloaded_temp_file_impl.h

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/downloaded_temp_file_impl.h
diff --git a/content/browser/loader/downloaded_temp_file_impl.h b/content/browser/loader/downloaded_temp_file_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4a44d55b0f56f9247e41b242df14947eaaeed66
--- /dev/null
+++ b/content/browser/loader/downloaded_temp_file_impl.h
@@ -0,0 +1,59 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_
+#define CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_
+
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+#include "content/common/url_loader_factory.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace storage {
+class ShareableFileReference;
+}
+
+namespace content {
+
+class ResourceDispatcherHostImpl;
+
+// DownloadedTempFileImpl is created on the download_to_file mode of resource
+// loading. The instance is held by ResourceDispatcherHostImpl and slightly
+// outlives URLLoader until the client destroyes the interface.
dcheng 2016/11/17 11:16:02 Nit: destroys
mmenke 2016/11/17 16:59:33 "outlives until" isn't grammatically correct. May
mmenke 2016/11/17 16:59:33 "URLLoader"? This is also used on the non-Mojo pa
tzik 2016/11/22 13:54:45 Done.
+class CONTENT_EXPORT DownloadedTempFileImpl final
+ : public mojom::DownloadedTempFile {
+ public:
+ DownloadedTempFileImpl(ResourceDispatcherHostImpl* rdh,
+ int child_id,
+ int request_id,
+ const base::FilePath& path);
+ ~DownloadedTempFileImpl() override;
+
+ mojo::InterfacePtr<mojom::DownloadedTempFile> CreateInterfacePtrAndBind();
+
+ int child_id() const { return child_id_; }
+ int request_id() const { return request_id_; }
mmenke 2016/11/17 16:59:33 Not actually used? (Well, it's used in RDH, but n
+ const scoped_refptr<storage::ShareableFileReference>& reference() const {
+ return reference_;
+ }
+
+ private:
+ void OnConnectionError();
+
+ mojo::Binding<DownloadedTempFile> binding_;
+
+ ResourceDispatcherHostImpl* rdh_;
+ int child_id_;
+ int request_id_;
+
+ scoped_refptr<storage::ShareableFileReference> reference_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadedTempFileImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_DOWNLOADED_TEMP_FILE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698