summaryrefslogtreecommitdiffstats
path: root/mojo/shell
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 20:21:53 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 20:21:53 +0000
commit0b4731f8b49724c2f389921c4faae26f352f180c (patch)
tree16de2db325a494b7d540393b6ccbc17c294ea70b /mojo/shell
parent81c6c5e5935d84196854482cb2983dad9ef2ea3b (diff)
downloadchromium_src-0b4731f8b49724c2f389921c4faae26f352f180c.zip
chromium_src-0b4731f8b49724c2f389921c4faae26f352f180c.tar.gz
chromium_src-0b4731f8b49724c2f389921c4faae26f352f180c.tar.bz2
Rename ServiceConnector back to ServiceManager
BUG=None TEST=None TBR=darin Review URL: https://codereview.chromium.org/164313002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r--mojo/shell/android/mojo_main.cc6
-rw-r--r--mojo/shell/context.cc4
-rw-r--r--mojo/shell/context.h6
-rw-r--r--mojo/shell/dynamic_service_loader.h4
-rw-r--r--mojo/shell/run.cc6
-rw-r--r--mojo/shell/service_manager.cc (renamed from mojo/shell/service_connector.cc)38
-rw-r--r--mojo/shell/service_manager.h (renamed from mojo/shell/service_connector.h)20
-rw-r--r--mojo/shell/service_manager_unittest.cc (renamed from mojo/shell/service_connector_unittest.cc)30
8 files changed, 57 insertions, 57 deletions
diff --git a/mojo/shell/android/mojo_main.cc b/mojo/shell/android/mojo_main.cc
index e892870..951742f 100644
--- a/mojo/shell/android/mojo_main.cc
+++ b/mojo/shell/android/mojo_main.cc
@@ -17,7 +17,7 @@
#include "mojo/shell/context.h"
#include "mojo/shell/init.h"
#include "mojo/shell/run.h"
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "ui/gl/gl_surface_egl.h"
using base::LazyInstance;
@@ -32,7 +32,7 @@ LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop =
LazyInstance<scoped_ptr<shell::Context> > g_context =
LAZY_INSTANCE_INITIALIZER;
-class NativeViewportServiceLoader : public shell::ServiceConnector::Loader {
+class NativeViewportServiceLoader : public shell::ServiceManager::Loader {
public:
NativeViewportServiceLoader() {}
virtual ~NativeViewportServiceLoader() {}
@@ -92,7 +92,7 @@ static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) {
shell::Context* shell_context = new shell::Context();
shell_context->set_activity(activity.obj());
g_viewport_service_loader.Get().reset(new NativeViewportServiceLoader());
- shell_context->service_connector()->SetLoaderForURL(
+ shell_context->service_manager()->SetLoaderForURL(
g_viewport_service_loader.Get().get(),
GURL("mojo:mojo_native_viewport_service"));
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index 2ee8e82..4b044fc 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -23,11 +23,11 @@ Context::Context()
embedder::Init();
gles2::GLES2SupportImpl::Init();
dynamic_service_loader_.reset(new DynamicServiceLoader(this));
- service_connector_.set_default_loader(dynamic_service_loader_.get());
+ service_manager_.set_default_loader(dynamic_service_loader_.get());
}
Context::~Context() {
- service_connector_.set_default_loader(NULL);
+ service_manager_.set_default_loader(NULL);
}
} // namespace shell
diff --git a/mojo/shell/context.h b/mojo/shell/context.h
index 35b4d51..6bfe1c3 100644
--- a/mojo/shell/context.h
+++ b/mojo/shell/context.h
@@ -7,7 +7,7 @@
#include "mojo/shell/keep_alive.h"
#include "mojo/shell/loader.h"
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "mojo/shell/storage.h"
#include "mojo/shell/task_runners.h"
@@ -28,7 +28,7 @@ class Context {
TaskRunners* task_runners() { return &task_runners_; }
Storage* storage() { return &storage_; }
Loader* loader() { return &loader_; }
- ServiceConnector* service_connector() { return &service_connector_; }
+ ServiceManager* service_manager() { return &service_manager_; }
KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; }
#if defined(OS_ANDROID)
@@ -40,7 +40,7 @@ class Context {
TaskRunners task_runners_;
Storage storage_;
Loader loader_;
- ServiceConnector service_connector_;
+ ServiceManager service_manager_;
scoped_ptr<DynamicServiceLoader> dynamic_service_loader_;
#if defined(OS_ANDROID)
diff --git a/mojo/shell/dynamic_service_loader.h b/mojo/shell/dynamic_service_loader.h
index ce210d9..aef76df 100644
--- a/mojo/shell/dynamic_service_loader.h
+++ b/mojo/shell/dynamic_service_loader.h
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "mojo/public/system/core_cpp.h"
#include "mojo/shell/keep_alive.h"
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "mojom/shell.h"
#include "url/gurl.h"
@@ -21,7 +21,7 @@ class Context;
// A subclass of ServiceManager::Loader that loads a dynamic library containing
// the implementation of the service.
-class DynamicServiceLoader : public ServiceConnector::Loader {
+class DynamicServiceLoader : public ServiceManager::Loader {
public:
explicit DynamicServiceLoader(Context* context);
virtual ~DynamicServiceLoader();
diff --git a/mojo/shell/run.cc b/mojo/shell/run.cc
index cbae994..ec92311 100644
--- a/mojo/shell/run.cc
+++ b/mojo/shell/run.cc
@@ -9,7 +9,7 @@
#include "base/message_loop/message_loop.h"
#include "mojo/shell/context.h"
#include "mojo/shell/keep_alive.h"
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "mojo/shell/switches.h"
#include "url/gurl.h"
@@ -35,9 +35,9 @@ void Run(Context* context) {
return;
}
ScopedMessagePipeHandle no_handle;
- context->service_connector()->Connect(GURL(*it), no_handle.Pass());
+ context->service_manager()->Connect(GURL(*it), no_handle.Pass());
}
- // TODO(davemoore): Currently we leak |service_connector|.
+ // TODO(davemoore): Currently we leak |service_manager|.
}
} // namespace shell
diff --git a/mojo/shell/service_connector.cc b/mojo/shell/service_manager.cc
index d136b4d..97a0d51 100644
--- a/mojo/shell/service_connector.cc
+++ b/mojo/shell/service_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "base/logging.h"
#include "mojo/public/bindings/allocation_scope.h"
@@ -13,14 +13,14 @@
namespace mojo {
namespace shell {
-class ServiceConnector::ServiceFactory : public Shell, public ErrorHandler {
+class ServiceManager::ServiceFactory : public Shell, public ErrorHandler {
public:
- ServiceFactory(ServiceConnector* connector, const GURL& url)
- : connector_(connector),
+ ServiceFactory(ServiceManager* manager, const GURL& url)
+ : manager_(manager),
url_(url) {
InterfacePipe<Shell> pipe;
shell_client_.reset(pipe.handle_to_peer.Pass(), this, this);
- connector_->GetLoaderForURL(url)->Load(url, pipe.handle_to_self.Pass());
+ manager_->GetLoaderForURL(url)->Load(url, pipe.handle_to_self.Pass());
}
virtual ~ServiceFactory() {}
@@ -33,34 +33,34 @@ class ServiceConnector::ServiceFactory : public Shell, public ErrorHandler {
virtual void Connect(const String& url,
ScopedMessagePipeHandle client_pipe) MOJO_OVERRIDE {
- connector_->Connect(GURL(url.To<std::string>()), client_pipe.Pass());
+ manager_->Connect(GURL(url.To<std::string>()), client_pipe.Pass());
}
virtual void OnError() MOJO_OVERRIDE {
- connector_->RemoveServiceFactory(this);
+ manager_->RemoveServiceFactory(this);
}
const GURL& url() const { return url_; }
private:
- ServiceConnector* const connector_;
+ ServiceManager* const manager_;
const GURL url_;
RemotePtr<ShellClient> shell_client_;
DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
};
-ServiceConnector::Loader::Loader() {}
-ServiceConnector::Loader::~Loader() {}
+ServiceManager::Loader::Loader() {}
+ServiceManager::Loader::~Loader() {}
-bool ServiceConnector::TestAPI::HasFactoryForURL(const GURL& url) const {
- return connector_->url_to_service_factory_.find(url) !=
- connector_->url_to_service_factory_.end();
+bool ServiceManager::TestAPI::HasFactoryForURL(const GURL& url) const {
+ return manager_->url_to_service_factory_.find(url) !=
+ manager_->url_to_service_factory_.end();
}
-ServiceConnector::ServiceConnector() : default_loader_(NULL) {
+ServiceManager::ServiceManager() : default_loader_(NULL) {
}
-ServiceConnector::~ServiceConnector() {
+ServiceManager::~ServiceManager() {
for (ServiceFactoryMap::iterator it = url_to_service_factory_.begin();
it != url_to_service_factory_.end(); ++it) {
delete it->second;
@@ -68,12 +68,12 @@ ServiceConnector::~ServiceConnector() {
url_to_service_factory_.clear();
}
-void ServiceConnector::SetLoaderForURL(Loader* loader, const GURL& gurl) {
+void ServiceManager::SetLoaderForURL(Loader* loader, const GURL& gurl) {
DCHECK(url_to_loader_.find(gurl) == url_to_loader_.end());
url_to_loader_[gurl] = loader;
}
-ServiceConnector::Loader* ServiceConnector::GetLoaderForURL(const GURL& gurl) {
+ServiceManager::Loader* ServiceManager::GetLoaderForURL(const GURL& gurl) {
LoaderMap::const_iterator it = url_to_loader_.find(gurl);
if (it != url_to_loader_.end())
return it->second;
@@ -81,7 +81,7 @@ ServiceConnector::Loader* ServiceConnector::GetLoaderForURL(const GURL& gurl) {
return default_loader_;
}
-void ServiceConnector::Connect(const GURL& url,
+void ServiceManager::Connect(const GURL& url,
ScopedMessagePipeHandle client_handle) {
ServiceFactoryMap::const_iterator service_it =
url_to_service_factory_.find(url);
@@ -95,7 +95,7 @@ void ServiceConnector::Connect(const GURL& url,
service_factory->ConnectToClient(client_handle.Pass());
}
-void ServiceConnector::RemoveServiceFactory(ServiceFactory* service_factory) {
+void ServiceManager::RemoveServiceFactory(ServiceFactory* service_factory) {
ServiceFactoryMap::iterator it =
url_to_service_factory_.find(service_factory->url());
DCHECK(it != url_to_service_factory_.end());
diff --git a/mojo/shell/service_connector.h b/mojo/shell/service_manager.h
index 41587ef..b21393a 100644
--- a/mojo/shell/service_connector.h
+++ b/mojo/shell/service_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MOJO_SHELL_SERVICE_CONNECTOR_H_
-#define MOJO_SHELL_SERVICE_CONNECTOR_H_
+#ifndef MOJO_SHELL_service_manager_H_
+#define MOJO_SHELL_service_manager_H_
#include <map>
@@ -16,7 +16,7 @@
namespace mojo {
namespace shell {
-class ServiceConnector {
+class ServiceManager {
public:
// Interface to allowing default loading behavior to be overridden for a
// specific url.
@@ -32,16 +32,16 @@ class ServiceConnector {
// API for testing.
class TestAPI {
private:
- friend class ServiceConnectorTest;
- explicit TestAPI(ServiceConnector* connector) : connector_(connector) {}
+ friend class ServiceManagerTest;
+ explicit TestAPI(ServiceManager* manager) : manager_(manager) {}
// Returns true if there is a ServiceFactory for this URL.
bool HasFactoryForURL(const GURL& url) const;
- ServiceConnector* connector_;
+ ServiceManager* manager_;
};
- ServiceConnector();
- ~ServiceConnector();
+ ServiceManager();
+ ~ServiceManager();
// Sets the default Loader to be used if not overridden by SetLoaderForURL().
// Does not take ownership of |loader|.
@@ -65,10 +65,10 @@ class ServiceConnector {
ServiceFactoryMap url_to_service_factory_;
typedef std::map<GURL, Loader*> LoaderMap;
LoaderMap url_to_loader_;
- DISALLOW_COPY_AND_ASSIGN(ServiceConnector);
+ DISALLOW_COPY_AND_ASSIGN(ServiceManager);
};
} // namespace shell
} // namespace mojo
-#endif // MOJO_SHELL_SERVICE_CONNECTOR_H_
+#endif // MOJO_SHELL_service_manager_H_
diff --git a/mojo/shell/service_connector_unittest.cc b/mojo/shell/service_manager_unittest.cc
index 3a264a2..ac5d1ba 100644
--- a/mojo/shell/service_connector_unittest.cc
+++ b/mojo/shell/service_manager_unittest.cc
@@ -7,7 +7,7 @@
#include "mojo/public/environment/environment.h"
#include "mojo/public/shell/application.h"
#include "mojo/public/utility/run_loop.h"
-#include "mojo/shell/service_connector.h"
+#include "mojo/shell/service_manager.h"
#include "mojom/shell.h"
#include "mojom/test.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -73,27 +73,27 @@ class TestClientImpl : public TestClient {
};
} // namespace
-class ServiceConnectorTest : public testing::Test,
- public ServiceConnector::Loader {
+class ServiceManagerTest : public testing::Test,
+ public ServiceManager::Loader {
public:
- ServiceConnectorTest() {}
+ ServiceManagerTest() {}
- virtual ~ServiceConnectorTest() {}
+ virtual ~ServiceManagerTest() {}
virtual void SetUp() OVERRIDE {
GURL test_url(kTestURLString);
- service_connector_.reset(new ServiceConnector);
- service_connector_->SetLoaderForURL(this, test_url);
+ service_manager_.reset(new ServiceManager);
+ service_manager_->SetLoaderForURL(this, test_url);
InterfacePipe<TestService, AnyInterface> pipe;
test_client_.reset(new TestClientImpl(pipe.handle_to_self.Pass()));
- service_connector_->Connect(test_url, pipe.handle_to_peer.Pass());
+ service_manager_->Connect(test_url, pipe.handle_to_peer.Pass());
}
virtual void TearDown() OVERRIDE {
test_client_.reset(NULL);
test_app_.reset(NULL);
- service_connector_.reset(NULL);
+ service_manager_.reset(NULL);
}
virtual void Load(const GURL& url,
@@ -104,8 +104,8 @@ class ServiceConnectorTest : public testing::Test,
}
bool HasFactoryForTestURL() {
- ServiceConnector::TestAPI connector_test_api(service_connector_.get());
- return connector_test_api.HasFactoryForURL(GURL(kTestURLString));
+ ServiceManager::TestAPI manager_test_api(service_manager_.get());
+ return manager_test_api.HasFactoryForURL(GURL(kTestURLString));
}
protected:
@@ -114,17 +114,17 @@ class ServiceConnectorTest : public testing::Test,
TestContext context_;
scoped_ptr<Application> test_app_;
scoped_ptr<TestClientImpl> test_client_;
- scoped_ptr<ServiceConnector> service_connector_;
- DISALLOW_COPY_AND_ASSIGN(ServiceConnectorTest);
+ scoped_ptr<ServiceManager> service_manager_;
+ DISALLOW_COPY_AND_ASSIGN(ServiceManagerTest);
};
-TEST_F(ServiceConnectorTest, Basic) {
+TEST_F(ServiceManagerTest, Basic) {
test_client_->Test("test");
loop_.Run();
EXPECT_EQ(std::string("test"), context_.last_test_string);
}
-TEST_F(ServiceConnectorTest, ClientError) {
+TEST_F(ServiceManagerTest, ClientError) {
test_client_->Test("test");
EXPECT_TRUE(HasFactoryForTestURL());
loop_.Run();