Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/common/service_process_util_linux.cc

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/service_process_util.cc ('k') | chrome/common/service_process_util_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/service_process_util_posix.h"
6
7 #include <signal.h> 5 #include <signal.h>
8 #include <unistd.h> 6 #include <unistd.h>
9 7
8 #include <memory>
9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
16 #include "chrome/common/auto_start_linux.h" 16 #include "chrome/common/auto_start_linux.h"
17 #include "chrome/common/multi_process_lock.h" 17 #include "chrome/common/multi_process_lock.h"
18 #include "chrome/common/service_process_util_posix.h"
18 19
19 namespace { 20 namespace {
20 21
21 MultiProcessLock* TakeServiceInitializingLock(bool waiting) { 22 MultiProcessLock* TakeServiceInitializingLock(bool waiting) {
22 std::string lock_name = 23 std::string lock_name =
23 GetServiceProcessScopedName("_service_initializing"); 24 GetServiceProcessScopedName("_service_initializing");
24 return TakeNamedLock(lock_name, waiting); 25 return TakeNamedLock(lock_name, waiting);
25 } 26 }
26 27
27 std::string GetBaseDesktopName() { 28 std::string GetBaseDesktopName() {
(...skipping 26 matching lines...) Expand all
54 base::FilePath temp_dir; 55 base::FilePath temp_dir;
55 PathService::Get(base::DIR_TEMP, &temp_dir); 56 PathService::Get(base::DIR_TEMP, &temp_dir);
56 std::string pipe_name = GetServiceProcessScopedVersionedName("_service_ipc"); 57 std::string pipe_name = GetServiceProcessScopedVersionedName("_service_ipc");
57 std::string pipe_path = temp_dir.Append(pipe_name).value(); 58 std::string pipe_path = temp_dir.Append(pipe_name).value();
58 return pipe_path; 59 return pipe_path;
59 } 60 }
60 61
61 62
62 63
63 bool CheckServiceProcessReady() { 64 bool CheckServiceProcessReady() {
64 scoped_ptr<MultiProcessLock> running_lock(TakeServiceRunningLock(false)); 65 std::unique_ptr<MultiProcessLock> running_lock(TakeServiceRunningLock(false));
65 return running_lock.get() == NULL; 66 return running_lock.get() == NULL;
66 } 67 }
67 68
68 bool ServiceProcessState::TakeSingletonLock() { 69 bool ServiceProcessState::TakeSingletonLock() {
69 state_->initializing_lock.reset(TakeServiceInitializingLock(true)); 70 state_->initializing_lock.reset(TakeServiceInitializingLock(true));
70 return state_->initializing_lock.get(); 71 return state_->initializing_lock.get();
71 } 72 }
72 73
73 bool ServiceProcessState::AddToAutoRun() { 74 bool ServiceProcessState::AddToAutoRun() {
74 DCHECK(autorun_command_line_.get()); 75 DCHECK(autorun_command_line_.get());
75 #if defined(GOOGLE_CHROME_BUILD) 76 #if defined(GOOGLE_CHROME_BUILD)
76 std::string app_name = "Google Chrome Service"; 77 std::string app_name = "Google Chrome Service";
77 #else // CHROMIUM_BUILD 78 #else // CHROMIUM_BUILD
78 std::string app_name = "Chromium Service"; 79 std::string app_name = "Chromium Service";
79 #endif 80 #endif
80 return AutoStart::AddApplication( 81 return AutoStart::AddApplication(
81 GetServiceProcessScopedName(GetBaseDesktopName()), 82 GetServiceProcessScopedName(GetBaseDesktopName()),
82 app_name, 83 app_name,
83 autorun_command_line_->GetCommandLineString(), 84 autorun_command_line_->GetCommandLineString(),
84 false); 85 false);
85 } 86 }
86 87
87 bool ServiceProcessState::RemoveFromAutoRun() { 88 bool ServiceProcessState::RemoveFromAutoRun() {
88 return AutoStart::Remove( 89 return AutoStart::Remove(
89 GetServiceProcessScopedName(GetBaseDesktopName())); 90 GetServiceProcessScopedName(GetBaseDesktopName()));
90 } 91 }
OLDNEW
« no previous file with comments | « chrome/common/service_process_util.cc ('k') | chrome/common/service_process_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698