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

Side by Side Diff: services/shell/runner/child/test_native_main.cc

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/shell/runner/child/test_native_main.h" 5 #include "services/shell/runner/child/test_native_main.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/process/launch.h" 12 #include "base/process/launch.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "mojo/edk/embedder/embedder.h" 15 #include "mojo/edk/embedder/embedder.h"
16 #include "mojo/edk/embedder/process_delegate.h" 16 #include "mojo/edk/embedder/process_delegate.h"
17 #include "services/shell/public/cpp/shell_client.h" 17 #include "services/shell/public/cpp/shell_client.h"
18 #include "services/shell/public/cpp/shell_connection.h" 18 #include "services/shell/public/cpp/shell_connection.h"
19 #include "services/shell/runner/common/client_util.h" 19 #include "services/shell/runner/common/client_util.h"
20 #include "services/shell/runner/init.h" 20 #include "services/shell/runner/init.h"
21 21
22 namespace mojo {
23 namespace shell { 22 namespace shell {
24 namespace { 23 namespace {
25 24
26 class ProcessDelegate : public mojo::edk::ProcessDelegate { 25 class ProcessDelegate : public mojo::edk::ProcessDelegate {
27 public: 26 public:
28 ProcessDelegate() {} 27 ProcessDelegate() {}
29 ~ProcessDelegate() override {} 28 ~ProcessDelegate() override {}
30 29
31 private: 30 private:
32 void OnShutdownComplete() override {} 31 void OnShutdownComplete() override {}
33 32
34 DISALLOW_COPY_AND_ASSIGN(ProcessDelegate); 33 DISALLOW_COPY_AND_ASSIGN(ProcessDelegate);
35 }; 34 };
36 35
37 } // namespace 36 } // namespace
38 37
39 int TestNativeMain(mojo::ShellClient* shell_client) { 38 int TestNativeMain(shell::ShellClient* shell_client) {
40 mojo::shell::WaitForDebuggerIfNecessary(); 39 shell::WaitForDebuggerIfNecessary();
41 40
42 #if !defined(OFFICIAL_BUILD) 41 #if !defined(OFFICIAL_BUILD)
43 base::debug::EnableInProcessStackDumping(); 42 base::debug::EnableInProcessStackDumping();
44 #if defined(OS_WIN) 43 #if defined(OS_WIN)
45 base::RouteStdioToConsole(false); 44 base::RouteStdioToConsole(false);
46 #endif 45 #endif
47 #endif 46 #endif
48 47
49 { 48 {
50 mojo::edk::Init(); 49 mojo::edk::Init();
51 50
52 ProcessDelegate process_delegate; 51 ProcessDelegate process_delegate;
53 base::Thread io_thread("io_thread"); 52 base::Thread io_thread("io_thread");
54 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); 53 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0);
55 CHECK(io_thread.StartWithOptions(io_thread_options)); 54 CHECK(io_thread.StartWithOptions(io_thread_options));
56 55
57 mojo::edk::InitIPCSupport(&process_delegate, io_thread.task_runner()); 56 mojo::edk::InitIPCSupport(&process_delegate, io_thread.task_runner());
58 mojo::edk::SetParentPipeHandleFromCommandLine(); 57 mojo::edk::SetParentPipeHandleFromCommandLine();
59 58
60 base::MessageLoop loop; 59 base::MessageLoop loop;
61 mojo::ShellConnection impl( 60 shell::ShellConnection impl(shell_client,
62 shell_client, mojo::shell::GetShellClientRequestFromCommandLine()); 61 shell::GetShellClientRequestFromCommandLine());
63 loop.Run(); 62 loop.Run();
64 63
65 mojo::edk::ShutdownIPCSupport(); 64 mojo::edk::ShutdownIPCSupport();
66 } 65 }
67 66
68 return 0; 67 return 0;
69 } 68 }
70 69
71 } // namespace shell 70 } // namespace shell
72 } // namespace mojo
OLDNEW
« no previous file with comments | « services/shell/runner/child/test_native_main.h ('k') | services/shell/runner/child/test_native_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698