Index: mojo/service_manager/background_service_loader.cc |
diff --git a/mojo/service_manager/background_service_loader.cc b/mojo/service_manager/background_service_loader.cc |
index 8c60a2cc00696df313e989933dcf63d6875d480f..dc6d9b6cdee8c60debb137f1b7b661e15100ad83 100644 |
--- a/mojo/service_manager/background_service_loader.cc |
+++ b/mojo/service_manager/background_service_loader.cc |
@@ -17,7 +17,9 @@ class BackgroundServiceLoader::BackgroundLoader { |
void LoadService(ServiceManager* manager, |
const GURL& url, |
ScopedMessagePipeHandle shell_handle) { |
- loader_->LoadService(manager, url, shell_handle.Pass()); |
+ scoped_refptr<LoadServiceCallbacks> callbacks( |
+ new ServiceLoader::SimpleLoadServiceCallbacks(shell_handle.Pass())); |
+ loader_->LoadService(manager, url, callbacks); |
} |
void OnServiceError(ServiceManager* manager, const GURL& url) { |
@@ -54,8 +56,14 @@ BackgroundServiceLoader::~BackgroundServiceLoader() { |
void BackgroundServiceLoader::LoadService( |
ServiceManager* manager, |
const GURL& url, |
- ScopedMessagePipeHandle shell_handle) { |
+ scoped_refptr<LoadServiceCallbacks> callbacks) { |
const int kDefaultStackSize = 0; |
+ |
+ ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); |
+ if (!shell_handle.is_valid()) { |
+ return; |
+ } |
+ |
if (!thread_.IsRunning()) { |
thread_.StartWithOptions( |
base::Thread::Options(message_loop_type_, kDefaultStackSize)); |
@@ -64,8 +72,7 @@ void BackgroundServiceLoader::LoadService( |
FROM_HERE, |
base::Bind(&BackgroundServiceLoader::LoadServiceOnBackgroundThread, |
base::Unretained(this), manager, url, |
- base::Owned( |
- new ScopedMessagePipeHandle(shell_handle.Pass())))); |
+ base::Passed(&shell_handle))); |
} |
void BackgroundServiceLoader::OnServiceError(ServiceManager* manager, |
@@ -81,11 +88,11 @@ void BackgroundServiceLoader::OnServiceError(ServiceManager* manager, |
void BackgroundServiceLoader::LoadServiceOnBackgroundThread( |
ServiceManager* manager, |
const GURL& url, |
- ScopedMessagePipeHandle* shell_handle) { |
+ ScopedMessagePipeHandle shell_handle) { |
if (!background_loader_) |
background_loader_ = new BackgroundLoader(loader_.get()); |
background_loader_->LoadService( |
- manager, url, shell_handle->Pass()); |
+ manager, url, shell_handle.Pass()); |
} |
void BackgroundServiceLoader::OnServiceErrorOnBackgroundThread( |