diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 00:30:30 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 15:56:08 +0900 |
| commit | 697c1008f715669cdd6c8e5b7610a20182375253 (patch) | |
| tree | ae942c82de22caa3dc6273ff257827f80711bfc1 | |
| parent | 6b397c812520016f7b2b22544f51bfddbcca8dfe (diff) | |
DownloadEngine: Use std::unique_ptr for checkIntegrityMan_, fileAllocationMan_
| -rw-r--r-- | src/CheckIntegrityDispatcherCommand.cc | 2 | ||||
| -rw-r--r-- | src/CheckIntegrityDispatcherCommand.h | 2 | ||||
| -rw-r--r-- | src/DownloadEngine.cc | 8 | ||||
| -rw-r--r-- | src/DownloadEngine.h | 12 | ||||
| -rw-r--r-- | src/DownloadEngineFactory.cc | 12 | ||||
| -rw-r--r-- | src/FileAllocationDispatcherCommand.cc | 2 | ||||
| -rw-r--r-- | src/FileAllocationDispatcherCommand.h | 2 | ||||
| -rw-r--r-- | src/SequentialDispatcherCommand.h | 4 |
8 files changed, 22 insertions, 22 deletions
diff --git a/src/CheckIntegrityDispatcherCommand.cc b/src/CheckIntegrityDispatcherCommand.cc index 0ecf6334..9c512611 100644 --- a/src/CheckIntegrityDispatcherCommand.cc +++ b/src/CheckIntegrityDispatcherCommand.cc @@ -45,7 +45,7 @@ namespace aria2 { CheckIntegrityDispatcherCommand::CheckIntegrityDispatcherCommand (cuid_t cuid, - const std::shared_ptr<CheckIntegrityMan>& fileAllocMan, + CheckIntegrityMan* fileAllocMan, DownloadEngine* e) : SequentialDispatcherCommand<CheckIntegrityEntry>{cuid, fileAllocMan, e} { diff --git a/src/CheckIntegrityDispatcherCommand.h b/src/CheckIntegrityDispatcherCommand.h index 93c455e7..8a9b419e 100644 --- a/src/CheckIntegrityDispatcherCommand.h +++ b/src/CheckIntegrityDispatcherCommand.h @@ -47,7 +47,7 @@ class CheckIntegrityDispatcherCommand : public: CheckIntegrityDispatcherCommand (cuid_t cuid, - const std::shared_ptr<CheckIntegrityMan>& checkMan, + CheckIntegrityMan* checkMan, DownloadEngine* e); protected: virtual std::unique_ptr<Command> createCommand(CheckIntegrityEntry* entry); diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 8de6a316..347bce6a 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -585,15 +585,15 @@ void DownloadEngine::setRequestGroupMan } void DownloadEngine::setFileAllocationMan -(const std::shared_ptr<FileAllocationMan>& faman) +(std::unique_ptr<FileAllocationMan> faman) { - fileAllocationMan_ = faman; + fileAllocationMan_ = std::move(faman); } void DownloadEngine::setCheckIntegrityMan -(const std::shared_ptr<CheckIntegrityMan>& ciman) +(std::unique_ptr<CheckIntegrityMan> ciman) { - checkIntegrityMan_ = ciman; + checkIntegrityMan_ = std::move(ciman); } #ifdef HAVE_ARES_ADDR_NODE diff --git a/src/DownloadEngine.h b/src/DownloadEngine.h index 00f1aab2..29503fd7 100644 --- a/src/DownloadEngine.h +++ b/src/DownloadEngine.h @@ -169,8 +169,8 @@ private: std::deque<std::unique_ptr<Command>> commands_; std::shared_ptr<RequestGroupMan> requestGroupMan_; - std::shared_ptr<FileAllocationMan> fileAllocationMan_; - std::shared_ptr<CheckIntegrityMan> checkIntegrityMan_; + std::unique_ptr<FileAllocationMan> fileAllocationMan_; + std::unique_ptr<CheckIntegrityMan> checkIntegrityMan_; Option* option_; public: DownloadEngine(const std::shared_ptr<EventPoll>& eventPoll); @@ -211,19 +211,19 @@ public: void setRequestGroupMan(const std::shared_ptr<RequestGroupMan>& rgman); - const std::shared_ptr<FileAllocationMan>& getFileAllocationMan() const + const std::unique_ptr<FileAllocationMan>& getFileAllocationMan() const { return fileAllocationMan_; } - void setFileAllocationMan(const std::shared_ptr<FileAllocationMan>& faman); + void setFileAllocationMan(std::unique_ptr<FileAllocationMan> faman); - const std::shared_ptr<CheckIntegrityMan>& getCheckIntegrityMan() const + const std::unique_ptr<CheckIntegrityMan>& getCheckIntegrityMan() const { return checkIntegrityMan_; } - void setCheckIntegrityMan(const std::shared_ptr<CheckIntegrityMan>& ciman); + void setCheckIntegrityMan(std::unique_ptr<CheckIntegrityMan> ciman); Option* getOption() const { diff --git a/src/DownloadEngineFactory.cc b/src/DownloadEngineFactory.cc index 9d3fb85d..0227e061 100644 --- a/src/DownloadEngineFactory.cc +++ b/src/DownloadEngineFactory.cc @@ -153,19 +153,19 @@ DownloadEngineFactory::newDownloadEngine (std::move(requestGroups), MAX_CONCURRENT_DOWNLOADS, op); requestGroupMan->initWrDiskCache(); e->setRequestGroupMan(requestGroupMan); - e->setFileAllocationMan - (std::shared_ptr<FileAllocationMan>(new FileAllocationMan())); + e->setFileAllocationMan(make_unique<FileAllocationMan>()); #ifdef ENABLE_MESSAGE_DIGEST - e->setCheckIntegrityMan - (std::shared_ptr<CheckIntegrityMan>(new CheckIntegrityMan())); + e->setCheckIntegrityMan(make_unique<CheckIntegrityMan>()); #endif // ENABLE_MESSAGE_DIGEST e->addRoutineCommand(make_unique<FillRequestGroupCommand> (e->newCUID(), e.get())); e->addRoutineCommand(make_unique<FileAllocationDispatcherCommand> - (e->newCUID(), e->getFileAllocationMan(), e.get())); + (e->newCUID(), e->getFileAllocationMan().get(), + e.get())); #ifdef ENABLE_MESSAGE_DIGEST e->addRoutineCommand(make_unique<CheckIntegrityDispatcherCommand> - (e->newCUID(), e->getCheckIntegrityMan(), e.get())); + (e->newCUID(), e->getCheckIntegrityMan().get(), + e.get())); #endif // ENABLE_MESSAGE_DIGEST if(op->getAsInt(PREF_AUTO_SAVE_INTERVAL) > 0) { diff --git a/src/FileAllocationDispatcherCommand.cc b/src/FileAllocationDispatcherCommand.cc index 4cc9c43d..926f437f 100644 --- a/src/FileAllocationDispatcherCommand.cc +++ b/src/FileAllocationDispatcherCommand.cc @@ -45,7 +45,7 @@ namespace aria2 { FileAllocationDispatcherCommand::FileAllocationDispatcherCommand (cuid_t cuid, - const std::shared_ptr<FileAllocationMan>& fileAllocMan, + FileAllocationMan* fileAllocMan, DownloadEngine* e) : SequentialDispatcherCommand<FileAllocationEntry>{cuid, fileAllocMan, e} {} diff --git a/src/FileAllocationDispatcherCommand.h b/src/FileAllocationDispatcherCommand.h index ce1fe05c..a595632f 100644 --- a/src/FileAllocationDispatcherCommand.h +++ b/src/FileAllocationDispatcherCommand.h @@ -47,7 +47,7 @@ class FileAllocationDispatcherCommand : public: FileAllocationDispatcherCommand (cuid_t cuid, - const std::shared_ptr<FileAllocationMan>& fileAllocMan, + FileAllocationMan* fileAllocMan, DownloadEngine* e); protected: virtual std::unique_ptr<Command> createCommand(FileAllocationEntry* entry); diff --git a/src/SequentialDispatcherCommand.h b/src/SequentialDispatcherCommand.h index 8680629d..359807e2 100644 --- a/src/SequentialDispatcherCommand.h +++ b/src/SequentialDispatcherCommand.h @@ -50,7 +50,7 @@ class DownloadEngine; template<typename T> class SequentialDispatcherCommand : public Command { private: - std::shared_ptr<SequentialPicker<T> > picker_; + SequentialPicker<T>* picker_; DownloadEngine* e_; protected: @@ -61,7 +61,7 @@ protected: public: SequentialDispatcherCommand (cuid_t cuid, - const std::shared_ptr<SequentialPicker<T>>& picker, + SequentialPicker<T>* picker, DownloadEngine* e) : Command{cuid}, picker_{picker}, e_{e} { |
