Skip to content

Commit

Permalink
Prepare mac code for building with -Wimplicit-fallthrough.
Browse files Browse the repository at this point in the history
Fixes a bug where memory-infra tracing would count private_dirty memory
also as shared_dirty memory in a certain detail view (but not in aggregates).
Record a memory-infra trace as described on
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/memory-infra/
then click a memory dump, click e.g. "Browser" in the Analysis view,
scroll down, and click the triangle toggle next to Total and then
Native heap. Before this change, entries with "Private dirty" != 0
would always have the same value in the "Shared dirty" column (but
not the other way round).  After this change, at most one of
the two columns is != 0.

Actually turning on the warning is blocked on an issue in protobuf
(see crbug.com/809157), so this will happen in a future CL.

TBR=sky

Bug: 177475
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I663f225f817accd5ee7319e33e2779aafd9c85c6
Reviewed-on: https://chromium-review.googlesource.com/902065
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534831}
  • Loading branch information
nico authored and Commit Bot committed Feb 6, 2018
1 parent d91f850 commit 331a98a
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion base/process/process_metrics_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
break;
case SM_COW:
private_pages_count += info.private_pages_resident;
// Fall through
FALLTHROUGH;
case SM_SHARED:
case SM_PRIVATE_ALIASED:
case SM_TRUESHARED:
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/app_controller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ - (void)commandDispatch:(id)sender {
chrome::ExecuteCommand(browser, IDC_NEW_TAB);
break;
}
// Else fall through to create new window.
FALLTHROUGH; // To create new window.
case IDC_NEW_WINDOW:
CreateBrowser(lastProfile);
break;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chrome_browser_application_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ - (void)sendEvent:(NSEvent*)event {
bool ctrlDown = [event modifierFlags] & NSControlKeyMask;
if (kioskMode && ([event type] == NSRightMouseDown || ctrlDown))
break;
FALLTHROUGH; // Not menu-generating, so pass on the event.
}

default: {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/mac/keystone_glue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ - (NSString*)brandFilePath {

case kBrandFileTypeNotDetermined:
NOTIMPLEMENTED();
// Fall through
FALLTHROUGH;
case kBrandFileTypeNone:
// Clear the value.
result = @"";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ - (BOOL)handleInputText:(NSString*)newText {
return NO; // NO because the selection-handling code will close
// later.
}
// Fall-through if selected index is folder.
FALLTHROUGH;
}
// Keys that open and close submenus.
case NSRightArrowFunctionKey: {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/cocoa/download/download_item_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
[item_controller_ remove]; // We're deleted now!
return;
}
// fall through
FALLTHROUGH;
case DownloadItem::IN_PROGRESS:
case DownloadItem::CANCELLED:
[item_controller_ setStateFromDownload:&download_model_];
Expand Down
5 changes: 3 additions & 2 deletions chrome/browser/ui/cocoa/gradient_button_cell.mm
Original file line number Diff line number Diff line change
Expand Up @@ -515,15 +515,16 @@ - (void)getDrawParamsForFrame:(NSRect)cellFrame
case kMiddleButtonType:
drawFrame.size.width += 20;
innerFrame.size.width += 2;
// Fallthrough
FALLTHROUGH;
case kRightButtonType:
drawFrame.origin.x -= 20;
innerFrame.origin.x -= 2;
// Fallthrough
FALLTHROUGH;
case kLeftButtonType:
case kLeftButtonWithShadowType:
drawFrame.size.width += 20;
innerFrame.size.width += 2;
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/webui/help/version_updater_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ - (void)handleStatusNotification:(NSNotification*)notification {

case kAutoupdateRegisterFailed:
enable_promote_button = false;
// Fall through.
FALLTHROUGH;
case kAutoupdateCheckFailed:
case kAutoupdateInstallFailed:
case kAutoupdatePromoteFailed:
Expand Down
1 change: 1 addition & 0 deletions device/gamepad/xbox_controller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ void NormalizeXboxOneButtonData(const XboxOneButtonData& data,
return;
XboxOneGuideData* data = reinterpret_cast<XboxOneGuideData*>(buffer);
delegate_->XboxControllerGotGuideData(this, data->down);
break;
}
default:
// Unknown packet: ignore!
Expand Down
2 changes: 1 addition & 1 deletion media/gpu/vt_video_decode_accelerator_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ void VTVideoDecodeAccelerator::DecodeTask(const BitstreamBuffer& bitstream,
frame->pic_order_cnt = *pic_order_cnt;
frame->reorder_window = ComputeReorderWindow(sps);
}
FALLTHROUGH;

// Intentional fallthrough.
default:
nalus.push_back(nalu);
data_size += kNALUHeaderLength + nalu.size;
Expand Down
1 change: 1 addition & 0 deletions net/dns/dns_config_service_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
case CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS:
LOG(WARNING) << "dns_config has unhandled options!";
dns_config->unhandled_options = true;
FALLTHROUGH;
default:
return error;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void PopulateByteStats(VMRegion* region,
case SM_PRIVATE:
case SM_COW:
region->byte_stats_private_dirty_resident = dirty_bytes;
break;
case SM_SHARED:
case SM_PRIVATE_ALIASED:
case SM_TRUESHARED:
Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/platform/ax_platform_node_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ - (NSArray*)accessibilityAttributeNames {
[axAttributes addObject:kTextAttributes];
if (!node_->GetData().HasState(ax::mojom::State::kProtected))
[axAttributes addObjectsFromArray:kUnprotectedTextAttributes];
// Fallthrough.
FALLTHROUGH;
case ax::mojom::Role::kCheckBox:
case ax::mojom::Role::kComboBoxMenuButton:
case ax::mojom::Role::kMenuItemCheckBox:
Expand Down

0 comments on commit 331a98a

Please sign in to comment.