summaryrefslogtreecommitdiffstats
path: root/gpu/config/gpu_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/config/gpu_util.cc')
-rw-r--r--gpu/config/gpu_util.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc
new file mode 100644
index 0000000..bed1f0c
--- /dev/null
+++ b/gpu/config/gpu_util.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/config/gpu_util.h"
+
+#include <vector>
+
+#include "base/logging.h"
+#include "ui/gl/gl_switches.h"
+
+namespace gpu {
+
+GpuSwitchingOption StringToGpuSwitchingOption(
+ const std::string& switching_string) {
+ if (switching_string == switches::kGpuSwitchingOptionNameAutomatic)
+ return GPU_SWITCHING_OPTION_AUTOMATIC;
+ if (switching_string == switches::kGpuSwitchingOptionNameForceIntegrated)
+ return GPU_SWITCHING_OPTION_FORCE_INTEGRATED;
+ if (switching_string == switches::kGpuSwitchingOptionNameForceDiscrete)
+ return GPU_SWITCHING_OPTION_FORCE_DISCRETE;
+ return GPU_SWITCHING_OPTION_UNKNOWN;
+}
+
+std::string GpuSwitchingOptionToString(GpuSwitchingOption option) {
+ switch (option) {
+ case GPU_SWITCHING_OPTION_AUTOMATIC:
+ return switches::kGpuSwitchingOptionNameAutomatic;
+ case GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
+ return switches::kGpuSwitchingOptionNameForceIntegrated;
+ case GPU_SWITCHING_OPTION_FORCE_DISCRETE:
+ return switches::kGpuSwitchingOptionNameForceDiscrete;
+ default:
+ return "unknown";
+ }
+}
+
+void MergeFeatureSets(std::set<int>* dst, const std::set<int>& src) {
+ DCHECK(dst);
+ if (src.empty())
+ return;
+ dst->insert(src.begin(), src.end());
+}
+
+} // namespace gpu