Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Issue 559103002: Reduce memory peaks when generating data urls for images. (Closed)

Created:
6 years, 3 months ago by Daniel Bratell
Modified:
6 years, 3 months ago
CC:
blink-reviews, jamesr, caseq+blink_chromium.org, krit, loislo+blink_chromium.org, Rik, eustas+blink_chromium.org, malch+blink_chromium.org, yurys+blink_chromium.org, lushnikov+blink_chromium.org, jbroman, vsevik+blink_chromium.org, pfeldman+blink_chromium.org, paulirish+reviews_chromium.org, apavlov+blink_chromium.org, danakj, devtools-reviews_chromium.org, sergeyv+blink_chromium.org, aandrey+blink_chromium.org, Stephen Chennney, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Reduce memory peaks when generating data urls for images. Adding Vector<char> to a String results in one (or more) temporary copies of that Vector<char> since Vector isn't a pointer/smart pointer like the types usually used. Luckily there are many other ways to solve the problem. With StringBuilder or using a String. BUG=389085 (related to, not necessarily fixing it) Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181925

Patch Set 1 #

Total comments: 7

Patch Set 2 : toDataURL: Now with less parallel data. #

Patch Set 3 : toDataURL - now without freeing Vector early. #

Total comments: 1

Patch Set 4 : toDataURL(): Fewer temporary coppies of image data #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -8 lines) Patch
M Source/core/inspector/InspectorLayerTreeAgent.cpp View 1 2 chunks +6 lines, -1 line 0 comments Download
M Source/platform/graphics/ImageBuffer.cpp View 1 2 3 2 chunks +2 lines, -7 lines 0 comments Download

Messages

Total messages: 24 (4 generated)
Daniel Bratell
noel, can you please take a look at the Platform/graphics/ImageBuffer.cpp changes. pfeldman/caseq can you please ...
6 years, 3 months ago (2014-09-10 14:56:47 UTC) #2
pfeldman
inspector lgtm
6 years, 3 months ago (2014-09-10 18:32:17 UTC) #3
Noel Gordon
https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp File Source/core/inspector/InspectorLayerTreeAgent.cpp (right): https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp#newcode389 Source/core/inspector/InspectorLayerTreeAgent.cpp:389: url.reserveCapacity(url.length() + base64Data->size()); // Prevent over-allocation. nit: remove the ...
6 years, 3 months ago (2014-09-11 01:03:23 UTC) #5
Noel Gordon
https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp File Source/core/inspector/InspectorLayerTreeAgent.cpp (right): https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp#newcode388 Source/core/inspector/InspectorLayerTreeAgent.cpp:388: url.append("data:image/png;base64,"); per https://trac.webkit.org/wiki/EfficientStrings, I think want .appendLiteral here.
6 years, 3 months ago (2014-09-11 02:39:45 UTC) #6
pdr.
https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp File Source/core/inspector/InspectorLayerTreeAgent.cpp (right): https://codereview.chromium.org/559103002/diff/1/Source/core/inspector/InspectorLayerTreeAgent.cpp#newcode387 Source/core/inspector/InspectorLayerTreeAgent.cpp:387: StringBuilder url; Any reason for not using reserveCapacity before ...
6 years, 3 months ago (2014-09-11 04:38:16 UTC) #8
Daniel Bratell
Please take a new look. I also did an extra improvement in EncodedImageToDataURL to clear ...
6 years, 3 months ago (2014-09-11 11:22:32 UTC) #9
Noel Gordon
On 2014/09/11 11:22:32, Daniel Bratell wrote: > Please take a new look. > > I ...
6 years, 3 months ago (2014-09-12 07:32:37 UTC) #10
Noel Gordon
Also, I would check that using it does not add a terminating null to the ...
6 years, 3 months ago (2014-09-12 07:47:54 UTC) #11
Daniel Bratell
> On 2014/09/11 11:22:32, Daniel Bratell wrote: > > Please take a new look. > ...
6 years, 3 months ago (2014-09-12 09:55:40 UTC) #12
Daniel Bratell
noel, please take a new look at ImageBuffer.cpp. It's now a minimal change.
6 years, 3 months ago (2014-09-12 09:58:32 UTC) #13
Noel Gordon
The purpose here is to reduce peak memory usage and it seems there's been a ...
6 years, 3 months ago (2014-09-12 15:20:20 UTC) #14
Noel Gordon
lgtm - with nits Also seek approval from pdr@ also before submitting. https://codereview.chromium.org/559103002/diff/40001/Source/platform/graphics/ImageBuffer.cpp File Source/platform/graphics/ImageBuffer.cpp ...
6 years, 3 months ago (2014-09-12 15:23:42 UTC) #15
Daniel Bratell
On 2014/09/12 15:20:20, Noel Gordon wrote: > The purpose here is to reduce peak memory ...
6 years, 3 months ago (2014-09-12 15:32:01 UTC) #16
Daniel Bratell
Ah, pdr it is. I'll upload a new version in a sec.
6 years, 3 months ago (2014-09-12 15:32:31 UTC) #17
Daniel Bratell
pdr, can you please take a look at the ImageBuffer.cpp change?
6 years, 3 months ago (2014-09-12 15:34:24 UTC) #18
Noel Gordon
On 2014/09/12 15:32:31, Daniel Bratell wrote: > Ah, pdr it is. I'll upload a new ...
6 years, 3 months ago (2014-09-12 15:47:54 UTC) #19
Noel Gordon
On 2014/09/12 15:32:01, Daniel Bratell wrote: > There will be (at least) one copy too ...
6 years, 3 months ago (2014-09-12 15:56:58 UTC) #20
pdr.
LGTM
6 years, 3 months ago (2014-09-12 18:26:21 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/559103002/60001
6 years, 3 months ago (2014-09-12 18:27:34 UTC) #23
commit-bot: I haz the power
6 years, 3 months ago (2014-09-12 19:33:34 UTC) #24
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as 181925

Powered by Google App Engine
This is Rietveld 408576698