summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 09:05:12 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 09:05:12 +0000
commit8ee0492feeb4f8b10b965eb0603531acf51fec23 (patch)
tree0fe3ab210bd80f2664084876454d6e657e52183a
parent3ed32b6a198b97b8918123f1c45e224903f0db06 (diff)
downloadchromium_src-8ee0492feeb4f8b10b965eb0603531acf51fec23.zip
chromium_src-8ee0492feeb4f8b10b965eb0603531acf51fec23.tar.gz
chromium_src-8ee0492feeb4f8b10b965eb0603531acf51fec23.tar.bz2
Make some more code use "if (weak_ptr)" style
This is a revert of r204036 and part of r203996. BUG=245942 TBR=darin@chromium.org Review URL: https://chromiumcodereview.appspot.com/16571012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204773 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_action_unittest.cc22
-rw-r--r--chrome/browser/sync/glue/shared_change_processor_unittest.cc2
-rw-r--r--content/browser/download/download_browsertest.cc2
-rw-r--r--net/http/http_cache_unittest.cc4
-rw-r--r--net/socket/ssl_client_socket_nss.cc6
-rw-r--r--net/url_request/url_request_ftp_job_unittest.cc10
-rw-r--r--net/url_request/url_request_http_job_unittest.cc10
-rw-r--r--sync/internal_api/public/util/weak_handle.h10
-rw-r--r--sync/internal_api/public/util/weak_handle_unittest.cc4
-rw-r--r--webkit/browser/quota/quota_manager.cc6
10 files changed, 37 insertions, 39 deletions
diff --git a/chrome/browser/extensions/extension_action_unittest.cc b/chrome/browser/extensions/extension_action_unittest.cc
index c1868ea..2aba574 100644
--- a/chrome/browser/extensions/extension_action_unittest.cc
+++ b/chrome/browser/extensions/extension_action_unittest.cc
@@ -45,7 +45,7 @@ TEST(ExtensionActionTest, Visibility) {
action.SetAppearance(100, ExtensionAction::ACTIVE);
ASSERT_FALSE(action.GetIsVisible(1));
ASSERT_TRUE(action.GetIsVisible(100));
- EXPECT_FALSE(action.GetIconAnimation(100).get())
+ EXPECT_FALSE(action.GetIconAnimation(100))
<< "Page actions should not animate.";
action.ClearAllValuesForTab(100);
@@ -63,24 +63,22 @@ TEST(ExtensionActionTest, ScriptBadgeAnimation) {
ExtensionAction script_badge(
std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo());
- EXPECT_FALSE(
- script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId).get());
+ EXPECT_FALSE(script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId));
script_badge.SetAppearance(ExtensionAction::kDefaultTabId,
ExtensionAction::ACTIVE);
- EXPECT_FALSE(
- script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId).get())
+ EXPECT_FALSE(script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId))
<< "Showing the default tab should not animate script badges.";
script_badge.SetAppearance(ExtensionAction::kDefaultTabId,
ExtensionAction::INVISIBLE);
- EXPECT_FALSE(script_badge.GetIconAnimation(1).get())
+ EXPECT_FALSE(script_badge.GetIconAnimation(1))
<< "Making a script badge invisible should not show its animation.";
script_badge.SetAppearance(1, ExtensionAction::ACTIVE);
- EXPECT_TRUE(script_badge.GetIconAnimation(1).get())
+ EXPECT_TRUE(script_badge.GetIconAnimation(1))
<< "Making a script badge visible should show its animation.";
script_badge.ClearAllValuesForTab(1);
- EXPECT_FALSE(script_badge.GetIconAnimation(100).get());
+ EXPECT_FALSE(script_badge.GetIconAnimation(100));
}
TEST(ExtensionActionTest, GetAttention) {
@@ -90,18 +88,18 @@ TEST(ExtensionActionTest, GetAttention) {
ExtensionAction script_badge(
std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo());
EXPECT_FALSE(script_badge.GetIsVisible(1));
- EXPECT_FALSE(script_badge.GetIconAnimation(1).get());
+ EXPECT_FALSE(script_badge.GetIconAnimation(1));
script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION);
EXPECT_TRUE(script_badge.GetIsVisible(1));
- EXPECT_TRUE(script_badge.GetIconAnimation(1).get());
+ EXPECT_TRUE(script_badge.GetIconAnimation(1));
// Simulate waiting long enough for the animation to end.
message_loop.reset(); // Can't have 2 MessageLoops alive at once.
message_loop.reset(new base::MessageLoop);
- EXPECT_FALSE(script_badge.GetIconAnimation(1).get()); // Sanity check.
+ EXPECT_FALSE(script_badge.GetIconAnimation(1)); // Sanity check.
script_badge.SetAppearance(1, ExtensionAction::ACTIVE);
- EXPECT_FALSE(script_badge.GetIconAnimation(1).get())
+ EXPECT_FALSE(script_badge.GetIconAnimation(1))
<< "The animation should not play again if the icon was already visible.";
}
diff --git a/chrome/browser/sync/glue/shared_change_processor_unittest.cc b/chrome/browser/sync/glue/shared_change_processor_unittest.cc
index 30137e9..795d738 100644
--- a/chrome/browser/sync/glue/shared_change_processor_unittest.cc
+++ b/chrome/browser/sync/glue/shared_change_processor_unittest.cc
@@ -109,7 +109,7 @@ class SyncSharedChangeProcessorTest : public testing::Test {
&sync_service_,
&error_handler_,
syncer::AUTOFILL,
- base::WeakPtr<syncer::SyncMergeResult>()).get());
+ base::WeakPtr<syncer::SyncMergeResult>()));
}
base::MessageLoopForUI ui_loop_;
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index 6cb54a6..fc08d58 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -209,7 +209,7 @@ void DownloadFileWithDelay::RenameCallbackWrapper(
DownloadInterruptReason reason,
const base::FilePath& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!factory.get())
+ if (!factory)
return;
factory->AddRenameCallback(base::Bind(original_callback, reason, path));
}
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 3b41de6..2a686f2 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -5925,7 +5925,7 @@ TEST(HttpCache, SetPriority) {
// Shouldn't crash, but doesn't do anything either.
trans->SetPriority(net::LOW);
- EXPECT_FALSE(cache.network_layer()->last_transaction().get());
+ EXPECT_FALSE(cache.network_layer()->last_transaction());
EXPECT_EQ(net::DEFAULT_PRIORITY,
cache.network_layer()->last_create_transaction_priority());
@@ -5935,7 +5935,7 @@ TEST(HttpCache, SetPriority) {
EXPECT_EQ(net::ERR_IO_PENDING,
trans->Start(&info, callback.callback(), net::BoundNetLog()));
- ASSERT_TRUE(cache.network_layer()->last_transaction().get());
+ ASSERT_TRUE(cache.network_layer()->last_transaction());
EXPECT_EQ(net::LOW,
cache.network_layer()->last_create_transaction_priority());
EXPECT_EQ(net::LOW,
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index cf21688..9d74425 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -284,7 +284,7 @@ void DestroyCertificates(CERTCertificate** certs, size_t len) {
// SSLClientSocketNSS::Core.
void AddLogEvent(const base::WeakPtr<BoundNetLog>& net_log,
NetLog::EventType event_type) {
- if (!net_log.get())
+ if (!net_log)
return;
net_log->AddEvent(event_type);
}
@@ -294,7 +294,7 @@ void AddLogEvent(const base::WeakPtr<BoundNetLog>& net_log,
void AddLogEventWithCallback(const base::WeakPtr<BoundNetLog>& net_log,
NetLog::EventType event_type,
const NetLog::ParametersCallback& callback) {
- if (!net_log.get())
+ if (!net_log)
return;
net_log->AddEvent(event_type, callback);
}
@@ -312,7 +312,7 @@ void AddLogEventWithCallback(const base::WeakPtr<BoundNetLog>& net_log,
void LogByteTransferEvent(
const base::WeakPtr<BoundNetLog>& net_log, NetLog::EventType event_type,
int len, IOBuffer* buffer) {
- if (!net_log.get())
+ if (!net_log)
return;
net_log->AddByteTransferEvent(event_type, len, buffer->data());
}
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc
index a642abe..3b4a790 100644
--- a/net/url_request/url_request_ftp_job_unittest.cc
+++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -162,11 +162,11 @@ TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriorityOnStart) {
&req_, &ftp_factory_, &ftp_auth_cache_));
job->SetPriority(LOW);
- EXPECT_FALSE(network_layer_.last_transaction().get());
+ EXPECT_FALSE(network_layer_.last_transaction());
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
}
@@ -177,7 +177,7 @@ TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriority) {
&req_, &ftp_factory_, &ftp_auth_cache_));
job->SetPriority(LOW);
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
job->SetPriority(HIGHEST);
@@ -192,7 +192,7 @@ TEST_F(URLRequestFtpJobPriorityTest, SetSubsequentTransactionPriority) {
job->Start();
job->SetPriority(LOW);
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
job->Kill();
@@ -200,7 +200,7 @@ TEST_F(URLRequestFtpJobPriorityTest, SetSubsequentTransactionPriority) {
// Creates a second transaction.
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
}
diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc
index 1eba53e..9469a67 100644
--- a/net/url_request/url_request_http_job_unittest.cc
+++ b/net/url_request/url_request_http_job_unittest.cc
@@ -75,11 +75,11 @@ TEST_F(URLRequestHttpJobTest, SetTransactionPriorityOnStart) {
scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_));
job->SetPriority(LOW);
- EXPECT_FALSE(network_layer_.last_transaction().get());
+ EXPECT_FALSE(network_layer_.last_transaction());
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
}
@@ -89,7 +89,7 @@ TEST_F(URLRequestHttpJobTest, SetTransactionPriority) {
scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_));
job->SetPriority(LOW);
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
job->SetPriority(HIGHEST);
@@ -103,7 +103,7 @@ TEST_F(URLRequestHttpJobTest, SetSubsequentTransactionPriority) {
job->Start();
job->SetPriority(LOW);
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
job->Kill();
@@ -111,7 +111,7 @@ TEST_F(URLRequestHttpJobTest, SetSubsequentTransactionPriority) {
// Creates a second transaction.
job->Start();
- ASSERT_TRUE(network_layer_.last_transaction().get());
+ ASSERT_TRUE(network_layer_.last_transaction());
EXPECT_EQ(LOW, network_layer_.last_transaction()->priority());
}
diff --git a/sync/internal_api/public/util/weak_handle.h b/sync/internal_api/public/util/weak_handle.h
index 24fccbc..c299be7 100644
--- a/sync/internal_api/public/util/weak_handle.h
+++ b/sync/internal_api/public/util/weak_handle.h
@@ -208,7 +208,7 @@ class WeakHandleCore
template <typename U>
void DoCall0(void (U::*fn)(void)) const {
CHECK(IsOnOwnerThread());
- if (!Get().get()) {
+ if (!Get()) {
return;
}
(Get().get()->*fn)();
@@ -218,7 +218,7 @@ class WeakHandleCore
void DoCall1(void (U::*fn)(A1),
typename ParamTraits<A1>::ForwardType a1) const {
CHECK(IsOnOwnerThread());
- if (!Get().get()) {
+ if (!Get()) {
return;
}
(Get().get()->*fn)(a1);
@@ -229,7 +229,7 @@ class WeakHandleCore
typename ParamTraits<A1>::ForwardType a1,
typename ParamTraits<A2>::ForwardType a2) const {
CHECK(IsOnOwnerThread());
- if (!Get().get()) {
+ if (!Get()) {
return;
}
(Get().get()->*fn)(a1, a2);
@@ -241,7 +241,7 @@ class WeakHandleCore
typename ParamTraits<A2>::ForwardType a2,
typename ParamTraits<A3>::ForwardType a3) const {
CHECK(IsOnOwnerThread());
- if (!Get().get()) {
+ if (!Get()) {
return;
}
(Get().get()->*fn)(a1, a2, a3);
@@ -254,7 +254,7 @@ class WeakHandleCore
typename ParamTraits<A3>::ForwardType a3,
typename ParamTraits<A4>::ForwardType a4) const {
CHECK(IsOnOwnerThread());
- if (!Get().get()) {
+ if (!Get()) {
return;
}
(Get().get()->*fn)(a1, a2, a3, a4);
diff --git a/sync/internal_api/public/util/weak_handle_unittest.cc b/sync/internal_api/public/util/weak_handle_unittest.cc
index c8ba1ef..56dfe7f 100644
--- a/sync/internal_api/public/util/weak_handle_unittest.cc
+++ b/sync/internal_api/public/util/weak_handle_unittest.cc
@@ -97,7 +97,7 @@ TEST_F(WeakHandleTest, InitializedAfterDestroy) {
h = b.AsWeakHandle();
}
EXPECT_TRUE(h.IsInitialized());
- EXPECT_FALSE(h.Get().get());
+ EXPECT_FALSE(h.Get());
}
TEST_F(WeakHandleTest, InitializedAfterInvalidate) {
@@ -105,7 +105,7 @@ TEST_F(WeakHandleTest, InitializedAfterInvalidate) {
WeakHandle<Base> h = b.AsWeakHandle();
b.Kill();
EXPECT_TRUE(h.IsInitialized());
- EXPECT_FALSE(h.Get().get());
+ EXPECT_FALSE(h.Get());
}
TEST_F(WeakHandleTest, Call) {
diff --git a/webkit/browser/quota/quota_manager.cc b/webkit/browser/quota/quota_manager.cc
index b2c78b0..54d8c13 100644
--- a/webkit/browser/quota/quota_manager.cc
+++ b/webkit/browser/quota/quota_manager.cc
@@ -709,7 +709,7 @@ class QuotaManager::GetModifiedSinceHelper {
const GetOriginsCallback& callback,
StorageType type,
bool success) {
- if (!manager.get()) {
+ if (!manager) {
// The operation was aborted.
callback.Run(std::set<GURL>(), type);
return;
@@ -734,7 +734,7 @@ class QuotaManager::DumpQuotaTableHelper {
void DidDumpQuotaTable(const base::WeakPtr<QuotaManager>& manager,
const DumpQuotaTableCallback& callback,
bool success) {
- if (!manager.get()) {
+ if (!manager) {
// The operation was aborted.
callback.Run(QuotaTableEntries());
return;
@@ -766,7 +766,7 @@ class QuotaManager::DumpOriginInfoTableHelper {
void DidDumpOriginInfoTable(const base::WeakPtr<QuotaManager>& manager,
const DumpOriginInfoTableCallback& callback,
bool success) {
- if (!manager.get()) {
+ if (!manager) {
// The operation was aborted.
callback.Run(OriginInfoTableEntries());
return;