| Index: components/offline_pages/core/snapshot_controller.h
|
| diff --git a/components/offline_pages/core/snapshot_controller.h b/components/offline_pages/core/snapshot_controller.h
|
| index 6a7bc64822feebeb3943516716a0917d0f8b4a94..dd0ca01c878dfddcde0dcef4c6c466ac8be3b4e0 100644
|
| --- a/components/offline_pages/core/snapshot_controller.h
|
| +++ b/components/offline_pages/core/snapshot_controller.h
|
| @@ -30,6 +30,21 @@ class SnapshotController {
|
| SNAPSHOT_PENDING, // Snapshot is in progress, don't start another.
|
| STOPPED, // Terminal state, no snapshots until reset.
|
| };
|
| + // The expected quality of a page based on its current loading progress.
|
| + enum class PageQuality {
|
| + // Not loaded enough to reach a minimum level of quality. Snapshots taken at
|
| + // this point are expected to be useless.
|
| + POOR = 0,
|
| + // A minimal level of quality has been attained but the page is still
|
| + // loading so its quality is continuously increasing. One or more snapshots
|
| + // could be taken at this stage as later ones are expected to have higher
|
| + // quality.
|
| + FAIR_AND_IMPROVING,
|
| + // The page is loaded enough and has attained its peak expected quality.
|
| + // Snapshots taken at this point are not expected to increase in quality
|
| + // after the first one.
|
| + HIGH,
|
| + };
|
|
|
| // Client of the SnapshotController.
|
| class Client {
|
| @@ -76,8 +91,10 @@ class SnapshotController {
|
| size_t GetDelayAfterDocumentAvailableForTest();
|
| size_t GetDelayAfterDocumentOnLoadCompletedForTest();
|
|
|
| + PageQuality current_page_quality() const { return current_page_quality_; }
|
| +
|
| private:
|
| - void MaybeStartSnapshot();
|
| + void MaybeStartSnapshot(PageQuality updated_page_quality);
|
| void MaybeStartSnapshotThenStop();
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| @@ -87,6 +104,10 @@ class SnapshotController {
|
| size_t delay_after_document_available_ms_;
|
| size_t delay_after_document_on_load_completed_ms_;
|
|
|
| + // The expected quality of a snapshot taken at the moment this value is
|
| + // queried.
|
| + PageQuality current_page_quality_ = PageQuality::POOR;
|
| +
|
| base::WeakPtrFactory<SnapshotController> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SnapshotController);
|
|
|