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

Side by Side Diff: components/dom_distiller/core/task_tracker.cc

Issue 2037843002: Remove use of deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change precache Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/dom_distiller/core/task_tracker.h" 5 #include "components/dom_distiller/core/task_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
15 #include "components/dom_distiller/core/distilled_content_store.h" 14 #include "components/dom_distiller/core/distilled_content_store.h"
16 #include "components/dom_distiller/core/proto/distilled_article.pb.h" 15 #include "components/dom_distiller/core/proto/distilled_article.pb.h"
17 #include "components/dom_distiller/core/proto/distilled_page.pb.h" 16 #include "components/dom_distiller/core/proto/distilled_page.pb.h"
18 17
19 namespace dom_distiller { 18 namespace dom_distiller {
20 19
21 ViewerHandle::ViewerHandle(CancelCallback callback) 20 ViewerHandle::ViewerHandle(CancelCallback callback)
22 : cancel_callback_(callback) {} 21 : cancel_callback_(callback) {}
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return; 146 return;
148 } 147 }
149 148
150 DistilledArticleReady(std::move(distilled_article)); 149 DistilledArticleReady(std::move(distilled_article));
151 if (content_ready_) { 150 if (content_ready_) {
152 AddDistilledContentToStore(*distilled_article_); 151 AddDistilledContentToStore(*distilled_article_);
153 } 152 }
154 153
155 // 'distiller_ != null' is used as a signal that distillation is in progress, 154 // 'distiller_ != null' is used as a signal that distillation is in progress,
156 // so it needs to be released so that we know distillation is done. 155 // so it needs to be released so that we know distillation is done.
157 base::MessageLoop::current()->DeleteSoon(FROM_HERE, distiller_.release()); 156 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
157 distiller_.release());
158 158
159 ContentSourceFinished(); 159 ContentSourceFinished();
160 } 160 }
161 161
162 void TaskTracker::CancelPendingSources() { 162 void TaskTracker::CancelPendingSources() {
163 if (distiller_) { 163 if (distiller_) {
164 base::MessageLoop::current()->DeleteSoon(FROM_HERE, distiller_.release()); 164 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
165 distiller_.release());
165 } 166 }
166 } 167 }
167 168
168 void TaskTracker::OnBlobFetched( 169 void TaskTracker::OnBlobFetched(
169 bool success, 170 bool success,
170 std::unique_ptr<DistilledArticleProto> distilled_article) { 171 std::unique_ptr<DistilledArticleProto> distilled_article) {
171 blob_fetcher_running_ = false; 172 blob_fetcher_running_ = false;
172 173
173 if (content_ready_) { 174 if (content_ready_) {
174 return; 175 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void TaskTracker::AddDistilledContentToStore( 250 void TaskTracker::AddDistilledContentToStore(
250 const DistilledArticleProto& content) { 251 const DistilledArticleProto& content) {
251 if (content_store_) { 252 if (content_store_) {
252 content_store_->SaveContent( 253 content_store_->SaveContent(
253 entry_, content, DistilledContentStore::SaveCallback()); 254 entry_, content, DistilledContentStore::SaveCallback());
254 } 255 }
255 } 256 }
256 257
257 258
258 } // namespace dom_distiller 259 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/dom_distiller_service.cc ('k') | components/mus/public/cpp/tests/window_server_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698