summaryrefslogtreecommitdiffstats
path: root/components/offline_pages
diff options
context:
space:
mode:
authorfgorski <fgorski@chromium.org>2015-07-14 22:15:18 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-15 05:15:48 +0000
commitce070d4fcac6cc85ed5aef48dea6aa3cbfbcf4e1 (patch)
tree59576d7e58f3b0a17ffb2d39ff93b62c24bdf67e /components/offline_pages
parente42c9af4a6ad5608129517d5485273eb2f38f163 (diff)
downloadchromium_src-ce070d4fcac6cc85ed5aef48dea6aa3cbfbcf4e1.zip
chromium_src-ce070d4fcac6cc85ed5aef48dea6aa3cbfbcf4e1.tar.gz
chromium_src-ce070d4fcac6cc85ed5aef48dea6aa3cbfbcf4e1.tar.bz2
[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}
Diffstat (limited to 'components/offline_pages')
-rw-r--r--components/offline_pages/offline_page_model.cc8
-rw-r--r--components/offline_pages/offline_page_model.h10
-rw-r--r--components/offline_pages/offline_page_model_unittest.cc2
3 files changed, 4 insertions, 16 deletions
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<OfflinePageMetadataStore> store,
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
+OfflinePageModel::OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> 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<void(LoadResult, const std::vector<OfflinePageItem>&)>
LoadAllPagesCallback;
- OfflinePageModel(
- scoped_ptr<OfflinePageMetadataStore> store,
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ explicit OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> store);
~OfflinePageModel() override;
// KeyedService implementation.
@@ -135,8 +129,6 @@ class OfflinePageModel : public KeyedService {
// Pending archivers owned by this model.
PendingArchivers pending_archivers_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
base::WeakPtrFactory<OfflinePageModel> 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<OfflinePageMetadataStore> OfflinePageModelTest::BuildStore() {
scoped_ptr<OfflinePageModel> OfflinePageModelTest::BuildModel() {
return scoped_ptr<OfflinePageModel>(
- new OfflinePageModel(BuildStore().Pass(), message_loop_.task_runner()));
+ new OfflinePageModel(BuildStore().Pass()));
}
void OfflinePageModelTest::PumpLoop() {