X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcomponents%2Fdom_distiller%2Fcore%2Ftask_tracker.h;h=a6df540ee97f0a9973bde61ad7eed7f94225c321;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=dc066beeb5419ba7718de95eac5c7764b61ccf2a;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/components/dom_distiller/core/task_tracker.h b/src/components/dom_distiller/core/task_tracker.h index dc066be..a6df540 100644 --- a/src/components/dom_distiller/core/task_tracker.h +++ b/src/components/dom_distiller/core/task_tracker.h @@ -21,6 +21,7 @@ class GURL; namespace dom_distiller { class DistilledArticleProto; +class DistilledContentStore; // A handle to a request to view a DOM distiller entry or URL. The request will // be cancelled when the handle is destroyed. @@ -75,11 +76,14 @@ class TaskTracker { void(const ArticleEntry&, const DistilledArticleProto*, bool)> SaveCallback; - TaskTracker(const ArticleEntry& entry, CancelCallback callback); + TaskTracker(const ArticleEntry& entry, + CancelCallback callback, + DistilledContentStore* content_store); ~TaskTracker(); // |factory| will not be stored after this call. - void StartDistiller(DistillerFactory* factory); + void StartDistiller(DistillerFactory* factory, + scoped_ptr distiller_page); void StartBlobFetcher(); void AddSaveCallback(const SaveCallback& callback); @@ -94,33 +98,47 @@ class TaskTracker { bool HasUrl(const GURL& url) const; private: + void OnArticleDistillationUpdated( + const ArticleDistillationUpdate& article_update); + void OnDistillerFinished(scoped_ptr distilled_article); + void OnBlobFetched(bool success, + scoped_ptr distilled_article); + + void RemoveViewer(ViewRequestDelegate* delegate); - void OnDistilledArticleReady( + void DistilledArticleReady( scoped_ptr distilled_article); - void OnArticleDistillationUpdated( - const ArticleDistillationUpdate& article_update); + // Posts a task to run DoSaveCallbacks with |distillation_succeeded|. void ScheduleSaveCallbacks(bool distillation_succeeded); - // Runs all callbacks passing |distillation_succeeded| and clears them. Should - // be called through ScheduleSaveCallbacks. + // Runs all callbacks passing |distillation_succeeded| and clears them. void DoSaveCallbacks(bool distillation_succeeded); - void RemoveViewer(ViewRequestDelegate* delegate); + void AddDistilledContentToStore(const DistilledArticleProto& content); + + void NotifyViewersAndCallbacks(); void NotifyViewer(ViewRequestDelegate* delegate); + bool IsAnySourceRunning() const; + void ContentSourceFinished(); + + void CancelPendingSources(); void MaybeCancel(); CancelCallback cancel_callback_; - std::vector save_callbacks_; - scoped_ptr distiller_; + DistilledContentStore* content_store_; + std::vector save_callbacks_; // A ViewRequestDelegate will be added to this list when a view request is // made and removed when the corresponding ViewerHandle is destroyed. std::vector viewers_; + scoped_ptr distiller_; + bool blob_fetcher_running_; + ArticleEntry entry_; scoped_ptr distilled_article_;