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

Issue 1717273002: Added functional variants of Buffer::SetData and Buffer::AppendData. (Closed)

Created:
4 years, 10 months ago by ossu
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

Added functional variants of Buffer::SetData and Buffer::AppendData. They are invoked with the maximum size of the data to be added, and a callable that generates that data, like this: buffer.AppendData(10, [] (rtc::ArrayView<uint8_t> av) { for (uint8_t i = 0; i != 5; ++i) av[i] = i; return 5; }); The callable returns the number of bytes actually written, and the final Buffer size will be adjusted accordingly. SetData and AppendData both return the number of bytes added (i.e. the return value of the callable). These versions will be useful when converting AudioEncoder::Encode to use Buffer rather than raw pointers. Also added a few tests for the new functionality. Committed: https://crrev.com/b01c7816a8c4ef34102ead1a3eca4f389e7a8f43 Cr-Commit-Position: refs/heads/master@{#11733}

Patch Set 1 #

Total comments: 22

Patch Set 2 : Fixed various issues based on review comments. #

Total comments: 4

Patch Set 3 : Added a mutable lambda test and fixed two comments. #

Patch Set 4 : Fixed missing include of <algorithm> in buffer.cc and bufferqueue.cc #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+147 lines, -5 lines) Patch
M webrtc/base/buffer.h View 1 2 8 chunks +54 lines, -5 lines 0 comments Download
M webrtc/base/buffer.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M webrtc/base/buffer_unittest.cc View 1 2 1 chunk +90 lines, -0 lines 1 comment Download
M webrtc/base/bufferqueue.cc View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 34 (13 generated)
ossu
4 years, 10 months ago (2016-02-22 11:06:55 UTC) #3
tommi
I'll leave the main review to kwiberg. Happy to rubber stamp if that's needed. https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h ...
4 years, 10 months ago (2016-02-22 11:24:19 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1717273002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1717273002/1
4 years, 10 months ago (2016-02-22 11:24:32 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_arm64_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/ios_arm64_dbg/builds/7625) ios_arm64_rel on ...
4 years, 10 months ago (2016-02-22 11:25:31 UTC) #8
kwiberg-webrtc
https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h File webrtc/base/buffer.h (right): https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h#newcode130 webrtc/base/buffer.h:130: The lack of a blank line here was intended ...
4 years, 10 months ago (2016-02-22 13:27:27 UTC) #9
ossu
https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h File webrtc/base/buffer.h (right): https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h#newcode130 webrtc/base/buffer.h:130: On 2016/02/22 13:27:26, kwiberg-webrtc wrote: > The lack of ...
4 years, 10 months ago (2016-02-22 14:20:50 UTC) #10
kwiberg-webrtc
https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h File webrtc/base/buffer.h (right): https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer.h#newcode130 webrtc/base/buffer.h:130: On 2016/02/22 14:20:50, ossu wrote: > On 2016/02/22 13:27:26, ...
4 years, 10 months ago (2016-02-22 18:23:10 UTC) #11
ossu
Fixed issues as per comments.
4 years, 10 months ago (2016-02-23 09:49:20 UTC) #12
kwiberg-webrtc
lgtm, but see comments https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer_unittest.cc File webrtc/base/buffer_unittest.cc (right): https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer_unittest.cc#newcode257 webrtc/base/buffer_unittest.cc:257: On 2016/02/22 13:27:27, kwiberg-webrtc wrote: ...
4 years, 10 months ago (2016-02-23 10:06:10 UTC) #13
ossu
https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer_unittest.cc File webrtc/base/buffer_unittest.cc (right): https://codereview.webrtc.org/1717273002/diff/1/webrtc/base/buffer_unittest.cc#newcode257 webrtc/base/buffer_unittest.cc:257: On 2016/02/23 10:06:10, kwiberg-webrtc wrote: > On 2016/02/22 13:27:27, ...
4 years, 10 months ago (2016-02-23 10:11:39 UTC) #14
ossu
4 years, 10 months ago (2016-02-23 13:07:01 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1717273002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1717273002/40001
4 years, 10 months ago (2016-02-23 13:08:50 UTC) #18
commit-bot: I haz the power
Try jobs failed on following builders: win_x64_clang_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/win_x64_clang_rel/builds/1232)
4 years, 10 months ago (2016-02-23 13:17:47 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1717273002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1717273002/60001
4 years, 10 months ago (2016-02-23 14:11:05 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: presubmit on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/presubmit/builds/3625)
4 years, 10 months ago (2016-02-23 14:13:44 UTC) #25
ossu
Alright. Trybots seem happy. Rubber stamp, please! :)
4 years, 10 months ago (2016-02-23 16:58:00 UTC) #26
kwiberg-webrtc
https://codereview.webrtc.org/1717273002/diff/60001/webrtc/base/buffer_unittest.cc File webrtc/base/buffer_unittest.cc (right): https://codereview.webrtc.org/1717273002/diff/60001/webrtc/base/buffer_unittest.cc#newcode275 webrtc/base/buffer_unittest.cc:275: EXPECT_NE(buf.data<char>(), nullptr); // Data is actually stored. data has ...
4 years, 10 months ago (2016-02-23 17:50:38 UTC) #27
tommi
Rubberstamp lgtm. 😀
4 years, 10 months ago (2016-02-23 21:57:33 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1717273002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1717273002/60001
4 years, 10 months ago (2016-02-24 08:37:33 UTC) #30
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 10 months ago (2016-02-24 09:05:59 UTC) #32
commit-bot: I haz the power
4 years, 10 months ago (2016-02-24 09:06:08 UTC) #34
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/b01c7816a8c4ef34102ead1a3eca4f389e7a8f43
Cr-Commit-Position: refs/heads/master@{#11733}

Powered by Google App Engine
This is Rietveld 408576698