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

Issue 23913008: C++ bindings (Closed)

Created:
7 years, 3 months ago by darin (slow to review)
Modified:
7 years, 2 months ago
Reviewers:
DaveMoore, viettrungluu
CC:
chromium-reviews
Visibility:
Public.

Description

C++ bindings This CL includes code for a static library that supports C++ bindings to the Mojo message format. A sample interface with "generated" bindings is included in the sample/ folder along with sample_test.cc that shows how the generated code may be used. This is a WIP but seems worth snapshotting as is. See the TODO file for a list of near term improvements, most notably testing. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=228153

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : Add encoding and decoding of pointers #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : Arrays of structs and optional parameters. #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Total comments: 1

Patch Set 14 : Added BlahProxy #

Total comments: 2

Patch Set 15 : Split things up #

Patch Set 16 : Now with sample_service_internal.h #

Patch Set 17 : #

Total comments: 5

Patch Set 18 : Added mojo::String #

Patch Set 19 : Add example of passing mojo::Handle #

Patch Set 20 : Adds array of handles example #

Patch Set 21 : #

Patch Set 22 : #

Total comments: 2

Patch Set 23 : buf.New<Foo>() -> Foo::New(&buf) #

Patch Set 24 : Avoid implicit copy when sending a message. #

Patch Set 25 : #

Patch Set 26 : #

Patch Set 27 : Improved directory structure #

Patch Set 28 : Improved directory structure #

Patch Set 29 : #

Patch Set 30 : #

Patch Set 31 : #

Patch Set 32 : #

Patch Set 33 : #

Patch Set 34 : #

Patch Set 35 : New directory layout. #

Patch Set 36 : #

Patch Set 37 : #

Patch Set 38 : #

Patch Set 39 : #

Patch Set 40 : Add mojo/public/system/macros.h #

Patch Set 41 : Fix Windows build. #

Total comments: 9

Patch Set 42 : better comments and const correctness #

Patch Set 43 : fix mac bustage #

Patch Set 44 : Fix use of size_t #

Total comments: 5

Patch Set 45 : Stop building src/mojo on iOS #

Total comments: 12

Patch Set 46 : Now with allocation size computed up-front #

Patch Set 47 : ComputeSizeOf -> ComputeAlignedSizeOf #

Patch Set 48 : Updated file names per review with davemoore@ #

Total comments: 1

Patch Set 49 : Fix formatting in macros.h #

Patch Set 50 : Fix formatting #

Patch Set 51 : rebase #

Patch Set 52 : Fix windows build #

Patch Set 53 : rebase #

Patch Set 54 : Fix windows build error. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1496 lines, -8 lines) Patch
M mojo/mojo.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 2 chunks +36 lines, -1 line 0 comments Download
A mojo/public/bindings/lib/TODO View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +12 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/bindings.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +85 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/bindings_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +63 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/bindings_serialization.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +220 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/bindings_serialization.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +81 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/buffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +101 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/buffer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +104 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/message.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 chunk +43 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/message.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 1 chunk +18 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/message_builder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 1 chunk +34 lines, -0 lines 0 comments Download
A mojo/public/bindings/lib/message_builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 48 49 50 51 1 chunk +26 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +117 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service_proxy.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 chunk +26 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service_proxy.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +57 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service_serialization.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +168 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service_stub.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 chunk +20 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/generated/sample_service_stub.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 1 chunk +28 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/sample_service.idl View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +32 lines, -0 lines 0 comments Download
A mojo/public/bindings/sample/sample_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 1 chunk +183 lines, -0 lines 0 comments Download
M mojo/public/system/core.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 2 chunks +1 line, -6 lines 0 comments Download
A mojo/public/system/macros.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 1 chunk +39 lines, -0 lines 0 comments Download
M mojo/shell/app_container.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 29 (0 generated)
yzshen1
(Sorry if the question is naive.) https://codereview.chromium.org/23913008/diff/25001/mojo/public/bindings/test.cc File mojo/public/bindings/test.cc (right): https://codereview.chromium.org/23913008/diff/25001/mojo/public/bindings/test.cc#newcode77 mojo/public/bindings/test.cc:77: *offset = p_obj ...
7 years, 3 months ago (2013-09-24 18:32:56 UTC) #1
darin (slow to review)
Those are great questions. I did have the idea that offsets should be positive, but ...
7 years, 3 months ago (2013-09-24 18:45:51 UTC) #2
yzshen
Thanks, Darin! On Tue, Sep 24, 2013 at 11:45 AM, Darin Fisher <darin@chromium.org> wrote: > ...
7 years, 3 months ago (2013-09-24 18:53:53 UTC) #3
piman
https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc File mojo/public/bindings/test.cc (right): https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc#newcode96 mojo/public/bindings/test.cc:96: *ptr = reinterpret_cast<T*>(p_slot + *offset); Note: strict aliasing rules ...
7 years, 2 months ago (2013-09-25 17:26:24 UTC) #4
Hajime Morrita
https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc File mojo/public/bindings/test.cc (right): https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc#newcode296 mojo/public/bindings/test.cc:296: StructHeader header_; One possible alternative is to keep the ...
7 years, 2 months ago (2013-09-25 20:03:55 UTC) #5
darin (slow to review)
On 2013/09/25 17:26:24, piman wrote: > https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc > File mojo/public/bindings/test.cc (right): > > https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc#newcode96 > ...
7 years, 2 months ago (2013-09-28 04:53:06 UTC) #6
darin (slow to review)
On 2013/09/25 20:03:55, morrita1 wrote: > https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc > File mojo/public/bindings/test.cc (right): > > https://codereview.chromium.org/23913008/diff/31001/mojo/public/bindings/test.cc#newcode296 > ...
7 years, 2 months ago (2013-09-28 05:03:54 UTC) #7
darin (slow to review)
In the latest CL, everything that isn't needed by clients is moved out of sample_service.h ...
7 years, 2 months ago (2013-09-28 07:03:25 UTC) #8
Ben Goodger (Google)
https://codereview.chromium.org/23913008/diff/44001/mojo/public/bindings/generated/sample_service.h File mojo/public/bindings/generated/sample_service.h (right): https://codereview.chromium.org/23913008/diff/44001/mojo/public/bindings/generated/sample_service.h#newcode10 mojo/public/bindings/generated/sample_service.h:10: namespace sample { this looks much better
7 years, 2 months ago (2013-09-28 21:15:29 UTC) #9
viettrungluu
https://codereview.chromium.org/23913008/diff/44001/mojo/public/bindings/generated/sample_service.h File mojo/public/bindings/generated/sample_service.h (right): https://codereview.chromium.org/23913008/diff/44001/mojo/public/bindings/generated/sample_service.h#newcode31 mojo/public/bindings/generated/sample_service.h:31: struct { This is nice for debugging, but apart ...
7 years, 2 months ago (2013-10-01 00:51:03 UTC) #10
darin (slow to review)
On Mon, Sep 30, 2013 at 5:51 PM, <viettrungluu@chromium.org> wrote: > > https://codereview.chromium.**org/23913008/diff/44001/mojo/** > public/bindings/generated/**sample_service.h<https://codereview.chromium.org/23913008/diff/44001/mojo/public/bindings/generated/sample_service.h> ...
7 years, 2 months ago (2013-10-01 03:50:17 UTC) #11
viettrungluu
On 2013/10/01 03:50:17, darin wrote: > On Mon, Sep 30, 2013 at 5:51 PM, <mailto:viettrungluu@chromium.org> ...
7 years, 2 months ago (2013-10-02 00:52:47 UTC) #12
viettrungluu
https://codereview.chromium.org/23913008/diff/62001/mojo/public/bindings/generated/sample_service_proxy.cc File mojo/public/bindings/generated/sample_service_proxy.cc (right): https://codereview.chromium.org/23913008/diff/62001/mojo/public/bindings/generated/sample_service_proxy.cc#newcode27 mojo/public/bindings/generated/sample_service_proxy.cc:27: internal::Service_Frobinate_Params* params = I wonder if in the case ...
7 years, 2 months ago (2013-10-02 01:17:06 UTC) #13
darin (slow to review)
On 2013/10/02 01:17:06, viettrungluu wrote: > https://codereview.chromium.org/23913008/diff/62001/mojo/public/bindings/generated/sample_service_proxy.cc > File mojo/public/bindings/generated/sample_service_proxy.cc (right): > > https://codereview.chromium.org/23913008/diff/62001/mojo/public/bindings/generated/sample_service_proxy.cc#newcode27 > ...
7 years, 2 months ago (2013-10-02 04:49:51 UTC) #14
darin (slow to review)
On 2013/10/02 00:52:47, viettrungluu wrote: > On 2013/10/01 03:50:17, darin wrote: > > On Mon, ...
7 years, 2 months ago (2013-10-02 04:55:42 UTC) #15
darin (slow to review)
trung: PTAL
7 years, 2 months ago (2013-10-09 00:05:19 UTC) #16
viettrungluu
Mostly it looks good (apart from some nitpicky const-correctness, etc. issues), though I want to ...
7 years, 2 months ago (2013-10-09 03:44:06 UTC) #17
viettrungluu
https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.cc File mojo/public/bindings/lib/buffer.cc (right): https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.cc#newcode106 mojo/public/bindings/lib/buffer.cc:106: size_ = 0; Also, |capacity_ = 0;|? https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.h File ...
7 years, 2 months ago (2013-10-09 17:00:24 UTC) #18
darin (slow to review)
https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.cc File mojo/public/bindings/lib/buffer.cc (right): https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.cc#newcode106 mojo/public/bindings/lib/buffer.cc:106: size_ = 0; On 2013/10/09 17:00:24, viettrungluu wrote: > ...
7 years, 2 months ago (2013-10-09 17:05:31 UTC) #19
DaveMoore
https://codereview.chromium.org/23913008/diff/133001/mojo/public/bindings/lib/bindings.h File mojo/public/bindings/lib/bindings.h (right): https://codereview.chromium.org/23913008/diff/133001/mojo/public/bindings/lib/bindings.h#newcode7 mojo/public/bindings/lib/bindings.h:7: I find the naming of this header confusing, at ...
7 years, 2 months ago (2013-10-09 17:14:06 UTC) #20
viettrungluu
https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.h File mojo/public/bindings/lib/buffer.h (right): https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.h#newcode22 mojo/public/bindings/lib/buffer.h:22: class StackBuffer : public Buffer { On 2013/10/09 17:05:32, ...
7 years, 2 months ago (2013-10-09 20:54:26 UTC) #21
darin (slow to review)
On Wed, Oct 9, 2013 at 10:14 AM, <davemoore@chromium.org> wrote: > > https://codereview.chromium.**org/23913008/diff/133001/mojo/** > public/bindings/lib/bindings.h<https://codereview.chromium.org/23913008/diff/133001/mojo/public/bindings/lib/bindings.h> ...
7 years, 2 months ago (2013-10-09 23:41:37 UTC) #22
darin (slow to review)
On Wed, Oct 9, 2013 at 1:54 PM, <viettrungluu@chromium.org> wrote: > > https://codereview.chromium.**org/23913008/diff/146001/mojo/** > public/bindings/lib/buffer.h<https://codereview.chromium.org/23913008/diff/146001/mojo/public/bindings/lib/buffer.h> ...
7 years, 2 months ago (2013-10-09 23:44:29 UTC) #23
darin (slow to review)
OK, new file names are in place. PTAL. I added more to the TODO file.
7 years, 2 months ago (2013-10-10 20:21:47 UTC) #24
darin (slow to review)
Please note the use of the Align function and the new ObjectTraits<T>::ComputeAlignedSizeOf(const T*) functions. These ...
7 years, 2 months ago (2013-10-10 20:23:46 UTC) #25
viettrungluu
Okay, LGTM (at least to begin with). I say ship it. https://codereview.chromium.org/23913008/diff/176001/mojo/public/system/macros.h File mojo/public/system/macros.h (right): ...
7 years, 2 months ago (2013-10-10 20:42:38 UTC) #26
darin (slow to review)
On Thu, Oct 10, 2013 at 1:42 PM, <viettrungluu@chromium.org> wrote: > Okay, LGTM (at least ...
7 years, 2 months ago (2013-10-10 21:04:26 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/darin@chromium.org/23913008/219001
7 years, 2 months ago (2013-10-11 07:48:48 UTC) #28
commit-bot: I haz the power
7 years, 2 months ago (2013-10-11 10:52:35 UTC) #29
Message was sent while issue was closed.
Change committed as 228153

Powered by Google App Engine
This is Rietveld 408576698