tree: 235051df4802440f86e0ad111e3d6185a7328668 [path history] [tgz]
  1. DEPS
  2. OWNERS
  3. README.md
  4. shared_dictionary_access_checker.cc
  5. shared_dictionary_access_checker.h
  6. shared_dictionary_constants.cc
  7. shared_dictionary_constants.h
  8. shared_dictionary_data_pipe_writer.cc
  9. shared_dictionary_data_pipe_writer.h
  10. shared_dictionary_data_pipe_writer_unittest.cc
  11. shared_dictionary_disk_cache.cc
  12. shared_dictionary_disk_cache.h
  13. shared_dictionary_disk_cache_unittest.cc
  14. shared_dictionary_in_memory.cc
  15. shared_dictionary_in_memory.h
  16. shared_dictionary_manager.cc
  17. shared_dictionary_manager.h
  18. shared_dictionary_manager_in_memory.cc
  19. shared_dictionary_manager_in_memory.h
  20. shared_dictionary_manager_on_disk.cc
  21. shared_dictionary_manager_on_disk.h
  22. shared_dictionary_manager_on_disk_unittest.cc
  23. shared_dictionary_manager_unittest.cc
  24. shared_dictionary_on_disk.cc
  25. shared_dictionary_on_disk.h
  26. shared_dictionary_on_disk_unittest.cc
  27. shared_dictionary_storage.cc
  28. shared_dictionary_storage.h
  29. shared_dictionary_storage_in_memory.cc
  30. shared_dictionary_storage_in_memory.h
  31. shared_dictionary_storage_on_disk.cc
  32. shared_dictionary_storage_on_disk.h
  33. shared_dictionary_writer.h
  34. shared_dictionary_writer_in_memory.cc
  35. shared_dictionary_writer_in_memory.h
  36. shared_dictionary_writer_in_memory_unittest.cc
  37. shared_dictionary_writer_on_disk.cc
  38. shared_dictionary_writer_on_disk.h
  39. shared_dictionary_writer_on_disk_unittest.cc
  40. simple_url_pattern_matcher.cc
  41. simple_url_pattern_matcher.h
  42. simple_url_pattern_matcher_unittest.cc
services/network/shared_dictionary/README.md

Compression dictionary transport with Shared Brotli

This directory contains the implementation for Compression Dictionary Transport with Shared Brotli.

Class overview

When NetworkContextParams.shared_dictionary_enabled flag is enabled, a SharedDictionaryManager is attached to a NetworkContext. The SharedDictionaryManager manages SharedDictionaryStorage, which is created per net::NetworkIsolationKey. SharedDictionaryStorage manages compression dictionaries, also known as shared dictionaries.

We have two implementations of SharedDictionaryManager, SharedDictionaryStorage, SharedDictionaryWriter and SharedDictionary. Classes with an “InMemory” suffix in their name are for incognito mode. And classes with an “OnDisk” suffix are for normal Profiles. (Note: We are currently actively implementing “OnDisk” classes.)

Storing dictionaries

When CorsURLLoader receives a HTTP response, it calls SharedDictionaryStorage::MaybeCreateWriter(). If the received header contans an appropriate 'use-as-dictionary' header, this method returns a SharedDictionaryWriter. CorsURLLoader then creates a SharedDictionaryDataPipeWriter to write the response body to the storege via the SharedDictionaryWriter.

SharedDictionaryWriterInMemory just copies the response body to the memory. SharedDictionaryWriterOnDisk writes the response body to the disk cache using SharedDictionaryDiskCache class.

When SharedDictionaryWriter finishes writing the body, SharedDictionaryStorage::OnDictionaryWritten will be called. SharedDictionaryStorageInMemory just keeps the dictionary information in the memory. SharedDictionaryStorageOnDisk will stores the dictionary information to the storage database (Note: Not implemented yet).

Limitations

We currently set a size limit of 100 MiB per dictionary. This is intended to protect the network services from out-of-memory denial-of-service attacks.

Flags

The feature of Compression dictionary transport with Shared Brotli is currently controlled by two flags.

  1. CompressionDictionaryTransportBackend

    • Users can enable/disable using chrome://flags/#enable-compression-dictionary-transport-backend.
    • This feature will be enabled/disabled by Field Trial Config.
    • This will be used for kill-switch. All feature must be disabled when this feature is disabled.
    • When this feature is enabled, the network service will check the storage of dictionaries while feching resources.
  2. CompressionDictionaryTransport

    • Users can enable/disable using chrome://flags/#enable-compression-dictionary-transport
    • This feature can be enabled by Origin Trial.
    • This feature can also be enabled/disabled by Field Trial Config.
    • When both the backend feature and this feature are enabled:
      • The network service will store HTTP responses with “use-as-dictionary” response header to the dictionary storage. (Note: Not implemented yet.)
      • Blink will fetch the dictionary after detecting <link rel=compression-dictionary> in the document HTML or “Link: rel=compression-dictionary” in the HTTP response header. (Note: Not implemented yet.)
      • HTMLLinkElement.relList.supports(‘dictionary’) will return true. (Note: Not implemented yet.)
    • Note: Until M126, rel=dictionary was used instead of rel=compression-dictionary.

Links