summaryrefslogtreecommitdiffstats
path: root/mojo/shell
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 09:10:00 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 09:10:00 +0000
commit34c758ba3a40ac0e15c9260e529cb2b05b5b92cf (patch)
treebec504efb3710d670dac56c8c6b1c90df633055d /mojo/shell
parentc9024fc64322c3a1edf08c8c8b3656082c192edd (diff)
downloadchromium_src-34c758ba3a40ac0e15c9260e529cb2b05b5b92cf.zip
chromium_src-34c758ba3a40ac0e15c9260e529cb2b05b5b92cf.tar.gz
chromium_src-34c758ba3a40ac0e15c9260e529cb2b05b5b92cf.tar.bz2
Adds ability to load services on background thread
And enables this for the native viewport. Currently the native viewport implementation can end up synchronously waiting for messages. This means if the viewmanager (which uses the native viewport) and native viewport end up on the same thread they can easily deadlock. For now I'm moving native viewport to its own thread. Long term native viewport should live in its own process (according to piman). BUG=365012 TEST=none R=davemoore@chromium.org Review URL: https://codereview.chromium.org/263163005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r--mojo/shell/context.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index 86f06c3..f5d405f 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -11,6 +11,7 @@
#include "mojo/embedder/embedder.h"
#include "mojo/gles2/gles2_support_impl.h"
#include "mojo/public/cpp/shell/application.h"
+#include "mojo/service_manager/background_service_loader.h"
#include "mojo/service_manager/service_loader.h"
#include "mojo/service_manager/service_manager.h"
#include "mojo/services/native_viewport/native_viewport_service.h"
@@ -122,8 +123,14 @@ Context::Context()
service_manager_.set_default_loader(
scoped_ptr<ServiceLoader>(
new DynamicServiceLoader(this, runner_factory.Pass())));
+ // The native viewport service synchronously waits for certain messages. If we
+ // don't run it on its own thread we can easily deadlock. Long term native
+ // viewport should run its own process so that this isn't an issue.
service_manager_.SetLoaderForURL(
- scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader(this)),
+ scoped_ptr<ServiceLoader>(
+ new BackgroundServiceLoader(
+ scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader(this)),
+ "native_viewport")),
GURL("mojo:mojo_native_viewport_service"));
#if defined(USE_AURA)
// TODO(sky): need a better way to find this. It shouldn't be linked in.
@@ -145,6 +152,14 @@ Context::Context()
}
Context::~Context() {
+ // mojo_view_manager uses native_viewport. Destroy mojo_view_manager first so
+ // that there aren't shutdown ordering issues. Once native viewport service is
+ // moved into its own process this can likely be nuked.
+#if defined(USE_AURA)
+ service_manager_.SetLoaderForURL(
+ scoped_ptr<ServiceLoader>(),
+ GURL("mojo:mojo_view_manager"));
+#endif
service_manager_.set_default_loader(scoped_ptr<ServiceLoader>());
}