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 import argparse | 6 import argparse |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 from skypy.paths import Paths | 9 from skypy.paths import Paths |
10 import socket; | 10 import socket; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 def main(self): | 61 def main(self): |
62 logging.basicConfig(level=logging.INFO) | 62 logging.basicConfig(level=logging.INFO) |
63 | 63 |
64 parser = argparse.ArgumentParser(description='Sky launcher/debugger') | 64 parser = argparse.ArgumentParser(description='Sky launcher/debugger') |
65 parser.add_argument('--gdb', action='store_true') | 65 parser.add_argument('--gdb', action='store_true') |
66 parser.add_argument('--use-osmesa', action='store_true') | 66 parser.add_argument('--use-osmesa', action='store_true') |
67 parser.add_argument('url', nargs='?', type=str) | 67 parser.add_argument('url', nargs='?', type=str) |
68 args = parser.parse_args() | 68 args = parser.parse_args() |
69 | 69 |
70 content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/') | 70 content_handlers = ['%s,%s' % (mime_type, 'mojo:sky_viewer') |
71 for mime_type in SUPPORTED_MIME_TYPES] | 71 for mime_type in SUPPORTED_MIME_TYPES] |
72 shell_command = [ | 72 shell_command = [ |
73 self.paths.mojo_shell_path, | 73 self.paths.mojo_shell_path, |
74 '--v=1', | 74 '--v=1', |
75 '--content-handlers=%s' % ','.join(content_handlers), | 75 '--content-handlers=%s' % ','.join(content_handlers), |
76 '--url-mappings=mojo:window_manager=mojo:sky_debugger', | 76 '--url-mappings=mojo:window_manager=mojo:sky_debugger', |
77 'mojo:window_manager', | 77 'mojo:window_manager', |
78 ] | 78 ] |
79 if args.url: | 79 if args.url: |
80 url = args.url | 80 url = args.url |
81 if not urlparse.urlparse(url).scheme: | 81 if not urlparse.urlparse(url).scheme: |
82 url = self._start_http_server_for_file(url) | 82 url = self._start_http_server_for_file(url) |
83 | 83 |
84 prompt_args = '--args-for=mojo://sky_debugger_prompt/ %s' % url | 84 prompt_args = '--args-for=mojo:sky_debugger_prompt %s' % url |
85 shell_command.append(prompt_args) | 85 shell_command.append(prompt_args) |
86 if args.use_osmesa: | 86 if args.use_osmesa: |
87 shell_command.append('--args-for=mojo://native_viewport_service/ --u
se-osmesa') | 87 shell_command.append('--args-for=mojo:native_viewport_service --use-
osmesa') |
88 if args.gdb: | 88 if args.gdb: |
89 shell_command = ['gdb', '--args'] + shell_command | 89 shell_command = ['gdb', '--args'] + shell_command |
90 | 90 |
91 subprocess.check_call(shell_command) | 91 subprocess.check_call(shell_command) |
92 | 92 |
93 def shutdown(self): | 93 def shutdown(self): |
94 print "Quitting" | 94 print "Quitting" |
95 if self._sky_server: | 95 if self._sky_server: |
96 self._sky_server.terminate() | 96 self._sky_server.terminate() |
97 | 97 |
98 | 98 |
99 if __name__ == '__main__': | 99 if __name__ == '__main__': |
100 skydb = SkyDebugger() | 100 skydb = SkyDebugger() |
101 try: | 101 try: |
102 skydb.main() | 102 skydb.main() |
103 except (KeyboardInterrupt, SystemExit): | 103 except (KeyboardInterrupt, SystemExit): |
104 pass | 104 pass |
105 finally: | 105 finally: |
106 skydb.shutdown() | 106 skydb.shutdown() |
OLD | NEW |