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

Issue 9114036: Code generation for extensions api (Closed)

Created:
8 years, 11 months ago by calamity
Modified:
5 years ago
CC:
aa, jstritar
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Code generation for extensions api This is a preliminary code review for a code generator. The tool's purpose is to generate the tedious serialization code that needs to be written when defining a new extensions api. It generates from the json files in chrome/common/extensions/api. As an example usage, chrome/browser/extensions/extension_permissions_api.cc has been changed to use a class generated from permissions.json. The tool has been integrated into the build system and generates compiling and working code (for permissions.json at least) BUG= TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=119405

Patch Set 1 #

Patch Set 2 : cosmetic tidying #

Patch Set 3 : added generated files, removed trailing whitespace #

Total comments: 66

Patch Set 4 : some rework #

Total comments: 88

Patch Set 5 : more rework #

Total comments: 66

Patch Set 6 : rework rework #

Total comments: 16

Patch Set 7 : a fistful of rework #

Total comments: 86

Patch Set 8 : switch style guides #

Patch Set 9 : switched namespaces, various rework #

Total comments: 40

Patch Set 10 : updated generated files #

Patch Set 11 : updated branch, utilized Result, small fixes #

Total comments: 4

Patch Set 12 : silly mistake #

Patch Set 13 : remove generated files examples #

Patch Set 14 : fix windows path issue #

Patch Set 15 : windows path fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2876 lines, -183 lines) Patch
A build/json_schema_compile.gypi View 1 2 3 4 5 6 7 8 1 chunk +59 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/permissions/permissions_api.cc View 1 2 3 4 5 6 7 8 9 10 7 chunks +28 lines, -34 lines 0 comments Download
M chrome/browser/extensions/api/permissions/permissions_api_helpers.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +16 lines, -11 lines 0 comments Download
M chrome/browser/extensions/api/permissions/permissions_api_helpers.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +32 lines, -58 lines 0 comments Download
M chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +91 lines, -78 lines 0 comments Download
M chrome/browser/extensions/permissions_updater.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
A chrome/common/extensions/api/api.gyp View 1 2 3 4 5 6 7 8 1 chunk +24 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/permissions.json View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A tools/json_schema_compiler/api_gen_util.gyp View 1 chunk +20 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/cc_generator.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +294 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/code.py View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +112 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/code_test.py View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +152 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/compiler.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +101 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/cpp_type_generator.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +135 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/cpp_type_generator_test.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +125 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/cpp_util.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +51 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/cpp_util_test.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +16 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/h_generator.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +214 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/model.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +134 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/model_test.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +95 lines, -0 lines 0 comments Download
A + tools/json_schema_compiler/test/permissions.json View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A tools/json_schema_compiler/test/tabs.json View 1 2 3 1 chunk +769 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/test/windows.json View 1 2 3 1 chunk +264 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/util.h View 1 2 3 4 5 6 7 8 1 chunk +53 lines, -0 lines 0 comments Download
A tools/json_schema_compiler/util.cc View 1 2 3 4 1 chunk +82 lines, -0 lines 0 comments Download

Messages

Total messages: 41 (0 generated)
not at google - send to devlin
Sorry, didn't nearly get through this, just a few nitpicks and a medium-level comments. Sending ...
8 years, 11 months ago (2012-01-12 06:01:05 UTC) #1
calamity
http://codereview.chromium.org/9114036/diff/2001/build/api_gen.gypi File build/api_gen.gypi (right): http://codereview.chromium.org/9114036/diff/2001/build/api_gen.gypi#newcode7 build/api_gen.gypi:7: 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', On 2012/01/12 06:01:05, kalman wrote: > you'll ...
8 years, 11 months ago (2012-01-12 22:59:20 UTC) #2
not at google - send to devlin
Replying to your questions from that last review; plus a couple of extra things. I'll ...
8 years, 11 months ago (2012-01-13 00:07:27 UTC) #3
not at google - send to devlin
http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py File tools/json_schema_compiler/code.py (right): http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py#newcode57 tools/json_schema_compiler/code.py:57: def sblock(self, line, indent=INDENT_SIZE): On 2012/01/13 00:07:27, kalman wrote: ...
8 years, 11 months ago (2012-01-13 00:09:41 UTC) #4
calamity
http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py File tools/json_schema_compiler/code.py (right): http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py#newcode57 tools/json_schema_compiler/code.py:57: def sblock(self, line, indent=INDENT_SIZE): On 2012/01/13 00:07:27, kalman wrote: ...
8 years, 11 months ago (2012-01-13 00:40:22 UTC) #5
not at google - send to devlin
Next round. Haven't looked at the type checker, nor the tests. Also haven't gone through ...
8 years, 11 months ago (2012-01-13 02:14:09 UTC) #6
not at google - send to devlin
Another few comments; done for the day. Note that there are quite a few places ...
8 years, 11 months ago (2012-01-13 06:45:53 UTC) #7
calamity
http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py File tools/json_schema_compiler/code.py (right): http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/code.py#newcode43 tools/json_schema_compiler/code.py:43: """Concatenate another Code object onto this one. On 2012/01/13 ...
8 years, 11 months ago (2012-01-16 04:01:06 UTC) #8
not at google - send to devlin
Just replying to your comments, will go over the new code now. http://codereview.chromium.org/9114036/diff/2001/tools/json_schema_compiler/generate_cc.py File tools/json_schema_compiler/generate_cc.py ...
8 years, 11 months ago (2012-01-17 01:59:23 UTC) #9
not at google - send to devlin
Looking really good, this will be my last main around of comments, I think. http://codereview.chromium.org/9114036/diff/10004/tools/json_schema_compiler/model.py ...
8 years, 11 months ago (2012-01-17 05:42:32 UTC) #10
calamity
http://codereview.chromium.org/9114036/diff/10004/tools/json_schema_compiler/code.py File tools/json_schema_compiler/code.py (right): http://codereview.chromium.org/9114036/diff/10004/tools/json_schema_compiler/code.py#newcode100 tools/json_schema_compiler/code.py:100: Raises type error if passed something that isn't a ...
8 years, 11 months ago (2012-01-18 05:43:08 UTC) #11
not at google - send to devlin
LGTM after you fix up those few things. http://codereview.chromium.org/9114036/diff/21001/tools/json_schema_compiler/cc_generator.py File tools/json_schema_compiler/cc_generator.py (right): http://codereview.chromium.org/9114036/diff/21001/tools/json_schema_compiler/cc_generator.py#newcode38 tools/json_schema_compiler/cc_generator.py:38: for ...
8 years, 11 months ago (2012-01-18 06:57:28 UTC) #12
calamity
http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cpp_type_generator.py File tools/json_schema_compiler/cpp_type_generator.py (right): http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cpp_type_generator.py#newcode43 tools/json_schema_compiler/cpp_type_generator.py:43: cpp_type = simple_c_types[prop.type] On 2012/01/18 06:57:28, kalman wrote: > ...
8 years, 11 months ago (2012-01-18 07:30:54 UTC) #13
not at google - send to devlin
http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cpp_type_generator.py File tools/json_schema_compiler/cpp_type_generator.py (right): http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cpp_type_generator.py#newcode43 tools/json_schema_compiler/cpp_type_generator.py:43: cpp_type = simple_c_types[prop.type] On 2012/01/18 07:30:54, calamity wrote: > ...
8 years, 11 months ago (2012-01-18 07:49:36 UTC) #14
calamity
http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cc_generator.py File tools/json_schema_compiler/cc_generator.py (right): http://codereview.chromium.org/9114036/diff/21002/tools/json_schema_compiler/cc_generator.py#newcode127 tools/json_schema_compiler/cc_generator.py:127: c.append('if(!dict->%s)' % cpp_util.get_fundamental_value(prop, On 2012/01/18 06:57:28, kalman wrote: > ...
8 years, 11 months ago (2012-01-18 09:35:18 UTC) #15
calamity
This is a python tool that generates C++ code from the api json files at ...
8 years, 11 months ago (2012-01-18 11:48:34 UTC) #16
Nico
The gyp files look like a very good start! I'll leave it up to aa ...
8 years, 11 months ago (2012-01-18 17:30:12 UTC) #17
calamity
http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi File build/json_schema_compile.gypi (right): http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi#newcode10 build/json_schema_compile.gypi:10: 'rules': [ On 2012/01/18 17:30:12, Nico wrote: > It ...
8 years, 11 months ago (2012-01-18 23:46:18 UTC) #18
Nico
http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi File build/json_schema_compile.gypi (right): http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi#newcode10 build/json_schema_compile.gypi:10: 'rules': [ > I could get rid of <(cc_dir) ...
8 years, 11 months ago (2012-01-18 23:54:42 UTC) #19
calamity
http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi File build/json_schema_compile.gypi (right): http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi#newcode10 build/json_schema_compile.gypi:10: 'rules': [ On 2012/01/18 23:54:42, Nico wrote: > > ...
8 years, 11 months ago (2012-01-19 00:29:59 UTC) #20
Nico
> I've looked at the tests for RULE_INPUT_DIRNAME and it really looks like it > ...
8 years, 11 months ago (2012-01-19 00:41:12 UTC) #21
calamity
On 2012/01/19 00:41:12, Nico wrote: > > I've looked at the tests for RULE_INPUT_DIRNAME and ...
8 years, 11 months ago (2012-01-19 00:46:53 UTC) #22
Nico
http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi File build/json_schema_compile.gypi (right): http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi#newcode10 build/json_schema_compile.gypi:10: 'rules': [ > I've looked at the tests for ...
8 years, 11 months ago (2012-01-19 00:49:46 UTC) #23
calamity
http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi File build/json_schema_compile.gypi (right): http://codereview.chromium.org/9114036/diff/36003/build/json_schema_compile.gypi#newcode10 build/json_schema_compile.gypi:10: 'rules': [ On 2012/01/19 00:49:46, Nico wrote: > > ...
8 years, 11 months ago (2012-01-19 00:57:07 UTC) #24
Nico
> When I use INTERMEDIATE_DIR, the generated files aren't picked up by the the .cc ...
8 years, 11 months ago (2012-01-19 01:04:23 UTC) #25
Yoyo Zhou
I'm not that familiar with the permissions API; jstritar would best be able to review ...
8 years, 11 months ago (2012-01-19 02:19:40 UTC) #26
Yoyo Zhou
Here are a few more interesting comments. http://codereview.chromium.org/9114036/diff/36003/chrome/browser/extensions/extension_permissions_api.cc File chrome/browser/extensions/extension_permissions_api.cc (right): http://codereview.chromium.org/9114036/diff/36003/chrome/browser/extensions/extension_permissions_api.cc#newcode50 chrome/browser/extensions/extension_permissions_api.cc:50: EXTENSION_FUNCTION_VALIDATE(Contains::Params::Populate(*args_, &params)); ...
8 years, 11 months ago (2012-01-19 23:19:10 UTC) #27
Aaron Boodman
In general: hooray. I'm dragging my feet on the Python review, hoping that Yoyo will ...
8 years, 11 months ago (2012-01-19 23:31:13 UTC) #28
calamity
Did a bit of rework. I just thought I'd clean up the style first and ...
8 years, 11 months ago (2012-01-20 01:10:24 UTC) #29
calamity
Uploaded another patch which hopefully addresses the most of the remaining issues. http://codereview.chromium.org/9114036/diff/36003/chrome/browser/extensions/extension_permissions_api.cc File chrome/browser/extensions/extension_permissions_api.cc ...
8 years, 11 months ago (2012-01-23 05:14:45 UTC) #30
jstritar
nice! http://codereview.chromium.org/9114036/diff/45001/chrome/browser/extensions/extension_permissions_api.cc File chrome/browser/extensions/extension_permissions_api.cc (right): http://codereview.chromium.org/9114036/diff/45001/chrome/browser/extensions/extension_permissions_api.cc#newcode23 chrome/browser/extensions/extension_permissions_api.cc:23: nit: no new line? http://codereview.chromium.org/9114036/diff/45001/chrome/browser/extensions/extension_permissions_api_helpers.cc File chrome/browser/extensions/extension_permissions_api_helpers.cc (right): ...
8 years, 11 months ago (2012-01-23 22:42:07 UTC) #31
Yoyo Zhou
Looking pretty good, a few more comments here and there. http://codereview.chromium.org/9114036/diff/36003/tools/json_schema_compiler/code.py File tools/json_schema_compiler/code.py (right): http://codereview.chromium.org/9114036/diff/36003/tools/json_schema_compiler/code.py#newcode15 ...
8 years, 11 months ago (2012-01-23 23:16:42 UTC) #32
calamity
Updated to HEAD, did a bit of rework and utilized Function::Result where possible. Some function ...
8 years, 11 months ago (2012-01-24 22:57:22 UTC) #33
Yoyo Zhou
LGTM http://codereview.chromium.org/9114036/diff/59001/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc File chrome/browser/extensions/api/permissions/permissions_api_helpers.cc (right): http://codereview.chromium.org/9114036/diff/59001/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc#newcode30 chrome/browser/extensions/api/permissions/permissions_api_helpers.cc:30: scoped_ptr<Permissions> permissions(new Permissions()); I think you can use ...
8 years, 11 months ago (2012-01-26 00:10:38 UTC) #34
calamity
http://codereview.chromium.org/9114036/diff/59001/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc File chrome/browser/extensions/api/permissions/permissions_api_helpers.cc (right): http://codereview.chromium.org/9114036/diff/59001/chrome/browser/extensions/api/permissions/permissions_api_helpers.cc#newcode30 chrome/browser/extensions/api/permissions/permissions_api_helpers.cc:30: scoped_ptr<Permissions> permissions(new Permissions()); On 2012/01/26 00:10:38, Yoyo Zhou wrote: ...
8 years, 11 months ago (2012-01-27 00:46:57 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/calamity@chromium.org/9114036/66006
8 years, 11 months ago (2012-01-27 00:49:10 UTC) #36
commit-bot: I haz the power
Presubmit check for 9114036-66006 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 11 months ago (2012-01-27 00:49:23 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/calamity@chromium.org/9114036/67006
8 years, 11 months ago (2012-01-27 00:52:59 UTC) #38
commit-bot: I haz the power
Try job failure for 9114036-67006 (retry) on win_rel for step "compile" (clobber build). It's a ...
8 years, 11 months ago (2012-01-27 01:57:29 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/calamity@chromium.org/9114036/70001
8 years, 11 months ago (2012-01-27 05:05:22 UTC) #40
commit-bot: I haz the power
8 years, 11 months ago (2012-01-27 07:29:51 UTC) #41
Change committed as 119405

Powered by Google App Engine
This is Rietveld 408576698