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

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

Issue 1575473002: Improve syncing between dom distiller and the print preview request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small code corrections Created 4 years, 11 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/dom_distiller_service.h" 5 #include "components/dom_distiller/core/dom_distiller_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // If a distiller is already running for one URL, don't start another. 182 // If a distiller is already running for one URL, don't start another.
183 if (was_created) { 183 if (was_created) {
184 task_tracker->StartDistiller(distiller_factory_.get(), 184 task_tracker->StartDistiller(distiller_factory_.get(),
185 std::move(distiller_page)); 185 std::move(distiller_page));
186 task_tracker->StartBlobFetcher(); 186 task_tracker->StartBlobFetcher();
187 } 187 }
188 188
189 return viewer_handle; 189 return viewer_handle;
190 } 190 }
191 191
192 scoped_ptr<ViewerHandle> DomDistillerService::AddViewRequestDelegate(
193 ViewRequestDelegate* delegate,
194 const GURL& url) {
195 TaskTracker* task_tracker = nullptr;
196 GetOrCreateTaskTrackerForUrl(url, &task_tracker);
nyquist 2016/01/20 16:59:08 If this returns true, doesn't that mean that there
mvendramini_hp 2016/01/21 16:54:46 Yes, you are right - in hindsight, that was not a
nyquist 2016/01/22 02:23:29 Yeah; I think GetTaskTrackerForUrl makes more sens
mvendramini_hp 2016/01/22 12:22:31 Done, adapted the code to not modify DomDistillerS
197 return task_tracker->AddViewer(delegate);
198 }
199
192 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( 200 bool DomDistillerService::GetOrCreateTaskTrackerForUrl(
193 const GURL& url, 201 const GURL& url,
194 TaskTracker** task_tracker) { 202 TaskTracker** task_tracker) {
195 ArticleEntry entry; 203 ArticleEntry entry;
196 if (store_->GetEntryByUrl(url, &entry)) { 204 if (store_->GetEntryByUrl(url, &entry)) {
197 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); 205 return GetOrCreateTaskTrackerForEntry(entry, task_tracker);
198 } 206 }
199 207
200 *task_tracker = GetTaskTrackerForUrl(url); 208 *task_tracker = GetTaskTrackerForUrl(url);
201 if (*task_tracker) { 209 if (*task_tracker) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { 284 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) {
277 DCHECK(observer); 285 DCHECK(observer);
278 store_->RemoveObserver(observer); 286 store_->RemoveObserver(observer);
279 } 287 }
280 288
281 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { 289 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() {
282 return distilled_page_prefs_.get(); 290 return distilled_page_prefs_.get();
283 } 291 }
284 292
285 } // namespace dom_distiller 293 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698