| Index: trunk/src/mojo/service_manager/background_shell_service_loader.cc
|
| ===================================================================
|
| --- trunk/src/mojo/service_manager/background_shell_service_loader.cc (revision 288042)
|
| +++ trunk/src/mojo/service_manager/background_shell_service_loader.cc (working copy)
|
| @@ -15,12 +15,10 @@
|
| explicit BackgroundLoader(ServiceLoader* loader) : loader_(loader) {}
|
| ~BackgroundLoader() {}
|
|
|
| - void Load(ServiceManager* manager,
|
| - const GURL& url,
|
| - ScopedMessagePipeHandle shell_handle) {
|
| - scoped_refptr<LoadCallbacks> callbacks(
|
| - new ServiceLoader::SimpleLoadCallbacks(shell_handle.Pass()));
|
| - loader_->Load(manager, url, callbacks);
|
| + void LoadService(ServiceManager* manager,
|
| + const GURL& url,
|
| + ScopedMessagePipeHandle shell_handle) {
|
| + loader_->LoadService(manager, url, shell_handle.Pass());
|
| }
|
|
|
| void OnServiceError(ServiceManager* manager, const GURL& url) {
|
| @@ -49,21 +47,17 @@
|
| thread_->Join();
|
| }
|
|
|
| -void BackgroundShellServiceLoader::Load(
|
| +void BackgroundShellServiceLoader::LoadService(
|
| ServiceManager* manager,
|
| const GURL& url,
|
| - scoped_refptr<LoadCallbacks> callbacks) {
|
| - ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
|
| - if (!shell_handle.is_valid())
|
| - return;
|
| -
|
| + ScopedMessagePipeHandle shell_handle) {
|
| if (!thread_) {
|
| - // TODO(tim): It'd be nice if we could just have each Load call
|
| + // TODO(tim): It'd be nice if we could just have each LoadService call
|
| // result in a new thread like DynamicService{Loader, Runner}. But some
|
| // loaders are creating multiple ApplicationImpls (NetworkServiceLoader)
|
| // sharing a delegate (etc). So we have to keep it single threaded, wait
|
| // for the thread to initialize, and post to the TaskRunner for subsequent
|
| - // Load calls for now.
|
| + // LoadService calls for now.
|
| thread_.reset(new base::DelegateSimpleThread(this, thread_name_));
|
| thread_->Start();
|
| message_loop_created_.Wait();
|
| @@ -71,7 +65,7 @@
|
| }
|
|
|
| task_runner_->PostTask(FROM_HERE,
|
| - base::Bind(&BackgroundShellServiceLoader::LoadOnBackgroundThread,
|
| + base::Bind(&BackgroundShellServiceLoader::LoadServiceOnBackgroundThread,
|
| base::Unretained(this), manager, url,
|
| base::Owned(
|
| new ScopedMessagePipeHandle(shell_handle.Pass()))));
|
| @@ -99,14 +93,14 @@
|
| loader_.reset();
|
| }
|
|
|
| -void BackgroundShellServiceLoader::LoadOnBackgroundThread(
|
| +void BackgroundShellServiceLoader::LoadServiceOnBackgroundThread(
|
| ServiceManager* manager,
|
| const GURL& url,
|
| ScopedMessagePipeHandle* shell_handle) {
|
| DCHECK(task_runner_->RunsTasksOnCurrentThread());
|
| if (!background_loader_)
|
| background_loader_ = new BackgroundLoader(loader_.get());
|
| - background_loader_->Load(manager, url, shell_handle->Pass());
|
| + background_loader_->LoadService(manager, url, shell_handle->Pass());
|
| }
|
|
|
| void BackgroundShellServiceLoader::OnServiceErrorOnBackgroundThread(
|
|
|