| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_GPU_GPU_CONTROL_LIST_H_ | 5 #ifndef GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 6 #define CONTENT_BROWSER_GPU_GPU_CONTROL_LIST_H_ | 6 #define GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "content/common/content_export.h" | 19 #include "gpu/gpu_export.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace gpu { |
| 22 struct GPUInfo; | 22 struct GPUInfo; |
| 23 | 23 |
| 24 class CONTENT_EXPORT GpuControlList { | 24 class GPU_EXPORT GpuControlList { |
| 25 public: | 25 public: |
| 26 enum OsType { | 26 enum OsType { |
| 27 kOsLinux, | 27 kOsLinux, |
| 28 kOsMacosx, | 28 kOsMacosx, |
| 29 kOsWin, | 29 kOsWin, |
| 30 kOsChromeOS, | 30 kOsChromeOS, |
| 31 kOsAndroid, | 31 kOsAndroid, |
| 32 kOsAny, | 32 kOsAny, |
| 33 kOsUnknown | 33 kOsUnknown |
| 34 }; | 34 }; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 kBetween, // <= * <= | 114 kBetween, // <= * <= |
| 115 kEQ, // = | 115 kEQ, // = |
| 116 kLT, // < | 116 kLT, // < |
| 117 kLE, // <= | 117 kLE, // <= |
| 118 kGT, // > | 118 kGT, // > |
| 119 kGE, // >= | 119 kGE, // >= |
| 120 kAny, | 120 kAny, |
| 121 kUnknown // Indicates the data is invalid. | 121 kUnknown // Indicates the data is invalid. |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 class CONTENT_EXPORT VersionInfo { | 124 class GPU_EXPORT VersionInfo { |
| 125 public: | 125 public: |
| 126 // If version_style is empty, it defaults to kNumerical. | 126 // If version_style is empty, it defaults to kNumerical. |
| 127 VersionInfo(const std::string& version_op, | 127 VersionInfo(const std::string& version_op, |
| 128 const std::string& version_style, | 128 const std::string& version_style, |
| 129 const std::string& version_string, | 129 const std::string& version_string, |
| 130 const std::string& version_string2); | 130 const std::string& version_string2); |
| 131 ~VersionInfo(); | 131 ~VersionInfo(); |
| 132 | 132 |
| 133 // Determines if a given version is included in the VersionInfo range. | 133 // Determines if a given version is included in the VersionInfo range. |
| 134 // "splitter" divides version string into segments. | 134 // "splitter" divides version string into segments. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 164 static int Compare(const std::vector<std::string>& version, | 164 static int Compare(const std::vector<std::string>& version, |
| 165 const std::vector<std::string>& version_ref, | 165 const std::vector<std::string>& version_ref, |
| 166 VersionStyle version_style); | 166 VersionStyle version_style); |
| 167 | 167 |
| 168 NumericOp op_; | 168 NumericOp op_; |
| 169 VersionStyle version_style_; | 169 VersionStyle version_style_; |
| 170 std::vector<std::string> version_; | 170 std::vector<std::string> version_; |
| 171 std::vector<std::string> version2_; | 171 std::vector<std::string> version2_; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 class CONTENT_EXPORT OsInfo { | 174 class GPU_EXPORT OsInfo { |
| 175 public: | 175 public: |
| 176 OsInfo(const std::string& os, | 176 OsInfo(const std::string& os, |
| 177 const std::string& version_op, | 177 const std::string& version_op, |
| 178 const std::string& version_string, | 178 const std::string& version_string, |
| 179 const std::string& version_string2); | 179 const std::string& version_string2); |
| 180 ~OsInfo(); | 180 ~OsInfo(); |
| 181 | 181 |
| 182 // Determines if a given os/version is included in the OsInfo set. | 182 // Determines if a given os/version is included in the OsInfo set. |
| 183 bool Contains(OsType type, const std::string& version) const; | 183 bool Contains(OsType type, const std::string& version) const; |
| 184 | 184 |
| 185 // Determines if the VersionInfo contains valid information. | 185 // Determines if the VersionInfo contains valid information. |
| 186 bool IsValid() const; | 186 bool IsValid() const; |
| 187 | 187 |
| 188 OsType type() const; | 188 OsType type() const; |
| 189 | 189 |
| 190 // Maps string to OsType; returns kOsUnknown if it's not a valid os. | 190 // Maps string to OsType; returns kOsUnknown if it's not a valid os. |
| 191 static OsType StringToOsType(const std::string& os); | 191 static OsType StringToOsType(const std::string& os); |
| 192 | 192 |
| 193 private: | 193 private: |
| 194 OsType type_; | 194 OsType type_; |
| 195 scoped_ptr<VersionInfo> version_info_; | 195 scoped_ptr<VersionInfo> version_info_; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 class CONTENT_EXPORT StringInfo { | 198 class GPU_EXPORT StringInfo { |
| 199 public: | 199 public: |
| 200 StringInfo(const std::string& string_op, const std::string& string_value); | 200 StringInfo(const std::string& string_op, const std::string& string_value); |
| 201 | 201 |
| 202 // Determines if a given string is included in the StringInfo. | 202 // Determines if a given string is included in the StringInfo. |
| 203 bool Contains(const std::string& value) const; | 203 bool Contains(const std::string& value) const; |
| 204 | 204 |
| 205 // Determines if the StringInfo contains valid information. | 205 // Determines if the StringInfo contains valid information. |
| 206 bool IsValid() const; | 206 bool IsValid() const; |
| 207 | 207 |
| 208 private: | 208 private: |
| 209 enum Op { | 209 enum Op { |
| 210 kContains, | 210 kContains, |
| 211 kBeginWith, | 211 kBeginWith, |
| 212 kEndWith, | 212 kEndWith, |
| 213 kEQ, // = | 213 kEQ, // = |
| 214 kUnknown // Indicates StringInfo data is invalid. | 214 kUnknown // Indicates StringInfo data is invalid. |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 // Maps string to Op; returns kUnknown if it's not a valid Op. | 217 // Maps string to Op; returns kUnknown if it's not a valid Op. |
| 218 static Op StringToOp(const std::string& string_op); | 218 static Op StringToOp(const std::string& string_op); |
| 219 | 219 |
| 220 Op op_; | 220 Op op_; |
| 221 std::string value_; | 221 std::string value_; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 class CONTENT_EXPORT FloatInfo { | 224 class GPU_EXPORT FloatInfo { |
| 225 public: | 225 public: |
| 226 FloatInfo(const std::string& float_op, | 226 FloatInfo(const std::string& float_op, |
| 227 const std::string& float_value, | 227 const std::string& float_value, |
| 228 const std::string& float_value2); | 228 const std::string& float_value2); |
| 229 | 229 |
| 230 // Determines if a given float is included in the FloatInfo. | 230 // Determines if a given float is included in the FloatInfo. |
| 231 bool Contains(float value) const; | 231 bool Contains(float value) const; |
| 232 | 232 |
| 233 // Determines if the FloatInfo contains valid information. | 233 // Determines if the FloatInfo contains valid information. |
| 234 bool IsValid() const; | 234 bool IsValid() const; |
| 235 | 235 |
| 236 private: | 236 private: |
| 237 NumericOp op_; | 237 NumericOp op_; |
| 238 float value_; | 238 float value_; |
| 239 float value2_; | 239 float value2_; |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 class CONTENT_EXPORT IntInfo { | 242 class GPU_EXPORT IntInfo { |
| 243 public: | 243 public: |
| 244 IntInfo(const std::string& int_op, | 244 IntInfo(const std::string& int_op, |
| 245 const std::string& int_value, | 245 const std::string& int_value, |
| 246 const std::string& int_value2); | 246 const std::string& int_value2); |
| 247 | 247 |
| 248 // Determines if a given int is included in the IntInfo. | 248 // Determines if a given int is included in the IntInfo. |
| 249 bool Contains(int value) const; | 249 bool Contains(int value) const; |
| 250 | 250 |
| 251 // Determines if the IntInfo contains valid information. | 251 // Determines if the IntInfo contains valid information. |
| 252 bool IsValid() const; | 252 bool IsValid() const; |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 NumericOp op_; | 255 NumericOp op_; |
| 256 int value_; | 256 int value_; |
| 257 int value2_; | 257 int value2_; |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 class CONTENT_EXPORT MachineModelInfo { | 260 class GPU_EXPORT MachineModelInfo { |
| 261 public: | 261 public: |
| 262 MachineModelInfo(const std::string& name_op, | 262 MachineModelInfo(const std::string& name_op, |
| 263 const std::string& name_value, | 263 const std::string& name_value, |
| 264 const std::string& version_op, | 264 const std::string& version_op, |
| 265 const std::string& version_string, | 265 const std::string& version_string, |
| 266 const std::string& version_string2); | 266 const std::string& version_string2); |
| 267 ~MachineModelInfo(); | 267 ~MachineModelInfo(); |
| 268 | 268 |
| 269 // Determines if a given name/version is included in the MachineModelInfo. | 269 // Determines if a given name/version is included in the MachineModelInfo. |
| 270 bool Contains(const std::string& name, const std::string& version) const; | 270 bool Contains(const std::string& name, const std::string& version) const; |
| 271 | 271 |
| 272 // Determines if the MachineModelInfo contains valid information. | 272 // Determines if the MachineModelInfo contains valid information. |
| 273 bool IsValid() const; | 273 bool IsValid() const; |
| 274 | 274 |
| 275 private: | 275 private: |
| 276 scoped_ptr<StringInfo> name_info_; | 276 scoped_ptr<StringInfo> name_info_; |
| 277 scoped_ptr<VersionInfo> version_info_; | 277 scoped_ptr<VersionInfo> version_info_; |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 class GpuControlListEntry; | 280 class GpuControlListEntry; |
| 281 typedef scoped_refptr<GpuControlListEntry> ScopedGpuControlListEntry; | 281 typedef scoped_refptr<GpuControlListEntry> ScopedGpuControlListEntry; |
| 282 | 282 |
| 283 typedef base::hash_map<std::string, int> FeatureMap; | 283 typedef base::hash_map<std::string, int> FeatureMap; |
| 284 | 284 |
| 285 class CONTENT_EXPORT GpuControlListEntry | 285 class GPU_EXPORT GpuControlListEntry |
| 286 : public base::RefCounted<GpuControlListEntry> { | 286 : public base::RefCounted<GpuControlListEntry> { |
| 287 public: | 287 public: |
| 288 // Constructs GpuControlListEntry from DictionaryValue loaded from json. | 288 // Constructs GpuControlListEntry from DictionaryValue loaded from json. |
| 289 // Top-level entry must have an id number. Others are exceptions. | 289 // Top-level entry must have an id number. Others are exceptions. |
| 290 static ScopedGpuControlListEntry GetEntryFromValue( | 290 static ScopedGpuControlListEntry GetEntryFromValue( |
| 291 const base::DictionaryValue* value, bool top_level, | 291 const base::DictionaryValue* value, bool top_level, |
| 292 const FeatureMap& feature_map, | 292 const FeatureMap& feature_map, |
| 293 bool supports_feature_type_all); | 293 bool supports_feature_type_all); |
| 294 | 294 |
| 295 // Determines if a given os/gc/machine_model/driver is included in the | 295 // Determines if a given os/gc/machine_model/driver is included in the |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 bool contains_unknown_fields_; | 486 bool contains_unknown_fields_; |
| 487 | 487 |
| 488 bool needs_more_info_; | 488 bool needs_more_info_; |
| 489 | 489 |
| 490 // The features a GpuControlList recognizes and handles. | 490 // The features a GpuControlList recognizes and handles. |
| 491 FeatureMap feature_map_; | 491 FeatureMap feature_map_; |
| 492 bool supports_feature_type_all_; | 492 bool supports_feature_type_all_; |
| 493 }; | 493 }; |
| 494 | 494 |
| 495 } // namespace content | 495 } // namespace gpu |
| 496 | 496 |
| 497 #endif // CONTENT_BROWSER_GPU_GPU_CONTROL_LIST_H_ | 497 #endif // GPU_CONFIG_GPU_CONTROL_LIST_H_ |
| 498 | 498 |
| OLD | NEW |