| 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 "chrome/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 void ServiceProcessState::SignalReady(Task* shutdown_task) { | 46 void ServiceProcessState::SignalReady(Task* shutdown_task) { |
| 47 // TODO(hclam): Implement better mechanism for these platform. | 47 // TODO(hclam): Implement better mechanism for these platform. |
| 48 // Also we need to save shutdown task. For now we just delete the shutdown | 48 // Also we need to save shutdown task. For now we just delete the shutdown |
| 49 // task because we have not way to listen for shutdown requests. | 49 // task because we have not way to listen for shutdown requests. |
| 50 delete shutdown_task; | 50 delete shutdown_task; |
| 51 const FilePath path = GetServiceProcessLockFilePath(); | 51 const FilePath path = GetServiceProcessLockFilePath(); |
| 52 FILE* file = file_util::OpenFile(path, "wb+"); | 52 FILE* file = file_util::OpenFile(path, "wb+"); |
| 53 if (!file) | 53 if (!file) |
| 54 return; | 54 return; |
| 55 LOG(INFO) << "Created Service Process lock file: " << path.value(); | 55 VLOG(1) << "Created Service Process lock file: " << path.value(); |
| 56 file_util::TruncateFile(file) && file_util::CloseFile(file); | 56 file_util::TruncateFile(file) && file_util::CloseFile(file); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ServiceProcessState::SignalStopped() { | 59 void ServiceProcessState::SignalStopped() { |
| 60 const FilePath path = GetServiceProcessLockFilePath(); | 60 const FilePath path = GetServiceProcessLockFilePath(); |
| 61 file_util::Delete(path, false); | 61 file_util::Delete(path, false); |
| 62 shared_mem_service_data_.reset(); | 62 shared_mem_service_data_.reset(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool ServiceProcessState::AddToAutoRun() { | 65 bool ServiceProcessState::AddToAutoRun() { |
| 66 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool ServiceProcessState::RemoveFromAutoRun() { | 70 bool ServiceProcessState::RemoveFromAutoRun() { |
| 71 NOTIMPLEMENTED(); | 71 NOTIMPLEMENTED(); |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ServiceProcessState::TearDownState() { | 75 void ServiceProcessState::TearDownState() { |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool ServiceProcessState::ShouldHandleOtherVersion() { | 78 bool ServiceProcessState::ShouldHandleOtherVersion() { |
| 79 // On POSIX, the shared memory is a file in disk. We may have a stale file | 79 // On POSIX, the shared memory is a file in disk. We may have a stale file |
| 80 // lying around from a previous run. So the check is not reliable. | 80 // lying around from a previous run. So the check is not reliable. |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| OLD | NEW |