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

Issue 2200843002: C bindings: Implement _DeepCopy() & some unittests. (Closed)

Created:
4 years, 4 months ago by vardhan
Modified:
4 years, 4 months ago
Reviewers:
viettrungluu
CC:
mojo-reviews_chromium.org, gregsimon, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org, yzshen+mojopublicwatch_chromium.org
Base URL:
git@github.com:domokit/mojo.git@cgen_validate
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

C bindings: Implement _DeepCopy() & some unittests. This generates/implements DeepCopy(), which is a way to recursively copy a struct, and adversely move all the handles into a new copy. Comes with some unittests, but not all of them. R=viettrungluu@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/700f89aa67c60578c8d2cd9712fc2cd5f43a451c

Patch Set 1 #

Patch Set 2 : oops, include c.sha1. also properly merge #

Total comments: 4

Patch Set 3 : Address comments: no longer move, but copy instead. Return NULL if insufficient space. #

Total comments: 7

Patch Set 4 : address comments; generate Number of fields in union, check valid tag before copying #

Patch Set 5 : Mojom[Struct|Array]_DeepCopy will return bool for success/failure #

Total comments: 1

Patch Set 6 : fix tab indent, update sha1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+475 lines, -58 lines) Patch
M mojo/public/c/bindings/array.h View 1 2 3 4 1 chunk +16 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/array.c View 1 2 3 4 2 chunks +36 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/struct.c View 1 2 3 4 2 chunks +40 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/type_descriptor.h View 1 2 3 5 chunks +25 lines, -10 lines 0 comments Download
M mojo/public/c/bindings/lib/type_descriptor.c View 1 2 3 4 1 chunk +57 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/lib/union.c View 1 2 3 8 chunks +44 lines, -7 lines 0 comments Download
M mojo/public/c/bindings/struct.h View 1 2 3 4 1 chunk +16 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/tests/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/c/bindings/tests/array_unittest.cc View 1 2 3 7 chunks +47 lines, -8 lines 0 comments Download
M mojo/public/c/bindings/tests/struct_unittest.cc View 1 2 11 chunks +72 lines, -22 lines 0 comments Download
A mojo/public/c/bindings/tests/testing_util.h View 1 2 1 chunk +47 lines, -0 lines 0 comments Download
M mojo/public/c/bindings/tests/union_unittest.cc View 6 chunks +33 lines, -6 lines 0 comments Download
M mojo/public/c/bindings/union.h View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download
M mojo/public/tools/bindings/mojom_tool/bin/linux64/generators/c.sha1 View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/tools/bindings/mojom_tool/bin/mac64/generators/c.sha1 View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M mojom/generators/c/cgen/type_table.go View 1 2 3 2 chunks +7 lines, -2 lines 0 comments Download
M mojom/generators/c/templates/struct.tmpl.go View 1 2 3 4 5 2 chunks +14 lines, -1 line 0 comments Download
M mojom/generators/c/templates/type_table.tmpl.go View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 11 (4 generated)
vardhan
ptal
4 years, 4 months ago (2016-08-01 22:41:38 UTC) #2
viettrungluu
https://codereview.chromium.org/2200843002/diff/20001/mojo/public/c/bindings/array.h File mojo/public/c/bindings/array.h (right): https://codereview.chromium.org/2200843002/diff/20001/mojo/public/c/bindings/array.h#newcode124 mojo/public/c/bindings/array.h:124: // |buffer|: A mojom buffer used to allocate space ...
4 years, 4 months ago (2016-08-02 20:15:06 UTC) #3
vardhan
PTAL. btw, there is a little inconsistency between the API for MojomStruct/Array and Union -- ...
4 years, 4 months ago (2016-08-02 23:26:36 UTC) #6
viettrungluu
(Making things consistent would be nice, if it's not a lot of trouble.) https://codereview.chromium.org/2200843002/diff/80001/mojo/public/c/bindings/lib/union.c File ...
4 years, 4 months ago (2016-08-03 16:43:24 UTC) #7
vardhan
ptal https://codereview.chromium.org/2200843002/diff/80001/mojo/public/c/bindings/lib/union.c File mojo/public/c/bindings/lib/union.c (right): https://codereview.chromium.org/2200843002/diff/80001/mojo/public/c/bindings/lib/union.c#newcode50 mojo/public/c/bindings/lib/union.c:50: continue; On 2016/08/03 16:43:24, viettrungluu wrote: > Should ...
4 years, 4 months ago (2016-08-03 23:11:02 UTC) #8
viettrungluu
lgtm w/hard tab nits https://codereview.chromium.org/2200843002/diff/120001/mojom/generators/c/templates/struct.tmpl.go File mojom/generators/c/templates/struct.tmpl.go (right): https://codereview.chromium.org/2200843002/diff/120001/mojom/generators/c/templates/struct.tmpl.go#newcode75 mojom/generators/c/templates/struct.tmpl.go:75: if (!MojomStruct_DeepCopy( I think you ...
4 years, 4 months ago (2016-08-03 23:45:28 UTC) #9
vardhan
4 years, 4 months ago (2016-08-04 00:01:59 UTC) #11
Message was sent while issue was closed.
Committed patchset #6 (id:140001) manually as
700f89aa67c60578c8d2cd9712fc2cd5f43a451c (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698