Chromium Code Reviews

Issue 2692723002: Adding RTCErrorOr class to be used by ORTC APIs. (Closed)

Created:
3 years, 10 months ago by Taylor Brandstetter
Modified:
3 years, 10 months ago
Reviewers:
tommi, kjellander_webrtc, kwiberg-webrtc
CC:
webrtc-reviews_webrtc.org, yujie_mao (webrtc), tterriberry_mozilla.com, qiang.lu, niklas.enbom, peah-webrtc, kwiberg-webrtc
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Adding RTCErrorOr class to be used by ORTC APIs. This utility class can be used to represent either an error or a successful return value. Follows the pattern of StatusOr in the protobuf library. This will be used by ORTC factory methods; for instance, CreateRtpSender will either return an RtpSender or an error if the parameters are invalid or some other failure occurs. This CL also moves RTCError classes to a separate file, and adds tests that were missing before. BUG=webrtc:7013 Review-Url: https://codereview.webrtc.org/2692723002 Cr-Commit-Position: refs/heads/master@{#16659} Committed: https://chromium.googlesource.com/external/webrtc/+/6038e97e048bebf763f7149ce0d84d0798c65f8b

Patch Set 1 #

Total comments: 28

Patch Set 2 : Updates based on tommi's comments #

Total comments: 9

Patch Set 3 : Use const char* for error message. #

Total comments: 5

Patch Set 4 : Cleaning up how union works. #

Patch Set 5 : Removing using statements. #

Patch Set 6 : Adding test and changing default RTCErrorOr to INTERNAL_ERROR #

Patch Set 7 : Ading "MoveError". Found a use for it in CL in progress. #

Total comments: 2

Patch Set 8 : Adding build dependency. #

Patch Set 9 : Changing "CreateAndLogError" to a macro. #

Total comments: 4
Unified diffs Side-by-side diffs Stats (+662 lines, -85 lines)
M webrtc/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments
M webrtc/api/BUILD.gn View 2 chunks +27 lines, -0 lines 4 comments
M webrtc/api/peerconnectioninterface.h View 2 chunks +1 line, -56 lines 0 comments
A webrtc/api/rtcerror.h View 1 chunk +291 lines, -0 lines 0 comments
A webrtc/api/rtcerror.cc View 1 chunk +101 lines, -0 lines 0 comments
A webrtc/api/rtcerror_unittest.cc View 1 chunk +241 lines, -0 lines 0 comments
M webrtc/pc/peerconnection.cc View 1 chunk +0 lines, -21 lines 0 comments
M webrtc/pc/peerconnectioninterface_unittest.cc View 1 chunk +0 lines, -8 lines 0 comments

Dependent Patchsets:

Messages

Total messages: 47 (14 generated)
Taylor Brandstetter
Tommi: Peter thought it would be a good idea for you to look at this. ...
3 years, 10 months ago (2017-02-12 02:36:38 UTC) #2
tommi
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; have you checked if this is ...
3 years, 10 months ago (2017-02-12 12:11:22 UTC) #3
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/12 12:11:21, tommi (webrtc) wrote: ...
3 years, 10 months ago (2017-02-12 16:19:23 UTC) #4
tommi
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.h#newcode229 webrtc/api/rtcerror.h:229: T& value() { On 2017/02/12 16:19:23, Taylor Brandstetter wrote: ...
3 years, 10 months ago (2017-02-12 16:27:28 UTC) #5
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.h#newcode229 webrtc/api/rtcerror.h:229: T& value() { On 2017/02/12 16:27:28, tommi (webrtc) wrote: ...
3 years, 10 months ago (2017-02-12 16:44:12 UTC) #6
tommi
I'm heading out, so just sending the two drafts I had. Will take a look ...
3 years, 10 months ago (2017-02-12 18:19:32 UTC) #7
the sun
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/12 18:19:32, tommi (webrtc) wrote: ...
3 years, 10 months ago (2017-02-13 07:35:03 UTC) #9
tommi
https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h#newcode112 webrtc/api/rtcerror.h:112: std::string message_; Can we avoid allocating a string for ...
3 years, 10 months ago (2017-02-13 12:10:01 UTC) #10
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/13 07:35:03, the sun wrote: ...
3 years, 10 months ago (2017-02-13 18:03:53 UTC) #13
tommi
https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h#newcode104 webrtc/api/rtcerror.h:104: void set_message(const std::string& message) { message_ = message; } ...
3 years, 10 months ago (2017-02-13 18:17:14 UTC) #14
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h#newcode104 webrtc/api/rtcerror.h:104: void set_message(const std::string& message) { message_ = message; } ...
3 years, 10 months ago (2017-02-13 18:44:18 UTC) #15
tommi
On 2017/02/13 18:44:18, Taylor Brandstetter wrote: > https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h > File webrtc/api/rtcerror.h (right): > > https://codereview.webrtc.org/2692723002/diff/20001/webrtc/api/rtcerror.h#newcode104 ...
3 years, 10 months ago (2017-02-13 19:04:06 UTC) #16
the sun
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/13 18:03:53, Taylor Brandstetter wrote: ...
3 years, 10 months ago (2017-02-13 19:28:53 UTC) #17
Taylor Brandstetter
On 2017/02/13 19:04:06, tommi (webrtc) wrote: > > Well, I was thinking if we had ...
3 years, 10 months ago (2017-02-13 22:22:05 UTC) #18
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/13 19:28:52, the sun wrote: ...
3 years, 10 months ago (2017-02-13 22:24:15 UTC) #19
the sun
On 2017/02/13 22:24:15, Taylor Brandstetter wrote: > https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc > File webrtc/api/rtcerror.cc (right): > > https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 ...
3 years, 10 months ago (2017-02-13 23:02:24 UTC) #20
kwiberg-webrtc
https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/1/webrtc/api/rtcerror.cc#newcode41 webrtc/api/rtcerror.cc:41: static RTCError ok; On 2017/02/13 22:24:15, Taylor Brandstetter wrote: ...
3 years, 10 months ago (2017-02-14 09:51:49 UTC) #22
tommi
https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h#newcode88 webrtc/api/rtcerror.h:88: // the message is a static string. On 2017/02/14 ...
3 years, 10 months ago (2017-02-14 09:55:56 UTC) #23
kwiberg-webrtc
https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h#newcode88 webrtc/api/rtcerror.h:88: // the message is a static string. On 2017/02/14 ...
3 years, 10 months ago (2017-02-14 11:37:25 UTC) #24
tommi
https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h File webrtc/api/rtcerror.h (right): https://codereview.webrtc.org/2692723002/diff/40001/webrtc/api/rtcerror.h#newcode88 webrtc/api/rtcerror.h:88: // the message is a static string. On 2017/02/14 ...
3 years, 10 months ago (2017-02-14 11:58:58 UTC) #25
Taylor Brandstetter
Another weird thing I ran into: this doesn't work: str_.~string(); But this does: str_.~basic_string(); It ...
3 years, 10 months ago (2017-02-15 02:22:23 UTC) #26
tommi
Thanks for jumping through all the hoops Taylor. lgtm assuming the destructor strangeness isn't a ...
3 years, 10 months ago (2017-02-15 16:27:07 UTC) #27
Taylor Brandstetter
https://codereview.webrtc.org/2692723002/diff/120001/webrtc/api/rtcerror.cc File webrtc/api/rtcerror.cc (right): https://codereview.webrtc.org/2692723002/diff/120001/webrtc/api/rtcerror.cc#newcode62 webrtc/api/rtcerror.cc:62: string_message_.~basic_string(); On 2017/02/15 16:27:07, tommi (webrtc) wrote: > interesting ...
3 years, 10 months ago (2017-02-15 21:14:21 UTC) #32
tommi
On 2017/02/15 21:14:21, Taylor Brandstetter wrote: > https://codereview.webrtc.org/2692723002/diff/120001/webrtc/api/rtcerror.cc > File webrtc/api/rtcerror.cc (right): > > https://codereview.webrtc.org/2692723002/diff/120001/webrtc/api/rtcerror.cc#newcode62 ...
3 years, 10 months ago (2017-02-15 21:32:46 UTC) #33
tommi
On 2017/02/15 21:32:46, tommi (webrtc) wrote: > On 2017/02/15 21:14:21, Taylor Brandstetter wrote: > > ...
3 years, 10 months ago (2017-02-15 21:33:15 UTC) #34
Taylor Brandstetter
On 2017/02/15 21:32:46, tommi (webrtc) wrote: > Wonder if you could do the "technically" correct ...
3 years, 10 months ago (2017-02-15 21:37:57 UTC) #35
Taylor Brandstetter
I changed "CreateAndLogError" to a macro, for a couple reasons: 1. It doesn't work with ...
3 years, 10 months ago (2017-02-16 01:55:53 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2692723002/160001
3 years, 10 months ago (2017-02-17 06:35:08 UTC) #39
commit-bot: I haz the power
Committed patchset #9 (id:160001) as https://chromium.googlesource.com/external/webrtc/+/6038e97e048bebf763f7149ce0d84d0798c65f8b
3 years, 10 months ago (2017-02-17 07:31:39 UTC) #42
kjellander_webrtc
https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn File webrtc/api/BUILD.gn (right): https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn#newcode206 webrtc/api/BUILD.gn:206: rtc_test("rtc_api_unittests") { Can you make this a rtc_source_set and ...
3 years, 10 months ago (2017-02-21 10:48:04 UTC) #44
kwiberg-webrtc
https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn File webrtc/api/BUILD.gn (right): https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn#newcode206 webrtc/api/BUILD.gn:206: rtc_test("rtc_api_unittests") { On 2017/02/21 10:48:03, kjellander_webrtc wrote: > Can ...
3 years, 10 months ago (2017-02-21 12:00:26 UTC) #45
kjellander_webrtc
https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn File webrtc/api/BUILD.gn (right): https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn#newcode206 webrtc/api/BUILD.gn:206: rtc_test("rtc_api_unittests") { On 2017/02/21 12:00:26, kwiberg-webrtc wrote: > On ...
3 years, 10 months ago (2017-02-21 12:01:44 UTC) #46
Taylor Brandstetter
3 years, 10 months ago (2017-02-21 17:59:32 UTC) #47
Message was sent while issue was closed.
https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn
File webrtc/api/BUILD.gn (right):

https://codereview.webrtc.org/2692723002/diff/160001/webrtc/api/BUILD.gn#newc...
webrtc/api/BUILD.gn:206: rtc_test("rtc_api_unittests") {
On 2017/02/21 12:01:44, kjellander_webrtc wrote:
> On 2017/02/21 12:00:26, kwiberg-webrtc wrote:
> > On 2017/02/21 10:48:03, kjellander_webrtc wrote:
> > > Can you make this a rtc_source_set and add it as a dependency in
> rtc_unittests
> > > instead?
> > >
> >
>
https://cs.chromium.org/chromium/src/third_party/webrtc/BUILD.gn?rcl=0bdacd8a...
> > > 
> > > I'd prefer not adding another test binary if possible. I don't see
> webrtc/api
> > > will have that many tests long-term.
> > 
> > I'm neutral on the issue of having more test binaries or not, but
webrtc/api/
> > will probably end up with a bunch of unit tests. Stuff like ArrayView,
> Optional,
> > Buffer, checks.h, etc. are going to have to move to api/ sooner or later.
> 
> Right, but at least I expect them all to be fast. Not stuff like ramping up
> bitrates and things like that.
> Please let's try to not introduce a new one here.

Here: https://codereview.webrtc.org/2709573003

It was on my to-do list to do something about this anyway, since
rtc_api_unittests isn't being run yet.

Powered by Google App Engine