| OLD | NEW |
| 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 "mojo/runner/context.h" | 5 #include "mojo/runner/context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "components/devtools_service/public/cpp/switches.h" |
| 23 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h
" | 24 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h
" |
| 24 #include "mojo/application/public/cpp/application_connection.h" | 25 #include "mojo/application/public/cpp/application_connection.h" |
| 25 #include "mojo/application/public/cpp/application_delegate.h" | 26 #include "mojo/application/public/cpp/application_delegate.h" |
| 26 #include "mojo/application/public/cpp/application_impl.h" | 27 #include "mojo/application/public/cpp/application_impl.h" |
| 27 #include "mojo/common/trace_controller_impl.h" | 28 #include "mojo/common/trace_controller_impl.h" |
| 28 #include "mojo/common/tracing_impl.h" | 29 #include "mojo/common/tracing_impl.h" |
| 29 #include "mojo/edk/embedder/embedder.h" | 30 #include "mojo/edk/embedder/embedder.h" |
| 30 #include "mojo/edk/embedder/simple_platform_support.h" | 31 #include "mojo/edk/embedder/simple_platform_support.h" |
| 31 #include "mojo/runner/in_process_native_runner.h" | 32 #include "mojo/runner/in_process_native_runner.h" |
| 32 #include "mojo/runner/out_of_process_native_runner.h" | 33 #include "mojo/runner/out_of_process_native_runner.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 168 } |
| 168 | 169 |
| 169 shell::NativeRunnerFactory::Options options; | 170 shell::NativeRunnerFactory::Options options; |
| 170 options.force_in_process = true; | 171 options.force_in_process = true; |
| 171 manager->SetNativeOptionsForURL(options, gurl); | 172 manager->SetNativeOptionsForURL(options, gurl); |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 | 175 |
| 175 void InitDevToolsServiceIfNeeded(shell::ApplicationManager* manager, | 176 void InitDevToolsServiceIfNeeded(shell::ApplicationManager* manager, |
| 176 const base::CommandLine& command_line) { | 177 const base::CommandLine& command_line) { |
| 177 if (!command_line.HasSwitch(switches::kRemoteDebuggingPort)) | 178 if (!command_line.HasSwitch(devtools_service::kRemoteDebuggingPort)) |
| 178 return; | 179 return; |
| 179 | 180 |
| 180 std::string port_str = | 181 std::string port_str = |
| 181 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); | 182 command_line.GetSwitchValueASCII(devtools_service::kRemoteDebuggingPort); |
| 182 unsigned port; | 183 unsigned port; |
| 183 if (!base::StringToUint(port_str, &port) || port > 65535) { | 184 if (!base::StringToUint(port_str, &port) || port > 65535) { |
| 184 LOG(ERROR) << "Invalid value for switch " << switches::kRemoteDebuggingPort | 185 LOG(ERROR) << "Invalid value for switch " |
| 185 << ": '" << port_str << "' is not a valid port number."; | 186 << devtools_service::kRemoteDebuggingPort << ": '" << port_str |
| 187 << "' is not a valid port number."; |
| 186 return; | 188 return; |
| 187 } | 189 } |
| 188 | 190 |
| 189 ServiceProviderPtr devtools_service_provider; | 191 ServiceProviderPtr devtools_service_provider; |
| 190 URLRequestPtr request(URLRequest::New()); | 192 URLRequestPtr request(URLRequest::New()); |
| 191 request->url = "mojo:devtools_service"; | 193 request->url = "mojo:devtools_service"; |
| 192 manager->ConnectToApplication(request.Pass(), GURL("mojo:shell"), | 194 manager->ConnectToApplication(request.Pass(), GURL("mojo:shell"), |
| 193 GetProxy(&devtools_service_provider), nullptr, | 195 GetProxy(&devtools_service_provider), nullptr, |
| 194 base::Closure()); | 196 base::Closure()); |
| 195 | 197 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 374 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
| 373 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 375 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 374 task_runners_->shell_runner()); | 376 task_runners_->shell_runner()); |
| 375 base::MessageLoop::current()->Quit(); | 377 base::MessageLoop::current()->Quit(); |
| 376 } | 378 } |
| 377 } | 379 } |
| 378 } | 380 } |
| 379 | 381 |
| 380 } // namespace runner | 382 } // namespace runner |
| 381 } // namespace mojo | 383 } // namespace mojo |
| OLD | NEW |