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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::ProcessHandle handle = base::kNullProcessHandle; | 760 base::ProcessHandle handle = base::kNullProcessHandle; |
761 | 761 |
762 // TODO(zork): export "LD_PRELOAD=/usr/lib/libcrash.so" | 762 // TODO(zork): export "LD_PRELOAD=/usr/lib/libcrash.so" |
763 base::SplitString(command_line, ' ', &argv); | 763 base::SplitString(command_line, ' ', &argv); |
764 | 764 |
765 base::LaunchOptions options; | 765 if (!base::LaunchProcess(argv, base::LaunchOptions(), &handle)) { |
766 options.process_handle = &handle; | |
767 if (!base::LaunchProcess(argv, options)) { | |
768 LOG(ERROR) << "Could not launch: " << command_line; | 766 LOG(ERROR) << "Could not launch: " << command_line; |
769 return false; | 767 return false; |
770 } | 768 } |
771 | 769 |
772 // g_child_watch_add is necessary to prevent the process from becoming a | 770 // g_child_watch_add is necessary to prevent the process from becoming a |
773 // zombie. | 771 // zombie. |
774 // TODO(yusukes): port g_child_watch_add to base/process_utils_posix.cc. | 772 // TODO(yusukes): port g_child_watch_add to base/process_utils_posix.cc. |
775 const base::ProcessId pid = base::GetProcId(handle); | 773 const base::ProcessId pid = base::GetProcId(handle); |
776 g_child_watch_add(pid, | 774 g_child_watch_add(pid, |
777 reinterpret_cast<GChildWatchFunc>(OnImeShutdown), | 775 reinterpret_cast<GChildWatchFunc>(OnImeShutdown), |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 return InputMethodManagerImpl::GetInstance(); | 946 return InputMethodManagerImpl::GetInstance(); |
949 } | 947 } |
950 | 948 |
951 } // namespace input_method | 949 } // namespace input_method |
952 } // namespace chromeos | 950 } // namespace chromeos |
953 | 951 |
954 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 952 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
955 // won't be deleted until it's last InvokeLater is run. | 953 // won't be deleted until it's last InvokeLater is run. |
956 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 954 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
957 chromeos::input_method::InputMethodManagerImpl); | 955 chromeos::input_method::InputMethodManagerImpl); |
OLD | NEW |