xref: /aosp_15_r20/external/cronet/base/win/scoped_pdh_query.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 The Chromium Authors
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 "base/win/scoped_pdh_query.h"
6 
7 namespace base::win {
8 
9 // static
Create()10 ScopedPdhQuery ScopedPdhQuery::Create() {
11   PDH_HQUERY pdh_query;
12   PDH_STATUS pdh_status = ::PdhOpenQuery(NULL, NULL, &pdh_query);
13   if (pdh_status == ERROR_SUCCESS) {
14     return ScopedPdhQuery(pdh_query);
15   }
16   return ScopedPdhQuery();
17 }
18 
19 }  // namespace base::win
20