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

Unified Diff: content/browser/download/save_package.h

Issue 2032283002: Remove refcounting from SavePackage. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/save_package.h
diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h
index d4219814c881d31ebe67e1254edb1de64b7e87f2..9b96e5ba1725385c1c8a50e27d424f4b4404d662 100644
--- a/content/browser/download/save_package.h
+++ b/content/browser/download/save_package.h
@@ -18,7 +18,6 @@
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "content/browser/download/save_types.h"
@@ -58,11 +57,9 @@ class WebContents;
// saved. Each file is represented by a SaveItem, and all SaveItems are owned
// by the SavePackage. SaveItems are created when a user initiates a page
// saving job, and exist for the duration of one contents's life time.
-class CONTENT_EXPORT SavePackage
- : public base::RefCountedThreadSafe<SavePackage>,
- public WebContentsObserver,
- public DownloadItem::Observer,
- public base::SupportsWeakPtr<SavePackage> {
+class CONTENT_EXPORT SavePackage : public WebContentsObserver,
+ public DownloadItem::Observer,
+ public base::SupportsWeakPtr<SavePackage> {
public:
enum WaitState {
// State when created but not initialized.
@@ -96,6 +93,8 @@ class CONTENT_EXPORT SavePackage
const base::FilePath& file_full_path,
const base::FilePath& directory_full_path);
+ ~SavePackage() override;
+
// Initialize the SavePackage. Returns true if it initializes properly. Need
// to make sure that this method must be called in the UI thread because using
// g_browser_process on a non-UI thread can cause crashes during shutdown.
@@ -131,8 +130,6 @@ class CONTENT_EXPORT SavePackage
void GetSaveInfo();
private:
- friend class base::RefCountedThreadSafe<SavePackage>;
-
void InitWithDownloadItem(
const SavePackageDownloadCreatedCallback& download_created_callback,
DownloadItemImpl* item);
@@ -145,8 +142,6 @@ class CONTENT_EXPORT SavePackage
const base::FilePath& file_full_path,
const base::FilePath& directory_full_path);
- ~SavePackage() override;
-
// Notes from Init() above applies here as well.
void InternalInit();
@@ -277,10 +272,9 @@ class CONTENT_EXPORT SavePackage
const std::string& mime_type);
void ContinueGetSaveInfo(const base::FilePath& suggested_path,
bool can_save_as_complete);
- void OnPathPicked(
- const base::FilePath& final_name,
- SavePageType type,
- const SavePackageDownloadCreatedCallback& cb);
+ void OnPathPicked(const base::FilePath& final_name,
+ SavePageType type,
asanka 2016/06/06 18:55:09 There's a bunch of unrelated formatting changes in
+ const SavePackageDownloadCreatedCallback& cb);
// Map from SaveItem::id() (aka save_item_id) into a SaveItem.
using SaveItemIdMap =
@@ -321,7 +315,8 @@ class CONTENT_EXPORT SavePackage
// Ensures that the file name has a proper extension for supported formats
// if necessary.
- static base::FilePath EnsureMimeExtension(const base::FilePath& name,
+ static base::FilePath EnsureMimeExtension(
+ const base::FilePath& name,
const std::string& contents_mime_type);
// Returns extension for supported MIME types (for example, for "text/plain"
@@ -392,10 +387,9 @@ class CONTENT_EXPORT SavePackage
// Number of all need to be saved resources.
size_t all_save_items_count_;
- using FileNameSet =
- std::set<base::FilePath::StringType,
- bool (*)(base::FilePath::StringPieceType,
- base::FilePath::StringPieceType)>;
+ using FileNameSet = std::set<base::FilePath::StringType,
+ bool (*)(base::FilePath::StringPieceType,
+ base::FilePath::StringPieceType)>;
// This set is used to eliminate duplicated file names in saving directory.
FileNameSet file_name_set_;
« no previous file with comments | « no previous file | content/browser/download/save_package.cc » ('j') | content/browser/web_contents/web_contents_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698