OLD | NEW |
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/distiller.h" | 5 #include "components/dom_distiller/core/distiller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 base::Unretained(fetcher), | 193 base::Unretained(fetcher), |
194 image_id)); | 194 image_id)); |
195 } | 195 } |
196 | 196 |
197 void DistillerImpl::OnFetchImageDone(int page_num, | 197 void DistillerImpl::OnFetchImageDone(int page_num, |
198 DistillerURLFetcher* url_fetcher, | 198 DistillerURLFetcher* url_fetcher, |
199 const std::string& id, | 199 const std::string& id, |
200 const std::string& response) { | 200 const std::string& response) { |
201 DCHECK(started_pages_index_.find(page_num) != started_pages_index_.end()); | 201 DCHECK(started_pages_index_.find(page_num) != started_pages_index_.end()); |
202 DistilledPageData* page_data = GetPageAtIndex(started_pages_index_[page_num]); | 202 DistilledPageData* page_data = GetPageAtIndex(started_pages_index_[page_num]); |
203 DCHECK(page_data->distilled_page_proto); | 203 DCHECK(page_data->distilled_page_proto.get()); |
204 DCHECK(url_fetcher); | 204 DCHECK(url_fetcher); |
205 ScopedVector<DistillerURLFetcher>::iterator fetcher_it = | 205 ScopedVector<DistillerURLFetcher>::iterator fetcher_it = |
206 std::find(page_data->image_fetchers_.begin(), | 206 std::find(page_data->image_fetchers_.begin(), |
207 page_data->image_fetchers_.end(), | 207 page_data->image_fetchers_.end(), |
208 url_fetcher); | 208 url_fetcher); |
209 | 209 |
210 DCHECK(fetcher_it != page_data->image_fetchers_.end()); | 210 DCHECK(fetcher_it != page_data->image_fetchers_.end()); |
211 // Delete the |url_fetcher| by DeleteSoon since the OnFetchImageDone | 211 // Delete the |url_fetcher| by DeleteSoon since the OnFetchImageDone |
212 // callback is invoked by the |url_fetcher|. | 212 // callback is invoked by the |url_fetcher|. |
213 page_data->image_fetchers_.weak_erase(fetcher_it); | 213 page_data->image_fetchers_.weak_erase(fetcher_it); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 DCHECK(finished_pages_index_.empty()); | 285 DCHECK(finished_pages_index_.empty()); |
286 | 286 |
287 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, | 287 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, |
288 false); | 288 false); |
289 finished_cb_.Run(article_proto.Pass()); | 289 finished_cb_.Run(article_proto.Pass()); |
290 finished_cb_.Reset(); | 290 finished_cb_.Reset(); |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 } // namespace dom_distiller | 294 } // namespace dom_distiller |
OLD | NEW |