From ce070d4fcac6cc85ed5aef48dea6aa3cbfbcf4e1 Mon Sep 17 00:00:00 2001 From: fgorski Date: Tue, 14 Jul 2015 22:15:18 -0700 Subject: [Offline Pages] Removing task runner from OfflinePageModel BUG=491352 R=jianli@chromium.org Review URL: https://codereview.chromium.org/1227093011 Cr-Commit-Position: refs/heads/master@{#338817} --- components/offline_pages/offline_page_model.cc | 8 ++------ components/offline_pages/offline_page_model.h | 10 +--------- components/offline_pages/offline_page_model_unittest.cc | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) (limited to 'components/offline_pages') diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc index 943297a..bcedcda 100644 --- a/components/offline_pages/offline_page_model.cc +++ b/components/offline_pages/offline_page_model.cc @@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" -#include "base/single_thread_task_runner.h" #include "components/offline_pages/offline_page_item.h" #include "components/offline_pages/offline_page_metadata_store.h" #include "url/gurl.h" @@ -48,11 +47,8 @@ SavePageResult ToSavePageResult(ArchiverResult archiver_result) { } // namespace -OfflinePageModel::OfflinePageModel( - scoped_ptr store, - const scoped_refptr& task_runner) +OfflinePageModel::OfflinePageModel(scoped_ptr store) : store_(store.Pass()), - task_runner_(task_runner), weak_ptr_factory_(this) { } @@ -142,7 +138,7 @@ void OfflinePageModel::OnLoadDone( void OfflinePageModel::InformSavePageDone(const SavePageCallback& callback, SavePageResult result) { - task_runner_->PostTask(FROM_HERE, base::Bind(callback, result)); + callback.Run(result); } void OfflinePageModel::DeletePendingArchiver(OfflinePageArchiver* archiver) { diff --git a/components/offline_pages/offline_page_model.h b/components/offline_pages/offline_page_model.h index fbfab50..8716a0b 100644 --- a/components/offline_pages/offline_page_model.h +++ b/components/offline_pages/offline_page_model.h @@ -18,10 +18,6 @@ class GURL; -namespace base { -class SingleThreadTaskRunner; -} // namespace base - namespace offline_pages { struct OfflinePageItem; @@ -81,9 +77,7 @@ class OfflinePageModel : public KeyedService { typedef base::Callback&)> LoadAllPagesCallback; - OfflinePageModel( - scoped_ptr store, - const scoped_refptr& task_runner); + explicit OfflinePageModel(scoped_ptr store); ~OfflinePageModel() override; // KeyedService implementation. @@ -135,8 +129,6 @@ class OfflinePageModel : public KeyedService { // Pending archivers owned by this model. PendingArchivers pending_archivers_; - scoped_refptr task_runner_; - base::WeakPtrFactory weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(OfflinePageModel); diff --git a/components/offline_pages/offline_page_model_unittest.cc b/components/offline_pages/offline_page_model_unittest.cc index 1e1621b..af9becf 100644 --- a/components/offline_pages/offline_page_model_unittest.cc +++ b/components/offline_pages/offline_page_model_unittest.cc @@ -239,7 +239,7 @@ scoped_ptr OfflinePageModelTest::BuildStore() { scoped_ptr OfflinePageModelTest::BuildModel() { return scoped_ptr( - new OfflinePageModel(BuildStore().Pass(), message_loop_.task_runner())); + new OfflinePageModel(BuildStore().Pass())); } void OfflinePageModelTest::PumpLoop() { -- cgit v1.1