提交 1f28c037 编写于 作者: C Chinmay Garde

Delete temporary files created for the sound pool after the pool is collected

上级 7fac7000
......@@ -55,6 +55,7 @@ class SoundPoolImpl : public ::media::SoundPool {
private:
mojo::StrongBinding<::media::SoundPool> binding_;
SoundPoolClient* sound_pool_;
std::vector<base::FilePath> temp_files_;
void onCopyToTemp(const ::media::SoundPool::LoadCallback& callback,
base::FilePath path,
......
......@@ -5,6 +5,7 @@
#include "sky/services/media/ios/sound_pool_impl.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_loop.h"
#include "mojo/data_pipe_utils/data_pipe_utils.h"
......@@ -171,6 +172,10 @@ SoundPoolImpl::SoundPoolImpl(mojo::InterfaceRequest<::media::SoundPool> request)
SoundPoolImpl::~SoundPoolImpl() {
[sound_pool_ release];
for (const auto& path : temp_files_) {
base::DeleteFile(path, false);
}
}
static base::FilePath TemporaryFilePath() {
......@@ -205,6 +210,8 @@ void SoundPoolImpl::onCopyToTemp(
return;
}
temp_files_.push_back(path);
// After the copy, initialize the audio player instance in the pool
NSString* filePath =
[NSString stringWithUTF8String:path.AsUTF8Unsafe().c_str()];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册