| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 def _build_mojo_shell_command(self, args, is_android): | 97 def _build_mojo_shell_command(self, args, is_android): |
| 98 content_handlers = ['%s,%s' % (mime_type, 'mojo:sky_viewer') | 98 content_handlers = ['%s,%s' % (mime_type, 'mojo:sky_viewer') |
| 99 for mime_type in SUPPORTED_MIME_TYPES] | 99 for mime_type in SUPPORTED_MIME_TYPES] |
| 100 | 100 |
| 101 remote_command_port = self.pids.get('remote_sky_command_port', self.pids
['sky_command_port']) | 101 remote_command_port = self.pids.get('remote_sky_command_port', self.pids
['sky_command_port']) |
| 102 remote_server_port = self.pids.get('remote_sky_server_port', self.pids['
sky_server_port']) | 102 remote_server_port = self.pids.get('remote_sky_server_port', self.pids['
sky_server_port']) |
| 103 | 103 |
| 104 shell_args = [ | 104 shell_args = [ |
| 105 '--v=1', | 105 '--v=1', |
| 106 '--content-handlers=%s' % ','.join(content_handlers), | 106 '--content-handlers=%s' % ','.join(content_handlers), |
| 107 '--url-mappings=mojo:window_manager=mojo:sky_debugger', | 107 '--url-mappings=mojo:window_manager=mojo:kiosk_wm', |
| 108 '--args-for=mojo:sky_debugger_prompt %d' % remote_command_port, | 108 '--args-for=mojo:sky_debugger %d' % remote_command_port, |
| 109 'mojo:window_manager', | 109 'mojo:sky_debugger', |
| 110 ] | 110 ] |
| 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'], |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 print_crash_parser.set_defaults(func=self.print_crash_command) | 562 print_crash_parser.set_defaults(func=self.print_crash_command) |
| 563 | 563 |
| 564 gdb_attach_parser = subparsers.add_parser('gdb_attach', | 564 gdb_attach_parser = subparsers.add_parser('gdb_attach', |
| 565 help='launch gdb and attach to gdbserver launched from start --gdb') | 565 help='launch gdb and attach to gdbserver launched from start --gdb') |
| 566 gdb_attach_parser.set_defaults(func=self.gdb_attach_command) | 566 gdb_attach_parser.set_defaults(func=self.gdb_attach_command) |
| 567 | 567 |
| 568 self._add_basic_command(subparsers, 'start_tracing', '/start_tracing', | 568 self._add_basic_command(subparsers, 'start_tracing', '/start_tracing', |
| 569 'starts tracing the running sky instance') | 569 'starts tracing the running sky instance') |
| 570 self._add_basic_command(subparsers, 'reload', '/reload', | 570 self._add_basic_command(subparsers, 'reload', '/reload', |
| 571 'reload the current page') | 571 'reload the current page') |
| 572 self._add_basic_command(subparsers, 'inspect', '/inspect', | |
| 573 'start the inspector on the current page (Linux only)') | |
| 574 self._add_basic_command(subparsers, 'start_profiling', '/start_profiling
', | 572 self._add_basic_command(subparsers, 'start_profiling', '/start_profiling
', |
| 575 'starts profiling the running sky instance (Linux only)') | 573 'starts profiling the running sky instance (Linux only)') |
| 576 | 574 |
| 577 stop_tracing_parser = subparsers.add_parser('stop_tracing', | 575 stop_tracing_parser = subparsers.add_parser('stop_tracing', |
| 578 help='stops tracing the running sky instance') | 576 help='stops tracing the running sky instance') |
| 579 stop_tracing_parser.add_argument('file_name', type=str, default='sky_vie
wer.trace') | 577 stop_tracing_parser.add_argument('file_name', type=str, default='sky_vie
wer.trace') |
| 580 stop_tracing_parser.set_defaults(func=self.stop_tracing_command) | 578 stop_tracing_parser.set_defaults(func=self.stop_tracing_command) |
| 581 | 579 |
| 582 stop_profiling_parser = subparsers.add_parser('stop_profiling', | 580 stop_profiling_parser = subparsers.add_parser('stop_profiling', |
| 583 help='stops profiling the running sky instance (Linux only)') | 581 help='stops profiling the running sky instance (Linux only)') |
| 584 stop_profiling_parser.set_defaults(func=self.stop_profiling_command) | 582 stop_profiling_parser.set_defaults(func=self.stop_profiling_command) |
| 585 | 583 |
| 586 load_parser = subparsers.add_parser('load', | 584 load_parser = subparsers.add_parser('load', |
| 587 help='load a new page in the currently running sky') | 585 help='load a new page in the currently running sky') |
| 588 load_parser.add_argument('url_or_path', type=str) | 586 load_parser.add_argument('url_or_path', type=str) |
| 589 load_parser.set_defaults(func=self.load_command) | 587 load_parser.set_defaults(func=self.load_command) |
| 590 | 588 |
| 591 args = parser.parse_args() | 589 args = parser.parse_args() |
| 592 args.func(args) | 590 args.func(args) |
| 593 | 591 |
| 594 self._write_pid_file(PID_FILE_PATH, self.pids) | 592 self._write_pid_file(PID_FILE_PATH, self.pids) |
| 595 | 593 |
| 596 | 594 |
| 597 if __name__ == '__main__': | 595 if __name__ == '__main__': |
| 598 SkyDebugger().main() | 596 SkyDebugger().main() |
| OLD | NEW |