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

Unified Diff: components/dom_distiller/core/distiller.h

Issue 178303004: Add incremental updates for multipage distillation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile by adding a header. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/distiller.h
diff --git a/components/dom_distiller/core/distiller.h b/components/dom_distiller/core/distiller.h
index 0b3a49f2385f4ba2737503679844d5378a8ab519..52de61e3a34744ce8df4075a088632beb5a4d4ba 100644
--- a/components/dom_distiller/core/distiller.h
+++ b/components/dom_distiller/core/distiller.h
@@ -5,12 +5,15 @@
#ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_
#define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_
+#include <map>
#include <string>
#include "base/callback.h"
#include "base/containers/hash_tables.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "components/dom_distiller/core/article_distillation_update.h"
#include "components/dom_distiller/core/distiller_url_fetcher.h"
#include "components/dom_distiller/core/page_distiller.h"
#include "components/dom_distiller/core/proto/distilled_article.pb.h"
@@ -24,13 +27,17 @@ class DistillerImpl;
class Distiller {
public:
typedef base::Callback<void(scoped_ptr<DistilledArticleProto>)>
- DistillerCallback;
+ ArticleDistillationCallback;
+ typedef base::Callback<void(const ArticleDistillationUpdate&)>
+ PageDistillationCallback;
cjhopman 2014/02/28 02:38:14 How about: DistillationFinishedCallback and Disti
cjhopman 2014/02/28 02:38:14 Consider making a new class for these callbacks (i
shashi 2014/03/02 02:53:40 Done.
shashi 2014/03/02 02:53:40 Done.
+
virtual ~Distiller() {}
// Distills a page, and asynchrounously returns the article HTML to the
cjhopman 2014/02/28 02:38:14 s/asynchrounously/asynchronously
shashi 2014/03/02 02:53:40 Done.
// supplied callback.
cjhopman 2014/02/28 02:38:14 Update this comment to reflect these changes.
shashi 2014/03/02 02:53:40 Done.
virtual void DistillPage(const GURL& url,
- const DistillerCallback& callback) = 0;
+ const ArticleDistillationCallback& article_cb,
+ const PageDistillationCallback& page_cb) = 0;
};
class DistillerFactory {
@@ -66,7 +73,8 @@ class DistillerImpl : public Distiller {
virtual void Init();
virtual void DistillPage(const GURL& url,
- const DistillerCallback& callback) OVERRIDE;
+ const ArticleDistillationCallback& article_cb,
+ const PageDistillationCallback& page_cb) OVERRIDE;
void SetMaxNumPagesInArticle(size_t max_num_pages);
@@ -84,7 +92,7 @@ class DistillerImpl : public Distiller {
int page_num;
std::string title;
ScopedVector<DistillerURLFetcher> image_fetchers_;
- scoped_ptr<DistilledPageProto> proto;
+ scoped_refptr<base::RefCountedData<DistilledPageProto> > proto;
private:
DISALLOW_COPY_AND_ASSIGN(DistilledPageData);
@@ -122,7 +130,7 @@ class DistillerImpl : public Distiller {
// includes pages that are pending distillation.
size_t TotalPageCount() const;
- // Runs |distillation_cb_| if all distillation callbacks and image fetches are
+ // Runs |article_cb_| if all distillation callbacks and image fetches are
// complete.
void RunDistillerCallbackIfDone();
@@ -134,7 +142,8 @@ class DistillerImpl : public Distiller {
const DistillerURLFetcherFactory& distiller_url_fetcher_factory_;
scoped_ptr<PageDistiller> page_distiller_;
- DistillerCallback distillation_cb_;
+ ArticleDistillationCallback article_cb_;
+ PageDistillationCallback page_cb_;
// Set of pages that are under distillation or have finished distillation.
// |started_pages_index_| and |finished_pages_index_| maintains the mapping

Powered by Google App Engine
This is Rietveld 408576698