IDB: Make readonly transactions wait for earlier readwrite transactions
[chromium-blink-merge.git] / remoting / base / scoped_sc_handle_win.h
blob69cd56963f60c9d8fe8f434756624ce76e5a6dfc
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_
6 #define REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_
8 #include <windows.h>
10 #include "base/win/scoped_handle.h"
12 namespace remoting {
14 class ScHandleTraits {
15 public:
16 typedef SC_HANDLE Handle;
18 // Closes the handle.
19 static bool CloseHandle(SC_HANDLE handle) {
20 return ::CloseServiceHandle(handle) != FALSE;
23 // Returns true if the handle value is valid.
24 static bool IsHandleValid(SC_HANDLE handle) {
25 return handle != NULL;
28 // Returns NULL handle value.
29 static SC_HANDLE NullHandle() {
30 return NULL;
33 private:
34 DISALLOW_IMPLICIT_CONSTRUCTORS(ScHandleTraits);
37 typedef base::win::GenericScopedHandle<
38 ScHandleTraits, base::win::DummyVerifierTraits> ScopedScHandle;
40 } // namespace remoting
42 #endif // REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_