diff options
author | mitchellwrosen@chromium.org <mitchellwrosen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-28 03:59:50 +0000 |
---|---|---|
committer | mitchellwrosen@chromium.org <mitchellwrosen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-28 03:59:50 +0000 |
commit | 08c876aaeba4fdecad77e25307f048638a0557da (patch) | |
tree | 939cc15cf0b93829fb891c984cb2ba1dfd006e2b /tools/json_schema_compiler/h_generator.py | |
parent | 0d0c9cc55efb89986cfcb3d9421b71c55b9d4a6c (diff) | |
download | chromium_src-08c876aaeba4fdecad77e25307f048638a0557da.zip chromium_src-08c876aaeba4fdecad77e25307f048638a0557da.tar.gz chromium_src-08c876aaeba4fdecad77e25307f048638a0557da.tar.bz2 |
Added ToJson to JSON schema compiler.
Also re-factored the recently landed Debugger api (I believe it's the only API to have compiled events, so far)
BUG=138767
Review URL: https://chromiumcodereview.appspot.com/10796114
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/h_generator.py')
-rw-r--r-- | tools/json_schema_compiler/h_generator.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py index 4cc0e6f..03879ca 100644 --- a/tools/json_schema_compiler/h_generator.py +++ b/tools/json_schema_compiler/h_generator.py @@ -230,7 +230,8 @@ class HGenerator(object): """ c = Code() (c.Sblock('namespace %s {' % cpp_util.Classname(event.name)) - .Concat(self._GenerateCreateCallbackArguments(event)) + .Concat(self._GenerateCreateCallbackArguments(event, + generate_to_json=True)) .Eblock('};') ) return c @@ -324,7 +325,7 @@ class HGenerator(object): cpp_util.Classname(prop.name))) return c - def _GenerateCreateCallbackArguments(self, function): + def _GenerateCreateCallbackArguments(self, function, generate_to_json=False): """Generates functions for passing paramaters to a callback. """ c = Code() @@ -341,6 +342,8 @@ class HGenerator(object): param, self._cpp_type_generator.GetType(param))) c.Append('scoped_ptr<base::ListValue> Create(%s);' % ', '.join(declaration_list)) + if generate_to_json: + c.Append('std::string ToJson(%s);' % ', '.join(declaration_list)) return c def _GenerateFunctionResults(self, callback): |