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

Unified Diff: mojo/shell/public/cpp/lib/application_runner.cc

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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/public/cpp/interface_registry.h ('k') | mojo/shell/public/cpp/lib/application_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/application_runner.cc
diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc
deleted file mode 100644
index 201aa62da40e866be03be013d1dd9ea2e4886812..0000000000000000000000000000000000000000
--- a/mojo/shell/public/cpp/lib/application_runner.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.
-
-#include "mojo/shell/public/cpp/application_runner.h"
-
-#include "base/at_exit.h"
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/process/launch.h"
-#include "base/run_loop.h"
-#include "mojo/shell/public/cpp/shell_client.h"
-#include "mojo/shell/public/cpp/shell_connection.h"
-
-namespace mojo {
-
-int g_application_runner_argc;
-const char* const* g_application_runner_argv;
-
-ApplicationRunner::ApplicationRunner(ShellClient* client)
- : client_(scoped_ptr<ShellClient>(client)),
- message_loop_type_(base::MessageLoop::TYPE_DEFAULT),
- has_run_(false) {}
-
-ApplicationRunner::~ApplicationRunner() {}
-
-void ApplicationRunner::InitBaseCommandLine() {
- base::CommandLine::Init(g_application_runner_argc, g_application_runner_argv);
-}
-
-void ApplicationRunner::set_message_loop_type(base::MessageLoop::Type type) {
- DCHECK_NE(base::MessageLoop::TYPE_CUSTOM, type);
- DCHECK(!has_run_);
-
- message_loop_type_ = type;
-}
-
-MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle,
- bool init_base) {
- DCHECK(!has_run_);
- has_run_ = true;
-
- scoped_ptr<base::AtExitManager> at_exit;
- if (init_base) {
- InitBaseCommandLine();
- at_exit.reset(new base::AtExitManager);
- }
-
- {
- scoped_ptr<base::MessageLoop> loop;
- loop.reset(new base::MessageLoop(message_loop_type_));
-
- connection_.reset(new ShellConnection(
- client_.get(),
- MakeRequest<shell::mojom::ShellClient>(MakeScopedHandle(
- MessagePipeHandle(shell_client_request_handle)))));
- base::RunLoop run_loop;
- connection_->set_connection_lost_closure(run_loop.QuitClosure());
- run_loop.Run();
- // It's very common for the client to cache the app and terminate on errors.
- // If we don't delete the client before the app we run the risk of the
- // client having a stale reference to the app and trying to use it.
- // Note that we destruct the message loop first because that might trigger
- // connection error handlers and they might access objects created by the
- // client.
- loop.reset();
- client_.reset();
- connection_.reset();
- }
- return MOJO_RESULT_OK;
-}
-
-MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle) {
- bool init_base = true;
- if (base::CommandLine::InitializedForCurrentProcess()) {
- init_base =
- !base::CommandLine::ForCurrentProcess()->HasSwitch("single-process");
- }
- return Run(shell_client_request_handle, init_base);
-}
-
-void ApplicationRunner::DestroyShellConnection() {
- connection_.reset();
-}
-
-void ApplicationRunner::Quit() {
- base::MessageLoop::current()->QuitWhenIdle();
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/shell/public/cpp/interface_registry.h ('k') | mojo/shell/public/cpp/lib/application_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698