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

Issue 1785713005: Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed)

Created:
4 years, 9 months ago by joachim
Modified:
4 years, 9 months ago
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

Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. This CL removes copy and assign support from Buffer and changes various parameters from Buffer to CopyOnWriteBuffer so they can be passed along and copied without actually copying the underlying data. With this changed some parameters to be "const" and fixed an issue when creating a CopyOnWriteBuffer with empty data. BUG=webrtc:5155 Committed: https://crrev.com/944c39006f1c52aee20919676002dac7a42b1c05 Cr-Commit-Position: refs/heads/master@{#12058}

Patch Set 1 #

Patch Set 2 : Fix errors on bots (java, objc). #

Total comments: 10

Patch Set 3 : Feedback on CopyOnWriteBuffer changes. #

Total comments: 11

Patch Set 4 : Feedback from tommi. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+295 lines, -246 lines) Patch
M talk/app/webrtc/objc/RTCDataChannel.mm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/api/datachannel.h View 3 chunks +4 lines, -4 lines 0 comments Download
M webrtc/api/datachannel.cc View 3 chunks +5 lines, -5 lines 0 comments Download
M webrtc/api/datachannel_unittest.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M webrtc/api/datachannelinterface.h View 3 chunks +3 lines, -3 lines 0 comments Download
M webrtc/api/java/jni/peerconnection_jni.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M webrtc/api/objc/RTCDataChannel.mm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/api/peerconnectioninterface_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/api/sctputils.h View 1 chunk +6 lines, -6 lines 0 comments Download
M webrtc/api/sctputils.cc View 1 2 3 6 chunks +19 lines, -17 lines 0 comments Download
M webrtc/api/test/fakedatachannelprovider.h View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/api/webrtcsession.h View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/api/webrtcsession.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/api/webrtcsession_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/buffer.h View 3 chunks +2 lines, -7 lines 0 comments Download
M webrtc/base/buffer.cc View 1 chunk +0 lines, -3 lines 0 comments Download
M webrtc/base/buffer_unittest.cc View 1 chunk +0 lines, -17 lines 0 comments Download
M webrtc/base/copyonwritebuffer.h View 1 2 3 2 chunks +15 lines, -2 lines 0 comments Download
M webrtc/base/copyonwritebuffer_unittest.cc View 1 2 3 3 chunks +61 lines, -0 lines 0 comments Download
M webrtc/base/sslfingerprint.h View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/media/base/fakemediaengine.h View 4 chunks +8 lines, -8 lines 0 comments Download
M webrtc/media/base/fakenetworkinterface.h View 8 chunks +14 lines, -15 lines 0 comments Download
M webrtc/media/base/mediachannel.h View 6 chunks +11 lines, -9 lines 0 comments Download
M webrtc/media/base/rtpdataengine.h View 1 chunk +3 lines, -3 lines 0 comments Download
M webrtc/media/base/rtpdataengine.cc View 6 chunks +7 lines, -7 lines 0 comments Download
M webrtc/media/base/rtpdataengine_unittest.cc View 9 chunks +9 lines, -9 lines 0 comments Download
M webrtc/media/base/videoengine_unittest.h View 11 chunks +18 lines, -16 lines 0 comments Download
M webrtc/media/engine/webrtcvideoengine2.h View 1 chunk +2 lines, -2 lines 0 comments Download
M webrtc/media/engine/webrtcvideoengine2.cc View 7 chunks +10 lines, -10 lines 0 comments Download
M webrtc/media/engine/webrtcvideoengine2_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M webrtc/media/engine/webrtcvoiceengine.h View 2 chunks +4 lines, -6 lines 0 comments Download
M webrtc/media/engine/webrtcvoiceengine.cc View 5 chunks +10 lines, -12 lines 0 comments Download
M webrtc/media/engine/webrtcvoiceengine_unittest.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M webrtc/media/sctp/sctpdataengine.h View 4 chunks +7 lines, -7 lines 0 comments Download
M webrtc/media/sctp/sctpdataengine.cc View 11 chunks +20 lines, -19 lines 0 comments Download
M webrtc/media/sctp/sctpdataengine_unittest.cc View 6 chunks +8 lines, -10 lines 0 comments Download
M webrtc/pc/channel.h View 8 chunks +14 lines, -14 lines 0 comments Download
M webrtc/pc/channel.cc View 10 chunks +12 lines, -12 lines 0 comments Download
M webrtc/pc/channel_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 22 (7 generated)
joachim
Ptal, this is a follow up to https://codereview.webrtc.org/1697743003 As suggested in #15 in that CL, ...
4 years, 9 months ago (2016-03-11 22:59:58 UTC) #2
kwiberg-webrtc
Did you change Buffer -> CopyOnWriteBuffer only where you had to? (That is, where the ...
4 years, 9 months ago (2016-03-14 11:53:49 UTC) #3
joachim
Yes, I only changed what I needed to make it compile again. However at some ...
4 years, 9 months ago (2016-03-17 20:27:21 UTC) #4
kwiberg-webrtc
lgtm (Note that you'll also need lgtm from OWNER(s) of all these directories.) https://codereview.webrtc.org/1785713005/diff/20001/webrtc/base/copyonwritebuffer_unittest.cc File ...
4 years, 9 months ago (2016-03-18 05:27:11 UTC) #5
joachim
+tkchin for talk/app/webrtc/objc and webrtc/api/objc +tommi for webrtc/api, webrtc/base and webrtc/pc +pthatcher for webrtc/media
4 years, 9 months ago (2016-03-18 08:28:56 UTC) #7
tommi
This is pretty awesome :D alas no good deed goes unpunished... There are a few ...
4 years, 9 months ago (2016-03-18 10:54:37 UTC) #8
joachim
Thanks for your feedback. https://codereview.webrtc.org/1785713005/diff/40001/webrtc/api/sctputils.cc File webrtc/api/sctputils.cc (right): https://codereview.webrtc.org/1785713005/diff/40001/webrtc/api/sctputils.cc#newcode39 webrtc/api/sctputils.cc:39: rtc::ByteBuffer buffer(payload.data<char>(), payload.size()); On 2016/03/18 ...
4 years, 9 months ago (2016-03-18 12:18:08 UTC) #9
tommi
lgtm! thanks very much for improving sctputils.cc along the way.
4 years, 9 months ago (2016-03-18 13:22:28 UTC) #10
tkchin_webrtc
lgtm Thanks!
4 years, 9 months ago (2016-03-18 17:57:50 UTC) #14
tommi
Committing since I think Peter is ooo.
4 years, 9 months ago (2016-03-19 07:57:13 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1785713005/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1785713005/60001
4 years, 9 months ago (2016-03-19 07:57:30 UTC) #17
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 9 months ago (2016-03-19 08:57:37 UTC) #18
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/944c39006f1c52aee20919676002dac7a42b1c05 Cr-Commit-Position: refs/heads/master@{#12058}
4 years, 9 months ago (2016-03-19 08:57:47 UTC) #20
kjellander_webrtc
A revert of this CL (patchset #4 id:60001) has been created in https://codereview.webrtc.org/1817753003/ by kjellander@webrtc.org. ...
4 years, 9 months ago (2016-03-19 19:12:37 UTC) #21
joachim
4 years, 9 months ago (2016-03-20 10:14:34 UTC) #22
Message was sent while issue was closed.
On 2016/03/19 19:12:37, kjellander (webrtc) wrote:
> A revert of this CL (patchset #4 id:60001) has been created in
> https://codereview.webrtc.org/1817753003/ by mailto:kjellander@webrtc.org.
> 
> The reason for reverting is: I'm really sorry for having to revert this but it
> seems this hit an unexpected compile error downstream:
> 
> webrtc/media/sctp/sctpdataengine.cc: In function 'void
> cricket::VerboseLogPacket(const void*, size_t, int)':
> webrtc/media/sctp/sctpdataengine.cc:172:37: error: invalid conversion from
> 'const void*' to 'void*' [-fpermissive]
>               data, length, direction)) != NULL) {
>                                      ^
> In file included from webrtc/media/sctp/sctpdataengine.cc:20:0:
> third_party/usrsctp/usrsctplib/usrsctp.h:964:1: error:   initializing argument
1
> of 'char* usrsctp_dumppacket(void*, size_t, int)' [-fpermissive]
>  usrsctp_dumppacket(void *, size_t, int);
>  ^
> 
> I'm sure you can fix this easily and just re-land this CL, while I'm going to
> look into how to add this warning at the public bots (on Monday)..

I don't think that could have been triggered here. The version of usrsctp that
is used by WebRTC expects a "const void*" when dumping the packet.

Anyway, just created https://codereview.webrtc.org/1823503002/ to reland.

Powered by Google App Engine
This is Rietveld 408576698