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

Side by Side Diff: shell/desktop/main.cc

Issue 1067173003: Remove mojo:: part of mojo::shell:: nested namespace in //shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iostream> 9 #include <iostream>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 base::Bind(EndTraceAndFlush, base::Unretained(&flush_complete_event))); 100 base::Bind(EndTraceAndFlush, base::Unretained(&flush_complete_event)));
101 flush_complete_event.Wait(); 101 flush_complete_event.Wait();
102 } 102 }
103 103
104 } // namespace 104 } // namespace
105 105
106 int main(int argc, char** argv) { 106 int main(int argc, char** argv) {
107 base::AtExitManager at_exit; 107 base::AtExitManager at_exit;
108 base::CommandLine::Init(argc, argv); 108 base::CommandLine::Init(argc, argv);
109 109
110 mojo::shell::InitializeLogging(); 110 shell::InitializeLogging();
111 111
112 const base::CommandLine& command_line = 112 const base::CommandLine& command_line =
113 *base::CommandLine::ForCurrentProcess(); 113 *base::CommandLine::ForCurrentProcess();
114 if (command_line.HasSwitch(switches::kHelp) || 114 if (command_line.HasSwitch(switches::kHelp) ||
115 command_line.GetArgs().empty()) { 115 command_line.GetArgs().empty()) {
116 Usage(); 116 Usage();
117 return 0; 117 return 0;
118 } 118 }
119 119
120 const std::set<std::string> all_switches = switches::GetAllSwitches(); 120 const std::set<std::string> all_switches = switches::GetAllSwitches();
(...skipping 19 matching lines...) Expand all
140 #if !defined(NDEBUG) || !defined(ENABLE_PROFILING) 140 #if !defined(NDEBUG) || !defined(ENABLE_PROFILING)
141 LOG(ERROR) << "Profiling requires is_debug=false and " 141 LOG(ERROR) << "Profiling requires is_debug=false and "
142 << "enable_profiling=true. Continuing without profiling."; 142 << "enable_profiling=true. Continuing without profiling.";
143 // StartProfiling() and StopProfiling() are a no-op. 143 // StartProfiling() and StopProfiling() are a no-op.
144 #endif 144 #endif
145 base::debug::StartProfiling("mojo_shell.pprof"); 145 base::debug::StartProfiling("mojo_shell.pprof");
146 } 146 }
147 147
148 // We want the shell::Context to outlive the MessageLoop so that pipes are all 148 // We want the shell::Context to outlive the MessageLoop so that pipes are all
149 // gracefully closed / error-out before we try to shut the Context down. 149 // gracefully closed / error-out before we try to shut the Context down.
150 mojo::shell::Context shell_context; 150 shell::Context shell_context;
151 { 151 {
152 base::MessageLoop message_loop; 152 base::MessageLoop message_loop;
153 if (!shell_context.Init()) { 153 if (!shell_context.Init()) {
154 Usage(); 154 Usage();
155 return 1; 155 return 1;
156 } 156 }
157 if (g_tracing) { 157 if (g_tracing) {
158 message_loop.PostDelayedTask(FROM_HERE, 158 message_loop.PostDelayedTask(FROM_HERE,
159 base::Bind(StopTracingAndFlushToDisk), 159 base::Bind(StopTracingAndFlushToDisk),
160 base::TimeDelta::FromSeconds(5)); 160 base::TimeDelta::FromSeconds(5));
161 } 161 }
162 162
163 // The mojo_shell --args-for command-line switch is handled specially 163 // The mojo_shell --args-for command-line switch is handled specially
164 // because it can appear more than once. The base::CommandLine class 164 // because it can appear more than once. The base::CommandLine class
165 // collapses multiple occurrences of the same switch. 165 // collapses multiple occurrences of the same switch.
166 for (int i = 1; i < argc; i++) 166 for (int i = 1; i < argc; i++)
167 ApplyApplicationArgs(&shell_context, argv[i]); 167 ApplyApplicationArgs(&shell_context, argv[i]);
168 168
169 message_loop.PostTask( 169 message_loop.PostTask(
170 FROM_HERE, 170 FROM_HERE, base::Bind(&shell::RunCommandLineApps, &shell_context));
171 base::Bind(&mojo::shell::RunCommandLineApps, &shell_context));
172 message_loop.Run(); 171 message_loop.Run();
173 172
174 // Must be called before |message_loop| is destroyed. 173 // Must be called before |message_loop| is destroyed.
175 shell_context.Shutdown(); 174 shell_context.Shutdown();
176 } 175 }
177 176
178 if (command_line.HasSwitch(switches::kCPUProfile)) 177 if (command_line.HasSwitch(switches::kCPUProfile))
179 base::debug::StopProfiling(); 178 base::debug::StopProfiling();
180 if (g_tracing) 179 if (g_tracing)
181 StopTracingAndFlushToDisk(); 180 StopTracingAndFlushToDisk();
182 return 0; 181 return 0;
183 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698