Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1671)

Unified Diff: mojo/service_manager/background_service_loader.cc

Issue 423963004: First cut at "content handling" support in Mojo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use URLResponse with ContentHandler interface instead of data pipe Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698