diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 00:17:44 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-07-06 15:56:08 +0900 |
| commit | 6b397c812520016f7b2b22544f51bfddbcca8dfe (patch) | |
| tree | 6dcf656fb19da47833324111efcee62c66809365 /src/FileAllocationCommand.cc | |
| parent | c9e58779e1a30b32ea2f86e686211d901aca19f0 (diff) | |
Use std::unique_ptr for CheckIntegrityEntry and FileAllocationEntry
Diffstat (limited to 'src/FileAllocationCommand.cc')
| -rw-r--r-- | src/FileAllocationCommand.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/FileAllocationCommand.cc b/src/FileAllocationCommand.cc index b76357cc..a36f44cf 100644 --- a/src/FileAllocationCommand.cc +++ b/src/FileAllocationCommand.cc @@ -54,16 +54,19 @@ namespace aria2 { FileAllocationCommand::FileAllocationCommand (cuid_t cuid, RequestGroup* requestGroup, DownloadEngine* e, - const std::shared_ptr<FileAllocationEntry>& fileAllocationEntry): - RealtimeCommand(cuid, requestGroup, e), - fileAllocationEntry_(fileAllocationEntry) {} + FileAllocationEntry* fileAllocationEntry) + : RealtimeCommand{cuid, requestGroup, e}, + fileAllocationEntry_{fileAllocationEntry} +{} -FileAllocationCommand::~FileAllocationCommand() {} +FileAllocationCommand::~FileAllocationCommand() +{ + getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); +} bool FileAllocationCommand::executeInternal() { if(getRequestGroup()->isHaltRequested()) { - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); return true; } fileAllocationEntry_->allocateChunk(); @@ -72,8 +75,6 @@ bool FileAllocationCommand::executeInternal() (fmt(MSG_ALLOCATION_COMPLETED, static_cast<long int>(timer_.difference(global::wallclock())), getRequestGroup()->getTotalLength())); - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); - std::vector<std::unique_ptr<Command>> commands; fileAllocationEntry_->prepareForNextAction(commands, getDownloadEngine()); getDownloadEngine()->addCommand(std::move(commands)); @@ -87,7 +88,6 @@ bool FileAllocationCommand::executeInternal() bool FileAllocationCommand::handleException(Exception& e) { - getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, getCuid()), e); |
