Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / mojo / shell / android / mojo_main.cc
index 097e861..951742f 100644 (file)
@@ -12,6 +12,7 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "jni/MojoMain_jni.h"
+#include "mojo/public/shell/application.h"
 #include "mojo/services/native_viewport/native_viewport_service.h"
 #include "mojo/shell/context.h"
 #include "mojo/shell/init.h"
@@ -25,8 +26,6 @@ namespace mojo {
 
 namespace {
 
-base::AtExitManager* g_at_exit = 0;
-
 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop =
     LAZY_INSTANCE_INITIALIZER;
 
@@ -40,12 +39,12 @@ class NativeViewportServiceLoader : public shell::ServiceManager::Loader {
 
  private:
   virtual void Load(const GURL& url,
-                    ScopedMessagePipeHandle service_handle)
+                    ScopedShellHandle service_handle)
       MOJO_OVERRIDE {
-    service_.reset(CreateNativeViewportService(service_handle.Pass()));
-    service_->set_context(g_context.Get().get());
+    app_.reset(CreateNativeViewportService(g_context.Get().get(),
+                                           service_handle.Pass()));
   }
-  scoped_ptr<services::NativeViewportService> service_;
+  scoped_ptr<Application> app_;
 };
 
 LazyInstance<scoped_ptr<NativeViewportServiceLoader> >
@@ -58,11 +57,6 @@ static void Init(JNIEnv* env, jclass clazz, jobject context) {
 
   base::android::InitApplicationContext(env, scoped_context);
 
-  if (g_at_exit)
-    return;
-  g_at_exit = new base::AtExitManager();
-  // TODO(abarth): Currently we leak g_at_exit.
-
   CommandLine::Init(0, 0);
   mojo::shell::InitializeLogging();