File: README.md

package info (click to toggle)
chromium 145.0.7632.159-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,976,224 kB
  • sloc: cpp: 36,198,469; ansic: 7,634,080; javascript: 3,564,060; python: 1,649,622; xml: 838,470; asm: 717,087; pascal: 185,708; sh: 88,786; perl: 88,718; objc: 79,984; sql: 59,811; cs: 42,452; fortran: 24,101; makefile: 21,144; tcl: 15,277; php: 14,022; yacc: 9,066; ruby: 7,553; awk: 3,720; lisp: 3,233; lex: 1,328; ada: 727; jsp: 228; sed: 36
file content (81 lines) | stat: -rw-r--r-- 3,740 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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

- [Explainer](https://github.com/WICG/compression-dictionary-transport)
- [Crbug](httpe://crbug.com/1413922)
- [Chrome Status](https://chromestatus.com/feature/5124977788977152)
- [Design doc](https://docs.google.com/document/d/1IcRHLv-e9boECgPA5J4t8NDv9FPHDGgn0C12kfBgANg/edit?usp=sharing)