summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 23:33:02 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 23:33:02 +0000
commit465a5018749cb3abb32673a0ac63cde236ee9be6 (patch)
tree08b625f827e9d69625c38d42c4ba86e472cb0551
parentb0349dfbcee4b07bb2d466f4c8d422a26868111d (diff)
downloadchromium_src-465a5018749cb3abb32673a0ac63cde236ee9be6.zip
chromium_src-465a5018749cb3abb32673a0ac63cde236ee9be6.tar.gz
chromium_src-465a5018749cb3abb32673a0ac63cde236ee9be6.tar.bz2
Replace Get with Create where objects are always created.
Per cwolfe's suggestion. FWIW, Create is more popular than Get for object creation per a quick grep hack: % grep 'scoped_ptr.*::Create' */.cc |wc -l 310 % grep 'scoped_ptr.*::Get' */.cc |wc -l 53 TEST=build chrome and tests BUG=none Review URL: http://codereview.chromium.org/8094007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103577 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/dbus/cros_dbus_service.cc6
-rw-r--r--chrome/browser/chromeos/dbus/cros_dbus_service.h8
-rw-r--r--chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc2
-rw-r--r--chrome/browser/chromeos/dbus/dbus_thread_manager.cc2
-rw-r--r--chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc5
-rw-r--r--chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h8
-rw-r--r--chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc2
7 files changed, 17 insertions, 16 deletions
diff --git a/chrome/browser/chromeos/dbus/cros_dbus_service.cc b/chrome/browser/chromeos/dbus/cros_dbus_service.cc
index 71e6aa4..c82019a 100644
--- a/chrome/browser/chromeos/dbus/cros_dbus_service.cc
+++ b/chrome/browser/chromeos/dbus/cros_dbus_service.cc
@@ -86,10 +86,10 @@ class CrosDBusServiceStubImpl : public CrosDBusService {
};
// static
-CrosDBusService* CrosDBusService::Get(dbus::Bus* bus) {
+CrosDBusService* CrosDBusService::Create(dbus::Bus* bus) {
if (system::runtime_environment::IsRunningOnChromeOS()) {
CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus);
- service->RegisterServiceProvider(ProxyResolutionServiceProvider::Get());
+ service->RegisterServiceProvider(ProxyResolutionServiceProvider::Create());
return service;
} else {
return new CrosDBusServiceStubImpl;
@@ -97,7 +97,7 @@ CrosDBusService* CrosDBusService::Get(dbus::Bus* bus) {
}
// static
-CrosDBusService* CrosDBusService::GetForTesting(
+CrosDBusService* CrosDBusService::CreateForTesting(
dbus::Bus* bus,
ServiceProviderInterface* proxy_resolution_service) {
CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus);
diff --git a/chrome/browser/chromeos/dbus/cros_dbus_service.h b/chrome/browser/chromeos/dbus/cros_dbus_service.h
index 2b6e0e4..3b4cf36 100644
--- a/chrome/browser/chromeos/dbus/cros_dbus_service.h
+++ b/chrome/browser/chromeos/dbus/cros_dbus_service.h
@@ -63,14 +63,14 @@ class CrosDBusService {
// Starts the D-Bus service.
virtual void Start() = 0;
- // Gets the instance.
- static CrosDBusService* Get(dbus::Bus* bus);
+ // Creates the instance.
+ static CrosDBusService* Create(dbus::Bus* bus);
private:
- // Gets the instance for testing. Takes the ownership of
+ // Creates the instance for testing. Takes the ownership of
// |proxy_resolution_service|.
friend class CrosDBusServiceTest;
- static CrosDBusService* GetForTesting(
+ static CrosDBusService* CreateForTesting(
dbus::Bus* bus,
ServiceProviderInterface* proxy_resolution_service);
};
diff --git a/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc b/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc
index 70e2ece..649f678 100644
--- a/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc
+++ b/chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc
@@ -66,7 +66,7 @@ class CrosDBusServiceTest : public testing::Test {
// Create the cros service with the mocks injected.
cros_dbus_service_.reset(
- CrosDBusService::GetForTesting(
+ CrosDBusService::CreateForTesting(
mock_bus_,
mock_proxy_resolution_service_provider));
}
diff --git a/chrome/browser/chromeos/dbus/dbus_thread_manager.cc b/chrome/browser/chromeos/dbus/dbus_thread_manager.cc
index 34ac9c5..009e846 100644
--- a/chrome/browser/chromeos/dbus/dbus_thread_manager.cc
+++ b/chrome/browser/chromeos/dbus/dbus_thread_manager.cc
@@ -31,7 +31,7 @@ DBusThreadManager::DBusThreadManager() {
system_bus_ = new dbus::Bus(system_bus_options);
// Create and start the cros D-Bus service.
- cros_dbus_service_ = CrosDBusService::Get(system_bus_.get());
+ cros_dbus_service_ = CrosDBusService::Create(system_bus_.get());
cros_dbus_service_->Start();
// Start monitoring sensors if needed.
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
index 9b445fa..3d2fa4f 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
@@ -256,11 +256,12 @@ dbus::Response* ProxyResolutionServiceProvider::ResolveProxyHandler(
return response;
}
-ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Get() {
+ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::Create() {
return new ProxyResolutionServiceProvider(new ProxyResolverImpl);
}
-ProxyResolutionServiceProvider* ProxyResolutionServiceProvider::GetForTesting(
+ProxyResolutionServiceProvider*
+ProxyResolutionServiceProvider::CreateForTesting(
ProxyResolverInterface* resolver) {
return new ProxyResolutionServiceProvider(resolver);
}
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h
index 1c1cb13..5b7f2be 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h
@@ -81,15 +81,15 @@ class ProxyResolutionServiceProvider
// CrosDBusService::ServiceProviderInterface override.
virtual void Start(scoped_refptr<dbus::ExportedObject> exported_object);
- // Gets the instance.
- static ProxyResolutionServiceProvider* Get();
+ // Creates the instance.
+ static ProxyResolutionServiceProvider* Create();
private:
explicit ProxyResolutionServiceProvider(ProxyResolverInterface *resovler);
- // Gets the instance for testing. Takes the ownership of |resovler|
+ // Creates the instance for testing. Takes the ownership of |resovler|
friend class ProxyResolutionServiceProviderTest;
- static ProxyResolutionServiceProvider* GetForTesting(
+ static ProxyResolutionServiceProvider* CreateForTesting(
ProxyResolverInterface* resolver);
// Called from ExportedObject, when ResolveProxyHandler() is exported as
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
index ad1a67f..7381409 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
@@ -133,7 +133,7 @@ class ProxyResolutionServiceProviderTest : public testing::Test {
// Create the proxy resolution service with the mock bus and the mock
// resolver injected.
proxy_resolution_service_ =
- ProxyResolutionServiceProvider::GetForTesting(mock_resolver_);
+ ProxyResolutionServiceProvider::CreateForTesting(mock_resolver_);
// Finally, start the service.
proxy_resolution_service_->Start(mock_exported_object_);