OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
11 #include "chrome/common/service_process_util.h" | 11 #include "chrome/common/service_process_util.h" |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include "base/scoped_handle_win.h" | 14 #include "base/scoped_handle_win.h" |
15 #endif | 15 #endif |
16 | 16 |
17 // TODO(hclam): Split this file for different platforms. | 17 // TODO(hclam): Split this file for different platforms. |
18 // TODO(hclam): |type| is not used at all. Different types of service process | 18 std::string GetServiceProcessChannelName() { |
19 // should have a different instance of process and channel. | |
20 std::string GetServiceProcessChannelName(ServiceProcessType type) { | |
21 FilePath user_data_dir; | 19 FilePath user_data_dir; |
22 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 20 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
23 | 21 |
24 // TODO(sanjeevr): We need to actually figure out the right way to determine | 22 // TODO(sanjeevr): We need to actually figure out the right way to determine |
25 // a channel name. The below is to facilitate testing only. | 23 // a channel name. The below is to facilitate testing only. |
26 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
27 std::string channel_name = WideToUTF8(user_data_dir.value()); | 25 std::string channel_name = WideToUTF8(user_data_dir.value()); |
28 #elif defined(OS_POSIX) | 26 #elif defined(OS_POSIX) |
29 std::string channel_name = user_data_dir.value(); | 27 std::string channel_name = user_data_dir.value(); |
30 #endif // defined(OS_WIN) | 28 #endif // defined(OS_WIN) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (!event.IsValid()) | 88 if (!event.IsValid()) |
91 return false; | 89 return false; |
92 // Check if the event is signaled. | 90 // Check if the event is signaled. |
93 return WaitForSingleObject(event, 0) == WAIT_OBJECT_0; | 91 return WaitForSingleObject(event, 0) == WAIT_OBJECT_0; |
94 #else | 92 #else |
95 // TODO(hclam): Implement better mechanism for these platform. | 93 // TODO(hclam): Implement better mechanism for these platform. |
96 const FilePath path = GetServiceProcessLockFilePath(type); | 94 const FilePath path = GetServiceProcessLockFilePath(type); |
97 return file_util::PathExists(path); | 95 return file_util::PathExists(path); |
98 #endif | 96 #endif |
99 } | 97 } |
OLD | NEW |