Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <windows.h> | |
| 6 | |
| 7 #include "chrome/tools/crash_service/caps/process_singleton_win.h" | |
| 8 | |
| 9 namespace caps { | |
| 10 | |
| 11 ProcessSingleton::ProcessSingleton() : mutex_(NULL) { | |
|
scottmg
2015/02/01 19:55:35
NULL -> nullptr
| |
| 12 auto mutex = ::CreateMutexW(nullptr, TRUE, L"CHROME.CAPS.V1"); | |
|
scottmg
2015/02/01 19:55:35
no W (are we not building as _UNICODE properly? if
cpu_(ooo_6.6-7.5)
2015/02/03 02:44:58
afaik we build ok, old habits die hard. changed.
| |
| 13 if (!mutex) | |
| 14 return; | |
| 15 if (::GetLastError() == ERROR_ALREADY_EXISTS) { | |
| 16 ::CloseHandle(mutex); | |
| 17 return; | |
| 18 } | |
| 19 // We are now the single instance. | |
| 20 mutex_ = mutex; | |
| 21 } | |
| 22 | |
| 23 ProcessSingleton::~ProcessSingleton() { | |
| 24 if (mutex_) | |
| 25 ::CloseHandle(mutex_); | |
| 26 } | |
| 27 | |
| 28 } // namespace caps | |
| 29 | |
| OLD | NEW |