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

Unified Diff: mojo/shell/ui_service_loader_android.h

Issue 399663002: Have mojo_shell run in its custom thread on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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
« no previous file with comments | « mojo/shell/task_runners.cc ('k') | mojo/shell/ui_service_loader_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/ui_service_loader_android.h
diff --git a/mojo/shell/ui_service_loader_android.h b/mojo/shell/ui_service_loader_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebe6df9800ab2f97405e33bf659296ce6bcf13fa
--- /dev/null
+++ b/mojo/shell/ui_service_loader_android.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SHELL_UI_SERVICE_LOADER_ANDROID_H_
+#define MOJO_SHELL_UI_SERVICE_LOADER_ANDROID_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/service_manager/service_loader.h"
+
+namespace mojo {
+
+class ServiceManager;
+
+namespace shell {
+class Context;
+}
+
+// ServiceLoader implementation that creates a background thread and issues load
+// requests there.
+class UIServiceLoader : public ServiceLoader {
+ public:
+ UIServiceLoader(scoped_ptr<ServiceLoader> real_loader,
+ shell::Context* context);
+ virtual ~UIServiceLoader();
+
+ // ServiceLoader overrides:
+ virtual void LoadService(ServiceManager* manager,
+ const GURL& url,
+ ScopedMessagePipeHandle shell_handle) OVERRIDE;
+ virtual void OnServiceError(ServiceManager* manager,
+ const GURL& url) OVERRIDE;
+
+ private:
+ class UILoader;
+
+ // These functions are exected on the background thread. They call through
+ // to |background_loader_| to do the actual loading.
+ // TODO: having this code take a |manager| is fragile (as ServiceManager isn't
+ // thread safe).
+ void LoadServiceOnUIThread(ServiceManager* manager,
+ const GURL& url,
+ ScopedMessagePipeHandle* shell_handle);
+ void OnServiceErrorOnUIThread(ServiceManager* manager, const GURL& url);
+ void ShutdownOnUIThread();
+
+ scoped_ptr<ServiceLoader> loader_;
+ shell::Context* context_;
+
+ // Lives on the UI thread. Trivial interface that calls through to |loader_|.
+ UILoader* ui_loader_;
+
+ DISALLOW_COPY_AND_ASSIGN(UIServiceLoader);
+};
+
+} // namespace mojo
+
+#endif // MOJO_SHELL_UI_SERVICE_LOADER_ANDROID_H_
« no previous file with comments | « mojo/shell/task_runners.cc ('k') | mojo/shell/ui_service_loader_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698