Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: base/win/win_util.cc

Issue 2667513003: Remove some LazyInstance use in base/ (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "base/win/win_util.h" 5 #include "base/win/win_util.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <cfgmgr32.h> 8 #include <cfgmgr32.h>
9 #include <powrprof.h> 9 #include <powrprof.h>
10 #include <shobjidl.h> // Must be before propkey. 10 #include <shobjidl.h> // Must be before propkey.
(...skipping 14 matching lines...) Expand all
25 #include <tpcshrd.h> 25 #include <tpcshrd.h>
26 #include <uiviewsettingsinterop.h> 26 #include <uiviewsettingsinterop.h>
27 #include <windows.ui.viewmanagement.h> 27 #include <windows.ui.viewmanagement.h>
28 #include <winstring.h> 28 #include <winstring.h>
29 #include <wrl/wrappers/corewrappers.h> 29 #include <wrl/wrappers/corewrappers.h>
30 30
31 #include <memory> 31 #include <memory>
32 32
33 #include "base/base_switches.h" 33 #include "base/base_switches.h"
34 #include "base/command_line.h" 34 #include "base/command_line.h"
35 #include "base/lazy_instance.h"
36 #include "base/logging.h" 35 #include "base/logging.h"
37 #include "base/macros.h" 36 #include "base/macros.h"
38 #include "base/strings/string_util.h" 37 #include "base/strings/string_util.h"
39 #include "base/strings/stringprintf.h" 38 #include "base/strings/stringprintf.h"
40 #include "base/strings/utf_string_conversions.h" 39 #include "base/strings/utf_string_conversions.h"
41 #include "base/threading/thread_restrictions.h" 40 #include "base/threading/thread_restrictions.h"
42 #include "base/win/registry.h" 41 #include "base/win/registry.h"
43 #include "base/win/scoped_comptr.h" 42 #include "base/win/scoped_comptr.h"
44 #include "base/win/scoped_handle.h" 43 #include "base/win/scoped_handle.h"
45 #include "base/win/scoped_propvariant.h" 44 #include "base/win/scoped_propvariant.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 532 }
534 533
535 return g_domain_state == ENROLLED; 534 return g_domain_state == ENROLLED;
536 } 535 }
537 536
538 void SetDomainStateForTesting(bool state) { 537 void SetDomainStateForTesting(bool state) {
539 g_domain_state = state ? ENROLLED : NOT_ENROLLED; 538 g_domain_state = state ? ENROLLED : NOT_ENROLLED;
540 } 539 }
541 540
542 bool IsUser32AndGdi32Available() { 541 bool IsUser32AndGdi32Available() {
543 static base::LazyInstance<LazyIsUser32AndGdi32Available>::Leaky available = 542 static auto lazy_is_user32_and_gdi32_available =
544 LAZY_INSTANCE_INITIALIZER; 543 new LazyIsUser32AndGdi32Available();
545 return available.Get().value(); 544 return lazy_is_user32_and_gdi32_available->value();
546 } 545 }
547 546
548 bool GetLoadedModulesSnapshot(HANDLE process, std::vector<HMODULE>* snapshot) { 547 bool GetLoadedModulesSnapshot(HANDLE process, std::vector<HMODULE>* snapshot) {
549 DCHECK(snapshot); 548 DCHECK(snapshot);
550 DCHECK_EQ(0u, snapshot->size()); 549 DCHECK_EQ(0u, snapshot->size());
551 snapshot->resize(128); 550 snapshot->resize(128);
552 551
553 // We will retry at least once after first determining |bytes_required|. If 552 // We will retry at least once after first determining |bytes_required|. If
554 // the list of modules changes after we receive |bytes_required| we may retry 553 // the list of modules changes after we receive |bytes_required| we may retry
555 // more than once. 554 // more than once.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 awareness == PROCESS_PER_MONITOR_DPI_AWARE) 617 awareness == PROCESS_PER_MONITOR_DPI_AWARE)
619 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_AWARE; 618 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
620 } 619 }
621 } 620 }
622 } 621 }
623 return per_monitor_dpi_aware == PerMonitorDpiAware::PER_MONITOR_DPI_AWARE; 622 return per_monitor_dpi_aware == PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
624 } 623 }
625 624
626 } // namespace win 625 } // namespace win
627 } // namespace base 626 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698