tree: a22c263512c65b302c1b9f77b6a0ba9c99e68d62 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. README.md
  4. fake_suggestions_provider.cc
  5. fake_suggestions_provider.h
  6. generate_page_bundle_request.cc
  7. generate_page_bundle_request.h
  8. generate_page_bundle_request_unittest.cc
  9. get_operation_request.cc
  10. get_operation_request.h
  11. get_operation_request_unittest.cc
  12. mock_prefetch_item_generator.cc
  13. mock_prefetch_item_generator.h
  14. mock_thumbnail_fetcher.cc
  15. mock_thumbnail_fetcher.h
  16. offline_metrics_collector.h
  17. prefetch_background_task.cc
  18. prefetch_background_task.h
  19. prefetch_background_task_handler.h
  20. prefetch_dispatcher.h
  21. prefetch_dispatcher_impl.cc
  22. prefetch_dispatcher_impl.h
  23. prefetch_dispatcher_impl_unittest.cc
  24. prefetch_download_flow_unittest.cc
  25. prefetch_downloader.h
  26. prefetch_downloader_impl.cc
  27. prefetch_downloader_impl.h
  28. prefetch_downloader_impl_unittest.cc
  29. prefetch_gcm_app_handler.cc
  30. prefetch_gcm_app_handler.h
  31. prefetch_gcm_app_handler_unittest.cc
  32. prefetch_gcm_handler.h
  33. prefetch_importer.cc
  34. prefetch_importer.h
  35. prefetch_importer_impl.cc
  36. prefetch_importer_impl.h
  37. prefetch_importer_impl_unittest.cc
  38. prefetch_item.cc
  39. prefetch_item.h
  40. prefetch_item_unittest.cc
  41. prefetch_network_request_factory.h
  42. prefetch_network_request_factory_impl.cc
  43. prefetch_network_request_factory_impl.h
  44. prefetch_network_request_factory_impl_unittest.cc
  45. prefetch_prefs.cc
  46. prefetch_prefs.h
  47. prefetch_proto_utils.cc
  48. prefetch_proto_utils.h
  49. prefetch_request_fetcher.cc
  50. prefetch_request_fetcher.h
  51. prefetch_request_fetcher_unittest.cc
  52. prefetch_request_operation_response_unittest.cc
  53. prefetch_request_test_base.cc
  54. prefetch_request_test_base.h
  55. prefetch_server_urls.cc
  56. prefetch_server_urls.h
  57. prefetch_server_urls_unittest.cc
  58. prefetch_service.h
  59. prefetch_service_impl.cc
  60. prefetch_service_impl.h
  61. prefetch_service_impl_unittest.cc
  62. prefetch_service_test_taco.cc
  63. prefetch_service_test_taco.h
  64. prefetch_types.cc
  65. prefetch_types.h
  66. proto/
  67. store/
  68. stub_prefetch_service.cc
  69. stub_prefetch_service.h
  70. suggested_articles_observer.cc
  71. suggested_articles_observer.h
  72. suggested_articles_observer_unittest.cc
  73. suggestions_provider.cc
  74. suggestions_provider.h
  75. tasks/
  76. test_download_client.cc
  77. test_download_client.h
  78. test_download_service.cc
  79. test_download_service.h
  80. test_offline_metrics_collector.h
  81. test_prefetch_dispatcher.cc
  82. test_prefetch_dispatcher.h
  83. test_prefetch_downloader.cc
  84. test_prefetch_downloader.h
  85. test_prefetch_gcm_handler.cc
  86. test_prefetch_gcm_handler.h
  87. test_prefetch_importer.cc
  88. test_prefetch_importer.h
  89. test_prefetch_network_request_factory.cc
  90. test_prefetch_network_request_factory.h
  91. test_util.cc
  92. thumbnail_fetch_by_url.cc
  93. thumbnail_fetch_by_url.h
  94. thumbnail_fetcher.h
components/offline_pages/core/prefetch/README.md

Prefetching Offline Pages

Architecture overview

PrefetchService

Is the ownership holder for the main components of the prefetching system and controls their lifetime.

PrefetchDispatcher

Manages the prefetching pipeline tasks. It receives signals from external clients and creates the appropriate tasks to execute them. It might at some point execute advanced task management operations like canceling queued tasks or changing their order of execution.

*Task(s) (i.e. AddUniqueUrlsTask)

They are the main wrapper of pipeline steps and interact with different abstracted components (Downloads, persistent store, GCM, etc) to execute them. They implement TaskQueue's Task API so that they can be exclusively executed.

Prefetch store

  • The PrefetchStore depends publicly on SQL and acts as a gateway to the SQLite database.
  • It defines specific method signatures used to create callbacks that are passed to the store for the proper execution of SQL commands.
  • SQL access resources are granted to those callbacks only when needed and in an appropriate environment (correct thread, etc).
  • Pipeline tasks define methods following those signatures that contain the SQL commands they require to do their work.
  • Tasks receive a pointer to the store to be able to execute their SQL commands.

More detailed instructions of how to use Prefetch store can be found here

Development guidelines

  • Implementations that are injected dependencies during service creation should have lightweight construction and postpone heavier initialization (i.e. DB connection) to a later moment. Lazy initialization upon first actual usage is recommended.