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

Issue 2769014: Mac/clang: Possibly contentious changes. (Closed)

Created:
10 years, 6 months ago by Nico
Modified:
9 years, 7 months ago
Reviewers:
Mark Mentovai, joth
CC:
chromium-reviews
Visibility:
Public.

Description

Mac/clang: Possibly contentious changes. As discussed on irc, we're getting rid of const NSObjects, and we're making all properties nonatomic. const: All of cocoa takes nonconst NSObjects, and passing a const NSString to a function that takes NSString is a const violation. gcc doesn't complain about this, but clang intentionally does. constness is usually done via immutable base classes and mutable subclasses in cocoa anyway, so getting rid of const isn't that bad. Also, we don't really have a choice. nonatomic: Some of our classes have custom setters that are not @synchronized. If the @property for that is not non-atomic, then the interface claims that the method is synchronized but the implementation actually isn't. That's a bug. gcc happens not to complain about this, but clang does. Since we shouldn't need atomic properties anywhere, the simple rule is now to just make all properties nonatomic. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=49808

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 11

Patch Set 5 : comments #

Total comments: 14

Patch Set 6 : nonatomic #

Patch Set 7 : comments2 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+226 lines, -233 lines) Patch
M app/clipboard/clipboard_mac.mm View 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_edit_view_mac.mm View 2 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_popup_view_mac.mm View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/chrome_browser_application_mac.mm View 1 2 3 4 5 6 6 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/cocoa/autocomplete_text_field.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/autocomplete_text_field_cell.h View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/background_gradient_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/background_tile_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/bookmark_bar_controller_unittest.mm View 5 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm View 3 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bar_toolbar_view_unittest.mm View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bar_view.h View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/bookmark_bar_view_unittest.mm View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/bookmark_button_cell.h View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/bookmark_editor_base_controller.h View 1 2 3 4 5 3 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/cocoa/bookmark_editor_base_controller.mm View 2 chunks +1 line, -5 lines 0 comments Download
M chrome/browser/cocoa/bookmark_editor_controller.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/bookmark_menu.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/bookmark_menu_cocoa_controller.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/bookmark_tree_browser_cell.h View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/bug_report_window_controller.h View 1 2 3 4 5 6 1 chunk +7 lines, -8 lines 0 comments Download
M chrome/browser/cocoa/clear_browsing_data_controller.h View 1 chunk +8 lines, -8 lines 0 comments Download
M chrome/browser/cocoa/cookie_details.h View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/cookie_details_view_controller.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/download_item_cell.h View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/draggable_button.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/edit_search_engine_cocoa_controller_unittest.mm View 1 chunk +9 lines, -9 lines 0 comments Download
M chrome/browser/cocoa/extension_installed_bubble_controller.h View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/extensions/browser_action_button.h View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/extensions/browser_action_button.mm View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/extensions/browser_actions_container_view.h View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/extensions/browser_actions_container_view.mm View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/cocoa/extensions/browser_actions_controller.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/extensions/browser_actions_controller.mm View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/extensions/extension_install_prompt_controller.h View 1 chunk +7 lines, -7 lines 0 comments Download
M chrome/browser/cocoa/find_bar_view_unittest.mm View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/first_run_dialog.h View 1 chunk +8 lines, -8 lines 0 comments Download
M chrome/browser/cocoa/hover_close_button.mm View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/cocoa/hyperlink_button_cell.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/import_progress_dialog.h View 1 chunk +10 lines, -10 lines 0 comments Download
M chrome/browser/cocoa/info_bubble_window.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/infobar_controller.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/keystone_glue.h View 1 2 3 4 1 chunk +10 lines, -9 lines 0 comments Download
M chrome/browser/cocoa/keystone_glue.mm View 1 2 3 4 5 6 2 chunks +27 lines, -26 lines 0 comments Download
M chrome/browser/cocoa/keyword_editor_cocoa_controller.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/location_bar_view_mac.h View 6 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/cocoa/location_bar_view_mac.mm View 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/cocoa/preferences_window_controller.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/status_bubble_mac.mm View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/styled_text_field_test_helper.h View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/sync_customize_controller.h View 1 chunk +13 lines, -13 lines 0 comments Download
M chrome/browser/cocoa/view_resizer_pong.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/geolocation/wifi_data_provider_corewlan_mac.mm View 1 chunk +10 lines, -10 lines 2 comments Download
M chrome/common/sandbox_mac.mm View 1 2 3 4 5 6 2 chunks +1 line, -5 lines 0 comments Download
M chrome/renderer/render_process_impl.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
Nico
10 years, 6 months ago (2010-06-11 22:06:37 UTC) #1
Mark Mentovai
http://codereview.chromium.org/2769014/diff/11001/5002 File app/clipboard/clipboard_mac.mm (right): http://codereview.chromium.org/2769014/diff/11001/5002#newcode22 app/clipboard/clipboard_mac.mm:22: NSString* kUTTypeURLName = @"public.url-name"; You could still make all ...
10 years, 6 months ago (2010-06-12 00:04:36 UTC) #2
Mark Mentovai
I haven’t looked at any of the properties to see if they need to be ...
10 years, 6 months ago (2010-06-12 00:06:52 UTC) #3
Nico
http://codereview.chromium.org/2769014/diff/11001/5002 File app/clipboard/clipboard_mac.mm (right): http://codereview.chromium.org/2769014/diff/11001/5002#newcode22 app/clipboard/clipboard_mac.mm:22: NSString* kUTTypeURLName = @"public.url-name"; On 2010/06/12 00:04:36, Mark Mentovai ...
10 years, 6 months ago (2010-06-15 16:01:05 UTC) #4
Mark Mentovai
LG with these changes. http://codereview.chromium.org/2769014/diff/17001/18004 File chrome/browser/chrome_browser_application_mac.mm (right): http://codereview.chromium.org/2769014/diff/17001/18004#newcode88 chrome/browser/chrome_browser_application_mac.mm:88: static NSString* kKnownNSExceptionNames[] = { ...
10 years, 6 months ago (2010-06-15 16:42:09 UTC) #5
Nico
I forgot quite a few @properties. Your opportunity to say "while you're here" 50 more ...
10 years, 6 months ago (2010-06-15 16:49:44 UTC) #6
Mark Mentovai
I’m disinclined to search all of these files for more @properties, so I’ll trust that ...
10 years, 6 months ago (2010-06-15 16:57:53 UTC) #7
Mark Mentovai
Oh, yeah. LGTM.
10 years, 6 months ago (2010-06-15 16:58:00 UTC) #8
Nico
On 2010/06/15 16:57:53, Mark Mentovai wrote: > I’m disinclined to search all of these files ...
10 years, 6 months ago (2010-06-15 17:01:35 UTC) #9
Mark Mentovai
git git git git git
10 years, 6 months ago (2010-06-15 17:03:52 UTC) #10
Mark Mentovai
Wow, that seems to be Turkish.
10 years, 6 months ago (2010-06-15 17:09:38 UTC) #11
joth
http://codereview.chromium.org/2769014/diff/28001/21054 File chrome/browser/geolocation/wifi_data_provider_corewlan_mac.mm (right): http://codereview.chromium.org/2769014/diff/28001/21054#newcode41 chrome/browser/geolocation/wifi_data_provider_corewlan_mac.mm:41: @property (nonatomic, readonly) BOOL isIBSS; quick sanity check - ...
10 years, 6 months ago (2010-06-15 18:44:25 UTC) #12
Mark Mentovai
http://codereview.chromium.org/2769014/diff/28001/21054 File chrome/browser/geolocation/wifi_data_provider_corewlan_mac.mm (right): http://codereview.chromium.org/2769014/diff/28001/21054#newcode41 chrome/browser/geolocation/wifi_data_provider_corewlan_mac.mm:41: @property (nonatomic, readonly) BOOL isIBSS; joth wrote: > quick ...
10 years, 6 months ago (2010-06-15 19:30:04 UTC) #13
joth
Great, thanks for the clarification. On 15 June 2010 20:30, <mark@chromium.org> wrote: > > http://codereview.chromium.org/2769014/diff/28001/21054 ...
10 years, 6 months ago (2010-06-16 07:13:34 UTC) #14
Mark Mentovai
10 years, 6 months ago (2010-06-16 13:25:00 UTC) #15
Jonathan Dixon wrote:
> The TODO envisions both adding the #include and removing the local
> definition as a single change.

Correct, that’d be the only way to do it, unless we were to use an SDK
version check. Then we could have both the #include and our own copy
of the @interface, each wrapped in an appropriate macro.

> My questions was more, if all properties need (nonatomic) to work with
> clang, will the lack of (nonatomic) on the system header version not be a
> problem. But I think you've already answered that.

I didn’t answer this directly. Some of the key information is probably
buried earlier in the thread or in IRC conversations.

According to Nico, clang complains when it sees an atomic @property in
an @interface, but the corresponding @implementation does not use
@synchronized. This is an error when compiling the @implementation.
This doesn’t mean that all properties need to be nonatomic to use
clang, or even to use clang to compile the @implementation.

Apple controls the @implementation (and, for that matter, @interface)
of CoreWLAN.framework. They’re the ones who compile the
@implementation. If they choose to compile it with clang, it’s up to
them to make sure it builds. If they choose to do this, and the
@implementation is not already @synchronized, they can add
@synchronized (as one option.)

On the Chrome side, we only see the @interface, so we wouldn’t be
subject to problems regardless of what happens to the @implementation.

Mark

Powered by Google App Engine
This is Rietveld 408576698