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

Side by Side Diff: chromeos/system/devicemode.cc

Issue 2585633004: ozone: Allow ozone evdev/kvm features to be enabled without running on ChromeOS. (Closed)
Patch Set: only add //chromeos to deps if is_chromeos Created 3 years, 11 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
(Empty)
1 // Copyright 2017 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 "chromeos/system/devicemode.h"
6
7 #include "base/command_line.h"
8 #include "base/lazy_instance.h"
9 #include "base/sys_info.h"
10 #include "chromeos/chromeos_switches.h"
11
12 namespace chromeos {
13 namespace {
14
15 class ChromeOSDeviceMode {
16 public:
17 ChromeOSDeviceMode() {
18 // Running as system compositor by default when running on ChromeOS.
19 is_running_as_system_compositor_ = base::SysInfo::IsRunningOnChromeOS();
20
21 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
22 if (command_line->HasSwitch(switches::kEnableSystemCompositorMode))
23 is_running_as_system_compositor_ = true;
24 if (command_line->HasSwitch(switches::kDisableSystemCompositorMode))
25 is_running_as_system_compositor_ = false;
26 }
27
28 bool is_running_as_system_compositor() const {
29 return is_running_as_system_compositor_;
30 }
31
32 private:
33 bool is_running_as_system_compositor_;
34 };
35
36 base::LazyInstance<ChromeOSDeviceMode>::Leaky g_chrome_os_device_mode =
37 LAZY_INSTANCE_INITIALIZER;
oshima 2017/01/05 22:43:57 Do you need lazy instance? Since this never chang
reveman 2017/01/06 08:15:14 Done. I assume it's OK to rely on the compiler's t
oshima 2017/01/09 19:09:12 CommandLine isn't thread safe, so the original cod
reveman 2017/01/09 22:51:50 CommandLine::HasSwitch is const so should be threa
38
39 } // namespace
40
41 bool IsRunningAsSystemCompositor() {
42 return g_chrome_os_device_mode.Get().is_running_as_system_compositor();
43 }
44
45 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698