Skip to content

Commit

Permalink
Fix auto raw pointer deduction on linux
Browse files Browse the repository at this point in the history
This patch fixes all of the places where the auto raw
pointer deduction is happening on linux

R=danakj@chromium.org
BUG=554600

Review-Url: https://codereview.chromium.org/2691393002
Cr-Commit-Position: refs/heads/master@{#452312}
  • Loading branch information
vmpstr authored and Commit bot committed Feb 23, 2017
1 parent b835074 commit 6d9996c
Show file tree
Hide file tree
Showing 89 changed files with 147 additions and 148 deletions.
4 changes: 2 additions & 2 deletions components/autofill/core/browser/form_structure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void FormStructure::UpdateFromCache(const FormStructure& cached_form) {
// Map from field signatures to cached fields.
std::map<std::string, const AutofillField*> cached_fields;
for (size_t i = 0; i < cached_form.field_count(); ++i) {
const auto& field = cached_form.field(i);
auto* const field = cached_form.field(i);
cached_fields[field->FieldSignatureAsStr()] = field;
}

Expand Down Expand Up @@ -681,7 +681,7 @@ void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
bool did_autofill_all_possible_fields = true;
bool did_autofill_some_possible_fields = false;
for (size_t i = 0; i < field_count(); ++i) {
const auto& field = this->field(i);
auto* const field = this->field(i);

// No further logging for password fields. Those are primarily related to a
// different feature code path, and so make more sense to track outside of
Expand Down
2 changes: 1 addition & 1 deletion components/autofill/core/browser/personal_data_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ void PersonalDataManager::UpdateCardsBillingAddressReference(
C -> D
*/

for (auto& credit_card : GetCreditCards()) {
for (auto* credit_card : GetCreditCards()) {
// If the credit card is not associated with a billing address, skip it.
if (credit_card->billing_address_id().empty())
break;
Expand Down
2 changes: 1 addition & 1 deletion components/bookmarks/browser/typed_count_sorter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void TypedCountSorter::SortMatches(const TitledUrlNodeSet& matches,
if (client_->SupportsTypedCountForUrls()) {
UrlNodeMap url_node_map;
UrlTypedCountMap url_typed_count_map;
for (auto node : matches) {
for (auto* node : matches) {
const GURL& url = node->GetTitledUrlNodeUrl();
url_node_map.insert(std::make_pair(&url, node));
url_typed_count_map.insert(std::make_pair(&url, 0));
Expand Down
2 changes: 1 addition & 1 deletion components/component_updater/component_updater_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ std::unique_ptr<ComponentInfo> CrxUpdateService::GetComponentForMimeType(
const auto it = component_ids_by_mime_type_.find(mime_type);
if (it == component_ids_by_mime_type_.end())
return nullptr;
const auto component = GetComponent(it->second);
auto* const component = GetComponent(it->second);
if (!component)
return nullptr;
return base::MakeUnique<ComponentInfo>(GetCrxComponentID(*component),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ BluetoothLowEnergyWeaveClientConnection::GetRemoteService() {
if (remote_service_.id.empty()) {
std::vector<device::BluetoothRemoteGattService*> services =
bluetooth_device->GetGattServices();
for (const auto& service : services)
for (auto* service : services)
if (service->GetUUID() == remote_service_.uuid) {
remote_service_.id = service->GetIdentifier();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ TEST(RemoteSuggestionTest, CreateFromProtoIgnoreMissingFetchDate) {
proto.set_score(0.1f);
proto.set_dismissed(false);
proto.set_remote_category_id(1);
auto source = proto.add_sources();
auto* source = proto.add_sources();
source->set_url("http://cool-suggestions.com/");
source->set_publisher_name("Great Suggestions Inc.");
source->set_amp_url("http://cdn.ampproject.org/c/foo/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ SchedulingRemoteSuggestionsProvider::GetEnabledTriggerTypes() {

std::set<TriggerType> enabled_types;
for (const auto& token : tokens) {
auto it = std::find(std::begin(kTriggerTypeNames),
std::end(kTriggerTypeNames), token);
auto** it = std::find(std::begin(kTriggerTypeNames),
std::end(kTriggerTypeNames), token);
if (it == std::end(kTriggerTypeNames)) {
DLOG(WARNING) << "Failed to parse variation param "
<< kTriggerTypesParamName << " with string value "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void NTPTilesInternalsMessageHandler::SendSourceInfo() {
}

if (most_visited_sites_->DoesSourceExist(NTPTileSource::POPULAR)) {
auto popular_sites = most_visited_sites_->popular_sites();
auto* popular_sites = most_visited_sites_->popular_sites();
value.SetString("popular.url", popular_sites->GetURLToFetch().spec());
value.SetString("popular.country", popular_sites->GetCountryToFetch());
value.SetString("popular.version", popular_sites->GetVersionToFetch());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void HQPPerfTestOnePopularURL::PrepareData() {
void HQPPerfTestOnePopularURL::PrintMeasurements(
const std::string& trace_name,
const std::vector<base::TimeDelta>& measurements) {
auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
auto* test_info = ::testing::UnitTest::GetInstance()->current_test_info();

std::string durations;
for (const auto& measurement : measurements)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ void CredentialManagerImpl::OnProvisionalSaveComplete() {
// If this is a federated credential, check it against the federated matches
// produced by the PasswordFormManager. If a match is found, update it and
// return.
for (const auto& match :
form_manager_->form_fetcher()->GetFederatedMatches()) {
for (auto* match : form_manager_->form_fetcher()->GetFederatedMatches()) {
if (match->username_value == form.username_value &&
match->federation_origin.IsSameOriginWith(form.federation_origin)) {
form_manager_->Update(*match);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ base::Optional<PasswordForm> PasswordFormManager::UpdatePendingAndGetOldKey(
DCHECK(best_matches_.end() != updated_password_it);
const base::string16& old_password =
updated_password_it->second->password_value;
for (const auto& not_best_match : not_best_matches_) {
for (auto* not_best_match : not_best_matches_) {
if (not_best_match->username_value ==
pending_credentials_.username_value &&
not_best_match->password_value == old_password) {
Expand Down
12 changes: 6 additions & 6 deletions components/policy/core/common/policy_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PolicyServiceImpl::PolicyServiceImpl(const Providers& providers)
for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain)
initialization_complete_[domain] = true;
providers_ = providers;
for (auto provider : providers) {
for (auto* provider : providers) {
provider->AddObserver(this);
for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) {
initialization_complete_[domain] &=
Expand All @@ -92,7 +92,7 @@ PolicyServiceImpl::PolicyServiceImpl(const Providers& providers)

PolicyServiceImpl::~PolicyServiceImpl() {
DCHECK(thread_checker_.CalledOnValidThread());
for (auto provider : providers_)
for (auto* provider : providers_)
provider->RemoveObserver(this);
}

Expand Down Expand Up @@ -147,9 +147,9 @@ void PolicyServiceImpl::RefreshPolicies(const base::Closure& callback) {
} else {
// Some providers might invoke OnUpdatePolicy synchronously while handling
// RefreshPolicies. Mark all as pending before refreshing.
for (auto provider : providers_)
for (auto* provider : providers_)
refresh_pending_.insert(provider);
for (auto provider : providers_)
for (auto* provider : providers_)
provider->RefreshPolicies();
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ void PolicyServiceImpl::MergeAndTriggerUpdates() {
// Merge from each provider in their order of priority.
const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string());
PolicyBundle bundle;
for (auto provider : providers_) {
for (auto* provider : providers_) {
PolicyBundle provided_bundle;
provided_bundle.CopyFrom(provider->policies());
RemapProxyPolicies(&provided_bundle.Get(chrome_namespace));
Expand Down Expand Up @@ -248,7 +248,7 @@ void PolicyServiceImpl::CheckInitializationComplete() {
PolicyDomain policy_domain = static_cast<PolicyDomain>(domain);

bool all_complete = true;
for (auto provider : providers_) {
for (auto* provider : providers_) {
if (!provider->IsInitializationComplete(policy_domain)) {
all_complete = false;
break;
Expand Down
4 changes: 2 additions & 2 deletions components/precache/core/precache_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,12 @@ std::unique_ptr<PrecacheUnfinishedWork> PrecacheFetcher::CancelPrecaching() {
unfinished_work_->add_top_host()->set_hostname(top_host.hostname);
}
for (const auto& resource : resources_fetching_) {
auto new_resource = unfinished_work_->add_resource();
auto* new_resource = unfinished_work_->add_resource();
new_resource->set_url(resource.url.spec());
new_resource->set_top_host_name(resource.referrer);
}
for (const auto& resource : resources_to_fetch_) {
auto new_resource = unfinished_work_->add_resource();
auto* new_resource = unfinished_work_->add_resource();
new_resource->set_url(resource.url.spec());
new_resource->set_top_host_name(resource.referrer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ TEST_F(DefaultSearchPolicyHandlerTest, InvalidType) {
PolicyMap policy;
BuildDefaultSearchPolicy(&policy);

for (auto policy_name : kPolicyNamesToCheck) {
for (auto* policy_name : kPolicyNamesToCheck) {
// Check that policy can be successfully applied first.
UpdateProviderPolicy(policy);
const base::Value* temp = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
"chrome-extension://some-extension", "file:///var/www/index.html"};
const char* supported_urls[] = {"http://example.test",
"https://example.test"};
for (const auto url : unsupported_urls) {
for (auto* url : unsupported_urls) {
SCOPED_TRACE(url);
RedirectChainMatchPattern expected_pattern = EMPTY;
NavigateAndExpectActivation(
Expand All @@ -742,7 +742,7 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
? ActivationDecision::ACTIVATION_DISABLED
: ActivationDecision::UNSUPPORTED_SCHEME);
}
for (const auto url : supported_urls) {
for (auto* url : supported_urls) {
SCOPED_TRACE(url);
RedirectChainMatchPattern expected_pattern =
test_data.url_matches_activation_list ? NO_REDIRECTS_HIT : EMPTY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEST(FirstPartyOriginTest, EmptyHostUrls) {
};

FirstPartyOrigin first_party(url::Origin(GURL("https://example.com")));
for (const auto& url_string : kUrls) {
for (auto* url_string : kUrls) {
GURL url(url_string);
EXPECT_TRUE(FirstPartyOrigin::IsThirdParty(url, first_party.origin()));
EXPECT_TRUE(first_party.IsThirdParty(url));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ std::vector<uint8_t> SerializeUnindexedRulesetWithMultipleRules(
ruleset_writer.AddUrlRule(rule);
ruleset_writer.Finish();

auto data = reinterpret_cast<const uint8_t*>(ruleset_contents.data());
auto* data = reinterpret_cast<const uint8_t*>(ruleset_contents.data());
return std::vector<uint8_t>(data, data + ruleset_contents.size());
}

Expand Down
2 changes: 1 addition & 1 deletion components/toolbar/toolbar_model_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ security_state::SecurityLevel ToolbarModelImpl::GetSecurityLevel(

const gfx::VectorIcon& ToolbarModelImpl::GetVectorIcon() const {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
const auto icon_override = delegate_->GetVectorIconOverride();
auto* const icon_override = delegate_->GetVectorIconOverride();
if (icon_override)
return *icon_override;

Expand Down
4 changes: 2 additions & 2 deletions components/tracing/test/proto_zero_generation_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ProtoZeroConformanceTest : public ::testing::Test {
};

TEST_F(ProtoZeroConformanceTest, SimpleFieldsNoNesting) {
auto msg = CreateMessage<pbtest::EveryField>();
auto* msg = CreateMessage<pbtest::EveryField>();

msg->set_field_int32(-1);
msg->set_field_int64(-333123456789ll);
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST_F(ProtoZeroConformanceTest, SimpleFieldsNoNesting) {
}

TEST_F(ProtoZeroConformanceTest, NestedMessages) {
auto msg_a = CreateMessage<pbtest::NestedA>();
auto* msg_a = CreateMessage<pbtest::NestedA>();

pbtest::NestedA::NestedB* msg_b = msg_a->add_repeated_a();
pbtest::NestedA::NestedB::NestedC* msg_c = msg_b->set_value_b();
Expand Down
2 changes: 1 addition & 1 deletion components/update_client/update_response.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ bool ParseAppTag(xmlNode* app,
static const char* attrs[] = {UpdateResponse::Result::kCohort,
UpdateResponse::Result::kCohortHint,
UpdateResponse::Result::kCohortName};
for (const auto& attr : attrs) {
for (auto* attr : attrs) {
auto value = GetAttributePtr(app, attr);
if (value)
result->cohort_attrs.insert({attr, *value});
Expand Down
2 changes: 1 addition & 1 deletion content/browser/accessibility/ax_platform_position.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ BrowserAccessibility* AXPlatformPosition::GetNodeInTree(AXTreeID tree_id,
return nullptr;
}

auto manager = BrowserAccessibilityManager::FromID(tree_id);
auto* manager = BrowserAccessibilityManager::FromID(tree_id);
if (!manager)
return nullptr;
return manager->GetFromID(node_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void IndexedDBTransactionCoordinator::ProcessQueuedTransactions() {
// data. ("Version change" transactions are exclusive, but handled by the
// connection sequencing in IndexedDBDatabase.)
std::set<int64_t> locked_scope;
for (const auto& transaction : started_transactions_) {
for (auto* transaction : started_transactions_) {
if (transaction->mode() == blink::WebIDBTransactionModeReadWrite) {
// Started read/write transactions have exclusive access to the object
// stores within their scopes.
Expand Down
4 changes: 2 additions & 2 deletions content/browser/loader/resource_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ void PopulateResourceResponse(ResourceRequestInfoImpl* info,
request->ssl_info().cert->os_cert_handle(), &encoded);
DCHECK(rv);
response->head.certificate.push_back(encoded);
for (auto& cert :
request->ssl_info().cert->GetIntermediateCertificates()) {
for (auto* cert :
request->ssl_info().cert->GetIntermediateCertificates()) {
rv = net::X509Certificate::GetDEREncoded(cert, &encoded);
DCHECK(rv);
response->head.certificate.push_back(encoded);
Expand Down
4 changes: 2 additions & 2 deletions content/browser/media/session/audio_focus_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ void AudioFocusManager::RequestAudioFocus(MediaSessionImpl* media_session,
// up the relation between AudioFocusManager and MediaSessionImpl.
// See https://crbug.com/651069
if (type == AudioFocusType::GainTransientMayDuck) {
for (const auto old_session : audio_focus_stack_) {
for (auto* old_session : audio_focus_stack_) {
old_session->StartDucking();
}
} else {
for (const auto old_session : audio_focus_stack_) {
for (auto* old_session : audio_focus_stack_) {
if (old_session->IsActive()) {
if (old_session->HasPepper())
old_session->StartDucking();
Expand Down
12 changes: 6 additions & 6 deletions content/browser/memory/memory_coordinator_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,32 +199,32 @@ TEST_F(MemoryCoordinatorImplTest, ChildRemovedOnConnectionError) {
}

TEST_F(MemoryCoordinatorImplTest, SetMemoryStateFailsInvalidState) {
auto cmc1 = coordinator_->CreateChildMemoryCoordinator(1);
auto* cmc1 = coordinator_->CreateChildMemoryCoordinator(1);

EXPECT_FALSE(
coordinator_->SetChildMemoryState(1, MemoryState::UNKNOWN));
EXPECT_EQ(0, cmc1->on_state_change_calls());
}

TEST_F(MemoryCoordinatorImplTest, SetMemoryStateFailsInvalidRenderer) {
auto cmc1 = coordinator_->CreateChildMemoryCoordinator(1);
auto* cmc1 = coordinator_->CreateChildMemoryCoordinator(1);

EXPECT_FALSE(
coordinator_->SetChildMemoryState(2, MemoryState::THROTTLED));
EXPECT_EQ(0, cmc1->on_state_change_calls());
}

TEST_F(MemoryCoordinatorImplTest, SetMemoryStateNotDeliveredNop) {
auto cmc1 = coordinator_->CreateChildMemoryCoordinator(1);
auto* cmc1 = coordinator_->CreateChildMemoryCoordinator(1);

EXPECT_FALSE(
coordinator_->SetChildMemoryState(2, MemoryState::NORMAL));
EXPECT_EQ(0, cmc1->on_state_change_calls());
}

TEST_F(MemoryCoordinatorImplTest, SetMemoryStateDelivered) {
auto cmc1 = coordinator_->CreateChildMemoryCoordinator(1);
auto cmc2 = coordinator_->CreateChildMemoryCoordinator(2);
auto* cmc1 = coordinator_->CreateChildMemoryCoordinator(1);
auto* cmc2 = coordinator_->CreateChildMemoryCoordinator(2);

EXPECT_TRUE(
coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
Expand All @@ -248,7 +248,7 @@ TEST_F(MemoryCoordinatorImplTest, PurgeMemoryChild) {
}

TEST_F(MemoryCoordinatorImplTest, SetChildMemoryState) {
auto cmc = coordinator_->CreateChildMemoryCoordinator(1);
auto* cmc = coordinator_->CreateChildMemoryCoordinator(1);
auto iter = coordinator_->children().find(1);
auto* render_process_host = coordinator_->GetMockRenderProcessHost(1);
ASSERT_TRUE(iter != coordinator_->children().end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ void MediaDevicesManager::NotifyDeviceChangeSubscribers(
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(IsValidMediaDeviceType(type));

for (const auto& subscriber : device_change_subscribers_[type]) {
for (auto* subscriber : device_change_subscribers_[type]) {
subscriber->OnDevicesChanged(type, snapshot);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(

gfx::Point transformed_point;
// Send MouseLeaves.
for (auto view : exited_views) {
for (auto* view : exited_views) {
blink::WebMouseEvent mouse_leave(*event);
mouse_leave.setType(blink::WebInputEvent::MouseLeave);
// There is a chance of a race if the last target has recently created a
Expand Down Expand Up @@ -512,7 +512,7 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(
}

// Send MouseMoves to trigger MouseEnter handlers.
for (auto view : entered_views) {
for (auto* view : entered_views) {
if (view == target)
continue;
blink::WebMouseEvent mouse_enter(*event);
Expand Down Expand Up @@ -702,7 +702,7 @@ void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent(
// TODO(wjmaclean,kenrb,tdresser): When scroll latching lands, we can
// revisit how this code should work.
// https://crbug.com/526463
auto rwhi =
auto* rwhi =
static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost());
// If the root view is the current gesture target, then we explicitly don't
// send a GestureScrollBegin, as by the time we see GesturePinchBegin there
Expand All @@ -720,7 +720,7 @@ void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent(
in_touchscreen_gesture_pinch_ = false;
// If the root view wasn't already receiving the gesture stream, then we
// need to wrap the diverted pinch events in a GestureScrollBegin/End.
auto rwhi =
auto* rwhi =
static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost());
if (root_view != touchscreen_gesture_target_.target &&
gesture_pinch_did_send_scroll_begin_ &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ TEST_F(RenderWidgetHostTest, ResizeScreenInfo) {
screen_info.orientation_angle = 0;
screen_info.orientation_type = SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY;

auto host_delegate =
auto* host_delegate =
static_cast<MockRenderWidgetHostDelegate*>(host_->delegate());

host_delegate->SetScreenInfo(screen_info);
Expand Down
Loading

0 comments on commit 6d9996c

Please sign in to comment.