| 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/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/profiler/scoped_profile.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/win/object_watcher.h" | 16 #include "base/win/object_watcher.h" |
| 17 #include "base/win/scoped_handle.h" | 17 #include "base/win/scoped_handle.h" |
| 18 #include "base/win/win_util.h" | 18 #include "base/win/win_util.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 void Start() { | 58 void Start() { |
| 59 base::string16 event_name = GetServiceProcessTerminateEventName(); | 59 base::string16 event_name = GetServiceProcessTerminateEventName(); |
| 60 DCHECK(event_name.length() <= MAX_PATH); | 60 DCHECK(event_name.length() <= MAX_PATH); |
| 61 terminate_event_.Set(CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); | 61 terminate_event_.Set(CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); |
| 62 watcher_.StartWatching(terminate_event_.Get(), this); | 62 watcher_.StartWatching(terminate_event_.Get(), this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // base::ObjectWatcher::Delegate implementation. | 65 // base::ObjectWatcher::Delegate implementation. |
| 66 virtual void OnObjectSignaled(HANDLE object) { | 66 virtual void OnObjectSignaled(HANDLE object) { |
| 67 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. | 67 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed. |
| 68 tracked_objects::ScopedProfile tracking_profile( | 68 tracked_objects::ScopedTracker tracking_profile( |
| 69 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 69 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 70 "ServiceProcessTerminateMonitor_OnObjectSignaled")); | 70 "ServiceProcessTerminateMonitor_OnObjectSignaled")); |
| 71 | 71 |
| 72 if (!terminate_task_.is_null()) { | 72 if (!terminate_task_.is_null()) { |
| 73 terminate_task_.Run(); | 73 terminate_task_.Run(); |
| 74 terminate_task_.Reset(); | 74 terminate_task_.Reset(); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 HKEY_CURRENT_USER, | 174 HKEY_CURRENT_USER, |
| 175 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); | 175 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); |
| 176 return base::win::RemoveCommandFromAutoRun( | 176 return base::win::RemoveCommandFromAutoRun( |
| 177 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); | 177 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ServiceProcessState::TearDownState() { | 180 void ServiceProcessState::TearDownState() { |
| 181 delete state_; | 181 delete state_; |
| 182 state_ = NULL; | 182 state_ = NULL; |
| 183 } | 183 } |
| OLD | NEW |