OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/input_method/input_method_manager.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include <glib.h> | 9 #include <glib.h> |
10 | 10 |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 } | 750 } |
751 | 751 |
752 // Launches an input method procsess specified by the given command | 752 // Launches an input method procsess specified by the given command |
753 // line. On success, returns true and stores the process handle in | 753 // line. On success, returns true and stores the process handle in |
754 // |process_handle|. Otherwise, returns false, and the contents of | 754 // |process_handle|. Otherwise, returns false, and the contents of |
755 // |process_handle| is untouched. OnImeShutdown will be called when the | 755 // |process_handle| is untouched. OnImeShutdown will be called when the |
756 // process terminates. | 756 // process terminates. |
757 bool LaunchInputMethodProcess(const std::string& command_line, | 757 bool LaunchInputMethodProcess(const std::string& command_line, |
758 base::ProcessHandle* process_handle) { | 758 base::ProcessHandle* process_handle) { |
759 std::vector<std::string> argv; | 759 std::vector<std::string> argv; |
760 base::file_handle_mapping_vector fds_to_remap; | 760 base::file_handle_mapping_vector fds_to_remap; |
Yusuke Sato
2011/07/13 01:50:35
nit: I guess you can remove this line.
| |
761 base::ProcessHandle handle = base::kNullProcessHandle; | 761 base::ProcessHandle handle = base::kNullProcessHandle; |
762 | 762 |
763 // TODO(zork): export "LD_PRELOAD=/usr/lib/libcrash.so" | 763 // TODO(zork): export "LD_PRELOAD=/usr/lib/libcrash.so" |
764 base::SplitString(command_line, ' ', &argv); | 764 base::SplitString(command_line, ' ', &argv); |
765 const bool result = base::LaunchApp(argv, | 765 |
766 fds_to_remap, // no remapping | 766 base::LaunchOptions options; |
767 false, // wait | 767 options.process_handle = &handle; |
768 &handle); | 768 if (!base::LaunchProcess(argv, options)) { |
769 if (!result) { | |
770 LOG(ERROR) << "Could not launch: " << command_line; | 769 LOG(ERROR) << "Could not launch: " << command_line; |
771 return false; | 770 return false; |
772 } | 771 } |
773 | 772 |
774 // g_child_watch_add is necessary to prevent the process from becoming a | 773 // g_child_watch_add is necessary to prevent the process from becoming a |
775 // zombie. | 774 // zombie. |
776 // TODO(yusukes): port g_child_watch_add to base/process_utils_posix.cc. | 775 // TODO(yusukes): port g_child_watch_add to base/process_utils_posix.cc. |
777 const base::ProcessId pid = base::GetProcId(handle); | 776 const base::ProcessId pid = base::GetProcId(handle); |
778 g_child_watch_add(pid, | 777 g_child_watch_add(pid, |
779 reinterpret_cast<GChildWatchFunc>(OnImeShutdown), | 778 reinterpret_cast<GChildWatchFunc>(OnImeShutdown), |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
950 return InputMethodManagerImpl::GetInstance(); | 949 return InputMethodManagerImpl::GetInstance(); |
951 } | 950 } |
952 | 951 |
953 } // namespace input_method | 952 } // namespace input_method |
954 } // namespace chromeos | 953 } // namespace chromeos |
955 | 954 |
956 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 955 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
957 // won't be deleted until it's last InvokeLater is run. | 956 // won't be deleted until it's last InvokeLater is run. |
958 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 957 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
959 chromeos::input_method::InputMethodManagerImpl); | 958 chromeos::input_method::InputMethodManagerImpl); |
OLD | NEW |