New issue
Advanced search Search tips

Issue 682102 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Unexpected mojo generated const string type

Project Member Reported by noel@chromium.org, Jan 18 2017

Issue description

The generated mojo for my mojom:

interface WiFiCredentialsGetter {
  const string kTestWiFiNetwork = "my-test-wifi-network";
};

was ...

class  WiFiCredentialsGetter : public WiFiCredentialsGetterInterfaceBase {
 public:
  // yada yada ...
  static const char* kTestWiFiNetwork;
};

Perhaps we need a better type for the string in this case?

 

Comment 1 by sa...@chromium.org, Jan 19 2017

Components: Internals>Mojo
Status: Started (was: Untriaged)
Project Member

Comment 2 by bugdroid1@chromium.org, Jan 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1bcfeb4b504a90db6bd008c4e87e895f5957161f

commit 1bcfeb4b504a90db6bd008c4e87e895f5957161f
Author: sammc <sammc@chromium.org>
Date: Thu Jan 19 22:53:15 2017

Make mojom-generated C++ string constants really constant.

Previously, string constants generated from mojoms were of the form
const char* kName = "value";
This allows kName to be changed at runtime to point at other strings.
This replaces those with
const char kName[] = "value";

This also changes mojom-generated scalar constants to be constexpr.

BUG= 682102 

Review-Url: https://codereview.chromium.org/2637393002
Cr-Commit-Position: refs/heads/master@{#444871}

[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/cpp/bindings/tests/constant_unittest.cc
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/interfaces/bindings/tests/test_constants.mojom
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
[modify] https://crrev.com/1bcfeb4b504a90db6bd008c4e87e895f5957161f/mojo/public/tools/bindings/generators/mojom_cpp_generator.py

Comment 3 by noel@chromium.org, Jan 20 2017

Status: Fixed (was: Started)
Good stuff, Sam, thanks.  Closing.

Sign in to add a comment