| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 from skypy.skyserver import SkyServer | 6 from skypy.skyserver import SkyServer |
| 7 import argparse | 7 import argparse |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 if args.url_or_path: | 112 if args.url_or_path: |
| 113 shell_args.append( | 113 shell_args.append( |
| 114 '--args-for=mojo:window_manager %s' % self._url_from_args(args)) | 114 '--args-for=mojo:window_manager %s' % self._url_from_args(args)) |
| 115 | 115 |
| 116 # Map all mojo: urls to http: urls using the --origin command. | 116 # Map all mojo: urls to http: urls using the --origin command. |
| 117 build_dir_url = SkyServer.url_for_path( | 117 build_dir_url = SkyServer.url_for_path( |
| 118 remote_server_port, | 118 remote_server_port, |
| 119 self.pids['sky_server_root'], | 119 self.pids['sky_server_root'], |
| 120 self.pids['build_dir']) | 120 self.pids['build_dir']) |
| 121 shell_args += ['--origin=%s' % build_dir_url] | 121 |
| 122 # TODO(eseidel): We should do this on linux, but we need to fix |
| 123 # mojo http loading to be faster first. |
| 124 if is_android: |
| 125 shell_args += ['--origin=%s' % build_dir_url] |
| 122 | 126 |
| 123 # Desktop-only work-around for mojo crashing under chromoting. | 127 # Desktop-only work-around for mojo crashing under chromoting. |
| 124 if not is_android and args.use_osmesa: | 128 if not is_android and args.use_osmesa: |
| 125 shell_args.append( | 129 shell_args.append( |
| 126 '--args-for=mojo:native_viewport_service --use-osmesa') | 130 '--args-for=mojo:native_viewport_service --use-osmesa') |
| 127 | 131 |
| 128 if is_android and args.gdb: | 132 if is_android and args.gdb: |
| 129 shell_args.append('--wait-for-debugger') | 133 shell_args.append('--wait-for-debugger') |
| 130 | 134 |
| 131 if 'remote_sky_server_port' in self.pids: | 135 if 'remote_sky_server_port' in self.pids: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 191 |
| 188 sky_server = self.sky_server_for_args(args) | 192 sky_server = self.sky_server_for_args(args) |
| 189 self.pids['sky_server_pid'] = sky_server.start() | 193 self.pids['sky_server_pid'] = sky_server.start() |
| 190 self.pids['sky_server_port'] = sky_server.port | 194 self.pids['sky_server_port'] = sky_server.port |
| 191 self.pids['sky_server_root'] = sky_server.root | 195 self.pids['sky_server_root'] = sky_server.root |
| 192 | 196 |
| 193 self.pids['build_dir'] = self.paths.build_dir | 197 self.pids['build_dir'] = self.paths.build_dir |
| 194 self.pids['sky_command_port'] = args.command_port | 198 self.pids['sky_command_port'] = args.command_port |
| 195 | 199 |
| 196 if is_android: | 200 if is_android: |
| 201 # TODO(eseidel): This should move into a helper method and handle |
| 202 # failures with nice messages explaining how to get root. |
| 197 subprocess.check_call([ADB_PATH, 'root']) | 203 subprocess.check_call([ADB_PATH, 'root']) |
| 198 | 204 |
| 199 # We could make installing conditional on an argument. | 205 # We could make installing conditional on an argument. |
| 200 apk_path = os.path.join(self.paths.build_dir, 'apks', | 206 apk_path = os.path.join(self.paths.build_dir, 'apks', |
| 201 ANDROID_APK_NAME) | 207 ANDROID_APK_NAME) |
| 202 subprocess.check_call([ADB_PATH, 'install', '-r', apk_path]) | 208 subprocess.check_call([ADB_PATH, 'install', '-r', apk_path]) |
| 203 | 209 |
| 204 port_string = 'tcp:%s' % sky_server.port | 210 port_string = 'tcp:%s' % sky_server.port |
| 205 subprocess.check_call([ | 211 subprocess.check_call([ |
| 206 ADB_PATH, 'reverse', port_string, port_string | 212 ADB_PATH, 'reverse', port_string, port_string |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 load_parser.set_defaults(func=self.load_command) | 600 load_parser.set_defaults(func=self.load_command) |
| 595 | 601 |
| 596 args = parser.parse_args() | 602 args = parser.parse_args() |
| 597 args.func(args) | 603 args.func(args) |
| 598 | 604 |
| 599 self._write_pid_file(PID_FILE_PATH, self.pids) | 605 self._write_pid_file(PID_FILE_PATH, self.pids) |
| 600 | 606 |
| 601 | 607 |
| 602 if __name__ == '__main__': | 608 if __name__ == '__main__': |
| 603 SkyDebugger().main() | 609 SkyDebugger().main() |
| OLD | NEW |