--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/X_MSSCmNsWE mentioned that we don't want to migrate existing code to chrome::. My reading of that thread is that we don't generally want to use chrome:: for new code in chrome/ either.
--
One argument I remember in favor of the chrome:: namespace is for enums. Otherwise they pollute the global namespace.
e.g., https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/host_desktop.h
If we agree that the enums shouldn't live in the global namespace then we could still have that file's methods live in the global namespace, but it would require the impl to use chrome:: to refer to its own enum which is kind of weird as well IMO.
Cheers,
Gab
src/chrome isn't designed to be built on top of. If features are being
used from src/chrome, they should be moved to src/components, see
http://www.chromium.org/developers/design-documents/browser-components
Cheers,
Jói
One argument I remember in favor of the chrome:: namespace is for enums. Otherwise they pollute the global namespace.
e.g., https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/host_desktop.h
If we agree that the enums shouldn't live in the global namespace then we could still have that file's methods live in the global namespace, but it would require the impl to use chrome:: to refer to its own enum which is kind of weird as well IMO.
Cheers,
Gab
On Sep 10, 2013 5:32 PM, "Darin Fisher" <da...@chromium.org> wrote:
There is work on this, yes - https://codereview.chromium.org/23868013/ does the BrowserContext view switch.
We're very happy to accept contributions.
Does this all apply to new code been added for tests?
If I'm adding a new foo_test_helpers.h or a foo_test_utils.h or
whatever, should the types there been added in a "namespace test" or
they can go in global namespace or that is just the decision of the
reviewer/owner of the area and the author should follow the preference
of the owner?
For the record, I really agree with all the previous emails about why we shouldn't use chrome:// namespace, or other namespaces for subdirectories.
On 2013-09-10 20:36, Darin Fisher wrote:Code evolves, something that was initially designed to be part of the top-level project may very well become used as a library (as evidenced by the current effort to turn stuff into Components). Good code (with little dependencies, extensible, testable, understandable) will tend to be reused - and everyone wants to write good code, right?
Right. I think the observation is that top-level projects (those that are not libraries consumed by other projects) should not have a namespace.
How do you know which parts of the code can be reused and which are so hard-core-monolithic that they will never be? If you have code that's so non-reusable, it's often a sign of poor design, maybe it should be rewritten, instead of being locked out.
While I agree that having chrome:: used randomly isn't consistent, I'd rather have it added everywhere, not removed everywhere.
--
BR
Maciej Pawlowski
Opera Desktop Wroclaw
Ok, looks like we have consensus on that. Can we also reach consensus on other namespaces in src\chrome? Darin had said "Personally, I'm not a fan of other usage of namespaces derived from a file's name (e.g., file_util::) or namespaces that correspond to a deep path (e.g., chrome_browser_net::). I prefer descriptive class names.". I have already stated that I agree on this.
Others?On Wed, Sep 11, 2013 at 11:22 AM, Peter Kasting <pkas...@chromium.org> wrote:
On Wed, Sep 11, 2013 at 7:59 AM, John Abd-El-Malek <j...@chromium.org> wrote:
For the record, I really agree with all the previous emails about why we shouldn't use chrome:// namespace, or other namespaces for subdirectories.Based on the commentary in this thread, I have filed http://crbug.com/289619 to remove existing chrome:: usage.PK
On Thu, Sep 12, 2013 at 2:41 PM, John Abd-El-Malek <j...@chromium.org> wrote:
Ok, looks like we have consensus on that. Can we also reach consensus on other namespaces in src\chrome? Darin had said "Personally, I'm not a fan of other usage of namespaces derived from a file's name (e.g., file_util::) or namespaces that correspond to a deep path (e.g., chrome_browser_net::). I prefer descriptive class names.". I have already stated that I agree on this.file_util is basically just a bag of utility methods. They could be placed in a class, but they'd be static, so the class would be kind of funny. It also would mean some boilerplate (e.g., private constructor to make sure we don't create the class, and "static" before all method names.
I personally find a namespace a better fit in this kind of situation. But I'll go with the flow if consensus is we should use a class for this.
"Sometimes it is useful, or even necessary, to define a function not bound to a class instance. Such a function can be either a static member or a nonmember function. Nonmember functions should not depend on external variables, and should nearly always exist in a namespace. Rather than creating classes only to group static member functions which do not share static data, use namespaces instead."