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

Issue 2385803002: Add a SkRWBuffer reserve mechanism (Closed)

Created:
4 years, 2 months ago by f(malita)
Modified:
4 years, 2 months ago
CC:
reviews_skia.org
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Add a SkRWBuffer reserve mechanism Currently, Chromium stores segmented data in a SharedBuffer and appends to SkRWBuffer one segment at a time: const char* segment = 0; for (size_t length = data->getSomeData(segment, m_rwBuffer->size()); length; length = data->getSomeData(segment, m_rwBuffer->size())) { m_rwBuffer->append(segment, length, remaining); } This can yield a bunch of just-above-4k allocations => wasted RAM due to internal fragmentation. Ideally, we'd want a SkRWBuffer::reserve(size_t bytes) API, but the current internals don't support that trivially. Alternatively, the caller can pass a reserve hint at append() time. BUG=chromium:651698 R=scroggo@google.com,reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2385803002 Committed: https://skia.googlesource.com/skia/+/5776508126534db2af97d560588e7046e745df65

Patch Set 1 #

Patch Set 2 : missed the initial allocation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -4 lines) Patch
M include/core/SkRWBuffer.h View 1 chunk +9 lines, -1 line 0 comments Download
M src/core/SkRWBuffer.cpp View 1 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 21 (11 generated)
f(malita)
4 years, 2 months ago (2016-09-30 17:04:12 UTC) #2
scroggo
lgtm
4 years, 2 months ago (2016-09-30 17:35:48 UTC) #7
f(malita)
Prolly need Mike too, for public header.
4 years, 2 months ago (2016-09-30 17:57:35 UTC) #8
Dmitry Skiba
This API it not very convenient, caller has to calculate reserve on every call because ...
4 years, 2 months ago (2016-09-30 19:08:02 UTC) #10
f(malita)
On 2016/09/30 19:08:02, Dmitry Skiba wrote: > This API it not very convenient, caller has ...
4 years, 2 months ago (2016-09-30 19:35:22 UTC) #13
reed1
lgtm
4 years, 2 months ago (2016-09-30 19:40:09 UTC) #14
Dmitry Skiba
On 2016/09/30 19:35:22, f(malita) wrote: > On 2016/09/30 19:08:02, Dmitry Skiba wrote: > > This ...
4 years, 2 months ago (2016-09-30 20:00:25 UTC) #15
f(malita)
On 2016/09/30 20:00:25, Dmitry Skiba wrote: > But that control loop is just a single ...
4 years, 2 months ago (2016-09-30 20:16:17 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2385803002/20001
4 years, 2 months ago (2016-09-30 20:17:06 UTC) #19
commit-bot: I haz the power
4 years, 2 months ago (2016-09-30 20:34:22 UTC) #21
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://skia.googlesource.com/skia/+/5776508126534db2af97d560588e7046e745df65

Powered by Google App Engine
This is Rietveld 408576698