Commit 2b42028
committed
[WPE] Increased memory consumption of WebProcess during regular video playback and RWI
https://bugs.webkit.org/show_bug.cgi?id=284108
Reviewed by Devin Rousso.
When WebInspector is used, the downloaded data is cached also for it in NetworkResourcesData.
The single resource data cannot be greater than maximumSingleResourceContentSize (50MB) and
the total size of resources content cannot be greater than maximumResourcesContentSize (200MB).
At the end of downloading the resource, the binary data is decoded to the string represantation
(base64 or other depends on decoder). Decoding process can increased the size of the kept resource
data. The limit maximumSingleResourceContentSize is checked but maximumResourcesContentSize limit
is not checked which can lead to situation that m_contentSize (the total size of resources content)
is greater than maximumResourcesContentSize. This causes that condition checked in
NetworkResourcesData::ensureFreeSpace is invalid because subtraction unsigned values where
first value(minuend) is smaller than the second one(subtrahend) gives a huge number (instead of
negative number).
This change ensures that after decoding binary data into string representation the total size of
resources content (m_contentSize) is not greater than maximumResourcesContentSize. The assert is
added in NetworkResourcesData::ensureFreeSpace to check that m_contentSize is not greater than
maximumResourcesContentSize.
I fixed implementation of function NetworkResourcesData::clear in case passing the preservedLoaderId.
In that case we should update m_requestIdsDeque and m_contentSize and not just clear them.
Additionally I changed the type of m_requestIdsDeque from Deque<String> to ListHashSet<String>.
This change fixes adding to m_requestIdsDeque the same requestId many times.
* Source/WebCore/inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
(WebCore::NetworkResourcesData::setResourceContent):
(WebCore::NetworkResourcesData::maybeAddResourceData):
(WebCore::NetworkResourcesData::maybeDecodeDataToContent):
(WebCore::NetworkResourcesData::clear):
(WebCore::NetworkResourcesData::ensureFreeSpace):
* Source/WebCore/inspector/NetworkResourcesData.h:
Canonical link: https://commits.webkit.org/289143@main1 parent f9ed45c commit 2b42028
2 files changed
Lines changed: 35 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
260 | 268 | | |
261 | 269 | | |
262 | 270 | | |
| |||
313 | 321 | | |
314 | 322 | | |
315 | 323 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 324 | + | |
320 | 325 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
326 | 340 | | |
327 | | - | |
328 | | - | |
329 | 341 | | |
330 | 342 | | |
331 | 343 | | |
| |||
357 | 369 | | |
358 | 370 | | |
359 | 371 | | |
| 372 | + | |
360 | 373 | | |
361 | 374 | | |
362 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
0 commit comments