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

Issue 1697743003: Add CopyOnWriteBuffer class (Closed)

Created:
4 years, 10 months ago by joachim
Modified:
4 years, 10 months ago
Reviewers:
tommi, kwiberg-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Add CopyOnWriteBuffer class This CL introduces a new class CopyOnWriteBuffer that holds data in a refcounted Buffer which is shared between copied CopyOnWriteBuffer to avoid unnecessary allocations / memory copies. BUG=webrtc:5155 Committed: https://crrev.com/13041cf11f1c2691bb3ddc7d28e74cae9333b685 Cr-Commit-Position: refs/heads/master@{#11767}

Patch Set 1 #

Patch Set 2 : Readded more IsConsistent checks. #

Patch Set 3 : Fixed indent #

Patch Set 4 : Move constructor code to .cc (fixes GN builds) #

Total comments: 7

Patch Set 5 : Feedback from Tommi #

Patch Set 6 : Removed atomicops.h #

Total comments: 10

Patch Set 7 : Feedback from kwiberg. #

Total comments: 8

Patch Set 8 : Added CopyOnWriteBuffer class #

Total comments: 23

Patch Set 9 : Feedback from kwiberg + more tests. #

Total comments: 8

Patch Set 10 : More feedback from kwiberg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+502 lines, -0 lines) Patch
M webrtc/base/BUILD.gn View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/base/base.gyp View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/base/base_tests.gyp View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A webrtc/base/copyonwritebuffer.h View 1 2 3 4 5 6 7 8 9 1 chunk +256 lines, -0 lines 0 comments Download
A webrtc/base/copyonwritebuffer.cc View 1 2 3 4 5 6 7 8 9 1 chunk +42 lines, -0 lines 0 comments Download
A webrtc/base/copyonwritebuffer_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +199 lines, -0 lines 0 comments Download

Messages

Total messages: 32 (8 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1697743003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1697743003/60001
4 years, 10 months ago (2016-02-13 16:08:16 UTC) #2
joachim
Ptal https://codereview.webrtc.org/1697743003/diff/60001/webrtc/base/buffer.h File webrtc/base/buffer.h (right): https://codereview.webrtc.org/1697743003/diff/60001/webrtc/base/buffer.h#newcode126 webrtc/base/buffer.h:126: // Reimplement parts of RefCountedObject which is not ...
4 years, 10 months ago (2016-02-13 16:08:46 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_baremetal on tryserver.webrtc (JOB_TIMED_OUT, no build URL)
4 years, 10 months ago (2016-02-13 18:08:34 UTC) #6
tommi
Nice - Adding kwiberg as well. https://codereview.webrtc.org/1697743003/diff/60001/webrtc/base/buffer.h File webrtc/base/buffer.h (right): https://codereview.webrtc.org/1697743003/diff/60001/webrtc/base/buffer.h#newcode51 webrtc/base/buffer.h:51: class BufferData { ...
4 years, 10 months ago (2016-02-14 09:03:42 UTC) #8
joachim
Updated, assuming https://codereview.webrtc.org/1701533002/ has landed and "scoped_ref_ptr.h" also moved to "rtc_base_approved". https://codereview.webrtc.org/1697743003/diff/60001/webrtc/base/buffer.h File webrtc/base/buffer.h (right): ...
4 years, 10 months ago (2016-02-14 11:10:19 UTC) #9
kwiberg-webrtc
Hmmm... I'm not convinced. You add a lot of complexity, including an extra heap allocation, ...
4 years, 10 months ago (2016-02-14 14:43:46 UTC) #10
joachim
Thanks for your feedback, I uploaded a new patch set that addresses your comments. The ...
4 years, 10 months ago (2016-02-14 17:10:17 UTC) #11
kwiberg-webrtc
Still not entirely convinced that CoW is the right thing for Buffer. Its behavior gets ...
4 years, 10 months ago (2016-02-15 12:33:16 UTC) #12
tommi
https://codereview.webrtc.org/1697743003/diff/120001/webrtc/base/buffer.cc File webrtc/base/buffer.cc (right): https://codereview.webrtc.org/1697743003/diff/120001/webrtc/base/buffer.cc#newcode34 webrtc/base/buffer.cc:34: Buffer::Buffer(Buffer&& buf) : data_(std::move(buf.data_)) { On 2016/02/15 12:33:16, kwiberg-webrtc ...
4 years, 10 months ago (2016-02-15 14:56:51 UTC) #13
kwiberg-webrtc
https://codereview.webrtc.org/1697743003/diff/120001/webrtc/base/buffer.cc File webrtc/base/buffer.cc (right): https://codereview.webrtc.org/1697743003/diff/120001/webrtc/base/buffer.cc#newcode34 webrtc/base/buffer.cc:34: Buffer::Buffer(Buffer&& buf) : data_(std::move(buf.data_)) { On 2016/02/15 14:56:51, tommi-webrtc ...
4 years, 10 months ago (2016-02-15 15:05:03 UTC) #14
kwiberg-webrtc
On 2016/02/15 12:33:16, kwiberg-webrtc wrote: > Still not entirely convinced that CoW is the right ...
4 years, 10 months ago (2016-02-15 17:40:18 UTC) #15
joachim
On 2016/02/15 17:40:18, kwiberg-webrtc wrote: > On 2016/02/15 12:33:16, kwiberg-webrtc wrote: > > Still not ...
4 years, 10 months ago (2016-02-15 22:19:17 UTC) #16
kwiberg-webrtc
On 2016/02/15 22:19:17, joachim wrote: > On 2016/02/15 17:40:18, kwiberg-webrtc wrote: > > On 2016/02/15 ...
4 years, 10 months ago (2016-02-16 06:07:26 UTC) #17
joachim
Ok, I decided to split this up in two CLs. This one will add the ...
4 years, 10 months ago (2016-02-19 00:27:53 UTC) #19
kwiberg-webrtc
Looks good. Just some small comments: https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.cc File webrtc/base/copyonwritebuffer.cc (right): https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.cc#newcode22 webrtc/base/copyonwritebuffer.cc:22: : buffer_(std::move(buf.buffer_)) { ...
4 years, 10 months ago (2016-02-19 12:36:21 UTC) #20
joachim
All changed + added more tests. https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.cc File webrtc/base/copyonwritebuffer.cc (right): https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.cc#newcode22 webrtc/base/copyonwritebuffer.cc:22: : buffer_(std::move(buf.buffer_)) { ...
4 years, 10 months ago (2016-02-19 20:37:42 UTC) #21
kwiberg-webrtc
Just a few more comments, most of them optional. https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.h File webrtc/base/copyonwritebuffer.h (right): https://codereview.webrtc.org/1697743003/diff/140001/webrtc/base/copyonwritebuffer.h#newcode15 webrtc/base/copyonwritebuffer.h:15: ...
4 years, 10 months ago (2016-02-20 06:43:32 UTC) #22
joachim
All changed, ptal. https://codereview.webrtc.org/1697743003/diff/160001/webrtc/base/copyonwritebuffer.cc File webrtc/base/copyonwritebuffer.cc (right): https://codereview.webrtc.org/1697743003/diff/160001/webrtc/base/copyonwritebuffer.cc#newcode24 webrtc/base/copyonwritebuffer.cc:24: buf.buffer_ = nullptr; On 2016/02/20 06:43:32, ...
4 years, 10 months ago (2016-02-23 23:25:35 UTC) #23
kwiberg-webrtc
lgtm
4 years, 10 months ago (2016-02-24 11:49:41 UTC) #24
joachim
On 2016/02/24 11:49:41, kwiberg-webrtc wrote: > lgtm Thanks! @tommi: Ptal for owner review.
4 years, 10 months ago (2016-02-24 15:22:43 UTC) #25
tommi
lgtm
4 years, 10 months ago (2016-02-25 12:52:20 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1697743003/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1697743003/180001
4 years, 10 months ago (2016-02-25 12:52:28 UTC) #28
commit-bot: I haz the power
Committed patchset #10 (id:180001)
4 years, 10 months ago (2016-02-25 14:16:56 UTC) #30
commit-bot: I haz the power
4 years, 10 months ago (2016-02-25 14:17:06 UTC) #32
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/13041cf11f1c2691bb3ddc7d28e74cae9333b685
Cr-Commit-Position: refs/heads/master@{#11767}

Powered by Google App Engine
This is Rietveld 408576698