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

Unified Diff: services/asset_bundle/asset_unpacker_job.cc

Issue 1206673006: Don't use base::WorkerPool in the asset_bundle app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: move comment Created 5 years, 6 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
« no previous file with comments | « services/asset_bundle/asset_unpacker_job.h ('k') | services/asset_bundle/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/asset_bundle/asset_unpacker_job.cc
diff --git a/services/asset_bundle/asset_unpacker_job.cc b/services/asset_bundle/asset_unpacker_job.cc
index 0c0ef9d8116a09b72c8da1fda47f636372e77e48..c5582d065c5e29acfc58e644c6bbb7fb976591c9 100644
--- a/services/asset_bundle/asset_unpacker_job.cc
+++ b/services/asset_bundle/asset_unpacker_job.cc
@@ -9,7 +9,6 @@
#include "base/files/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "base/threading/worker_pool.h"
#include "services/asset_bundle/asset_bundle_impl.h"
#include "third_party/zlib/google/zip.h"
@@ -33,8 +32,12 @@ void UnzipAssets(
} // namespace
-AssetUnpackerJob::AssetUnpackerJob(InterfaceRequest<AssetBundle> asset_bundle)
- : asset_bundle_(asset_bundle.Pass()), weak_factory_(this) {
+AssetUnpackerJob::AssetUnpackerJob(
+ InterfaceRequest<AssetBundle> asset_bundle,
+ scoped_refptr<base::TaskRunner> worker_runner)
+ : asset_bundle_(asset_bundle.Pass()),
+ worker_runner_(worker_runner.Pass()),
+ weak_factory_(this) {
}
AssetUnpackerJob::~AssetUnpackerJob() {
@@ -46,9 +49,7 @@ void AssetUnpackerJob::Unpack(ScopedDataPipeConsumerHandle zipped_assets) {
delete this;
return;
}
- scoped_refptr<base::TaskRunner> worker =
- base::WorkerPool::GetTaskRunner(true);
- common::CopyToFile(zipped_assets.Pass(), zip_path, worker.get(),
+ common::CopyToFile(zipped_assets.Pass(), zip_path, worker_runner_.get(),
base::Bind(&AssetUnpackerJob::OnZippedAssetsAvailable,
weak_factory_.GetWeakPtr(), zip_path));
}
@@ -64,19 +65,18 @@ void AssetUnpackerJob::OnZippedAssetsAvailable(const base::FilePath& zip_path,
delete this;
return;
}
- base::WorkerPool::PostTask(
+ worker_runner_->PostTask(
FROM_HERE,
base::Bind(&UnzipAssets, zip_path, base::Passed(asset_dir.Pass()),
base::MessageLoop::current()->task_runner(),
base::Bind(&AssetUnpackerJob::OnUnzippedAssetsAvailable,
- weak_factory_.GetWeakPtr())),
- true);
+ weak_factory_.GetWeakPtr())));
}
void AssetUnpackerJob::OnUnzippedAssetsAvailable(
scoped_ptr<base::ScopedTempDir> asset_dir) {
if (asset_dir)
- new AssetBundleImpl(asset_bundle_.Pass(), asset_dir.Pass());
+ new AssetBundleImpl(asset_bundle_.Pass(), asset_dir.Pass(), worker_runner_);
delete this;
}
« no previous file with comments | « services/asset_bundle/asset_unpacker_job.h ('k') | services/asset_bundle/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698