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

Unified Diff: mojo/service_manager/background_shell_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: more gn 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_shell_service_loader.cc
diff --git a/mojo/service_manager/background_shell_service_loader.cc b/mojo/service_manager/background_shell_service_loader.cc
index ef97255f283cc87fde323d617f9c6473890263a3..d0e5e978f52b1a3921cd338fbda09e8e3e8a7ce6 100644
--- a/mojo/service_manager/background_shell_service_loader.cc
+++ b/mojo/service_manager/background_shell_service_loader.cc
@@ -15,10 +15,12 @@ class BackgroundShellServiceLoader::BackgroundLoader {
explicit BackgroundLoader(ServiceLoader* loader) : loader_(loader) {}
~BackgroundLoader() {}
- void LoadService(ServiceManager* manager,
- const GURL& url,
- ScopedMessagePipeHandle shell_handle) {
- loader_->LoadService(manager, url, shell_handle.Pass());
+ 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 OnServiceError(ServiceManager* manager, const GURL& url) {
@@ -47,17 +49,21 @@ BackgroundShellServiceLoader::~BackgroundShellServiceLoader() {
thread_->Join();
}
-void BackgroundShellServiceLoader::LoadService(
+void BackgroundShellServiceLoader::Load(
ServiceManager* manager,
const GURL& url,
- ScopedMessagePipeHandle shell_handle) {
+ scoped_refptr<LoadCallbacks> callbacks) {
+ ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
+ if (!shell_handle.is_valid())
+ return;
+
if (!thread_) {
- // TODO(tim): It'd be nice if we could just have each LoadService call
+ // TODO(tim): It'd be nice if we could just have each Load 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
- // LoadService calls for now.
+ // Load calls for now.
thread_.reset(new base::DelegateSimpleThread(this, thread_name_));
thread_->Start();
message_loop_created_.Wait();
@@ -65,7 +71,7 @@ void BackgroundShellServiceLoader::LoadService(
}
task_runner_->PostTask(FROM_HERE,
- base::Bind(&BackgroundShellServiceLoader::LoadServiceOnBackgroundThread,
+ base::Bind(&BackgroundShellServiceLoader::LoadOnBackgroundThread,
base::Unretained(this), manager, url,
base::Owned(
new ScopedMessagePipeHandle(shell_handle.Pass()))));
@@ -93,14 +99,14 @@ void BackgroundShellServiceLoader::Run() {
loader_.reset();
}
-void BackgroundShellServiceLoader::LoadServiceOnBackgroundThread(
+void BackgroundShellServiceLoader::LoadOnBackgroundThread(
ServiceManager* manager,
const GURL& url,
ScopedMessagePipeHandle* shell_handle) {
DCHECK(task_runner_->RunsTasksOnCurrentThread());
if (!background_loader_)
background_loader_ = new BackgroundLoader(loader_.get());
- background_loader_->LoadService(manager, url, shell_handle->Pass());
+ background_loader_->Load(manager, url, shell_handle->Pass());
}
void BackgroundShellServiceLoader::OnServiceErrorOnBackgroundThread(

Powered by Google App Engine
This is Rietveld 408576698