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

Side by Side Diff: chrome/browser/gpu_blacklist.cc

Issue 6352011: Improve blacklist logic: use more fields (driver_vendor, gl_renderer, ect) fo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: This should turn linux trybot green Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/gpu_blacklist.h" 5 #include "chrome/browser/gpu_blacklist.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return kOsWin; 128 return kOsWin;
129 else if (os == "macosx") 129 else if (os == "macosx")
130 return kOsMacosx; 130 return kOsMacosx;
131 else if (os == "linux") 131 else if (os == "linux")
132 return kOsLinux; 132 return kOsLinux;
133 else if (os == "any") 133 else if (os == "any")
134 return kOsAny; 134 return kOsAny;
135 return kOsUnknown; 135 return kOsUnknown;
136 } 136 }
137 137
138 GpuBlacklist::StringInfo::StringInfo(const std::string& string_op,
139 const std::string& string_value) {
140 op_ = StringToOp(string_op);
141 value_ = StringToLowerASCII(string_value);
142 }
143
144 GpuBlacklist::StringInfo::~StringInfo() {
Vangelis Kokkevis 2011/01/24 20:55:21 No point in defining a destructor if you're not do
Zhenyao Mo 2011/01/24 22:38:22 Removed. On 2011/01/24 20:55:21, Vangelis Kokkevi
145 }
146
147 bool GpuBlacklist::StringInfo::Contains(const std::string& value) const {
148 std::string my_value = StringToLowerASCII(value);
149 switch (op_) {
150 case kContains:
151 return strstr(my_value.c_str(), value_.c_str()) != NULL;
152 case kBeginWith:
153 return StartsWithASCII(my_value, value_, false);
154 case kEndWith:
155 return EndsWith(my_value, value_, false);
156 case kEQ:
157 return value_ == my_value;
158 default:
159 return false;
160 }
161 }
162
163 bool GpuBlacklist::StringInfo::IsValid() const {
164 return op_ != kUnknown;
165 }
166
167 GpuBlacklist::StringInfo::Op GpuBlacklist::StringInfo::StringToOp(
168 const std::string& string_op) {
169 if (string_op == "=")
170 return kEQ;
171 else if (string_op == "contains")
172 return kContains;
173 else if (string_op == "beginwith")
174 return kBeginWith;
175 else if (string_op == "endwith")
176 return kEndWith;
177 return kUnknown;
178 }
179
138 GpuBlacklist::GpuBlacklistEntry* 180 GpuBlacklist::GpuBlacklistEntry*
139 GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( 181 GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
140 DictionaryValue* value) { 182 DictionaryValue* value) {
141 if (value == NULL) 183 if (value == NULL)
142 return NULL; 184 return NULL;
143 185
144 GpuBlacklistEntry* entry = new GpuBlacklistEntry(); 186 GpuBlacklistEntry* entry = new GpuBlacklistEntry();
145 187
188 std::string id;
189 if (!value->GetString("id", &id) || !entry->SetId(id)) {
190 delete entry;
191 return NULL;
192 }
193
146 DictionaryValue* os_value = NULL; 194 DictionaryValue* os_value = NULL;
147 if (value->GetDictionary("os", &os_value)) { 195 if (value->GetDictionary("os", &os_value)) {
148 std::string os_type; 196 std::string os_type;
149 std::string os_version_op = "any"; 197 std::string os_version_op = "any";
150 std::string os_version_string; 198 std::string os_version_string;
151 std::string os_version_string2; 199 std::string os_version_string2;
152 os_value->GetString("type", &os_type); 200 os_value->GetString("type", &os_type);
153 DictionaryValue* os_version_value = NULL; 201 DictionaryValue* os_version_value = NULL;
154 if (os_value->GetDictionary("version", &os_version_value)) { 202 if (os_value->GetDictionary("version", &os_version_value)) {
155 os_version_value->GetString("op", &os_version_op); 203 os_version_value->GetString("op", &os_version_op);
(...skipping 16 matching lines...) Expand all
172 } 220 }
173 221
174 std::string device_id; 222 std::string device_id;
175 if (value->GetString("device_id", &device_id)) { 223 if (value->GetString("device_id", &device_id)) {
176 if (!entry->SetDeviceId(device_id)) { 224 if (!entry->SetDeviceId(device_id)) {
177 delete entry; 225 delete entry;
178 return NULL; 226 return NULL;
179 } 227 }
180 } 228 }
181 229
230 DictionaryValue* driver_vendor_value = NULL;
231 if (value->GetDictionary("driver_vendor", &driver_vendor_value)) {
232 std::string vendor_op;
233 std::string vendor_value;
234 driver_vendor_value->GetString("op", &vendor_op);
235 driver_vendor_value->GetString("value", &vendor_value);
236 if (!entry->SetDriverVendorInfo(vendor_op, vendor_value)) {
237 delete entry;
238 return NULL;
239 }
240 }
241
182 DictionaryValue* driver_version_value = NULL; 242 DictionaryValue* driver_version_value = NULL;
183 if (value->GetDictionary("driver_version", &driver_version_value)) { 243 if (value->GetDictionary("driver_version", &driver_version_value)) {
184 std::string driver_version_op = "any"; 244 std::string driver_version_op = "any";
185 std::string driver_version_string; 245 std::string driver_version_string;
186 std::string driver_version_string2; 246 std::string driver_version_string2;
187 driver_version_value->GetString("op", &driver_version_op); 247 driver_version_value->GetString("op", &driver_version_op);
188 driver_version_value->GetString("number", &driver_version_string); 248 driver_version_value->GetString("number", &driver_version_string);
189 driver_version_value->GetString("number2", &driver_version_string2); 249 driver_version_value->GetString("number2", &driver_version_string2);
190 if (!entry->SetDriverVersionInfo(driver_version_op, driver_version_string, 250 if (!entry->SetDriverVersionInfo(driver_version_op, driver_version_string,
191 driver_version_string2)) { 251 driver_version_string2)) {
192 delete entry; 252 delete entry;
193 return NULL; 253 return NULL;
194 } 254 }
195 } 255 }
196 256
257 DictionaryValue* gl_renderer_value = NULL;
258 if (value->GetDictionary("gl_renderer", &gl_renderer_value)) {
259 std::string renderer_op;
260 std::string renderer_value;
261 gl_renderer_value->GetString("op", &renderer_op);
262 gl_renderer_value->GetString("value", &renderer_value);
263 if (!entry->SetGLRendererInfo(renderer_op, renderer_value)) {
264 delete entry;
265 return NULL;
266 }
267 }
268
197 ListValue* blacklist_value = NULL; 269 ListValue* blacklist_value = NULL;
198 if (!value->GetList("blacklist", &blacklist_value)) { 270 if (!value->GetList("blacklist", &blacklist_value)) {
199 delete entry; 271 delete entry;
200 return NULL; 272 return NULL;
201 } 273 }
202 std::vector<std::string> blacklist; 274 std::vector<std::string> blacklist;
203 for (size_t i = 0; i < blacklist_value->GetSize(); ++i) { 275 for (size_t i = 0; i < blacklist_value->GetSize(); ++i) {
204 std::string feature; 276 std::string feature;
205 if (blacklist_value->GetString(i, &feature)) { 277 if (blacklist_value->GetString(i, &feature)) {
206 blacklist.push_back(feature); 278 blacklist.push_back(feature);
(...skipping 10 matching lines...) Expand all
217 return entry; 289 return entry;
218 } 290 }
219 291
220 GpuBlacklist::GpuBlacklistEntry::~GpuBlacklistEntry() {} 292 GpuBlacklist::GpuBlacklistEntry::~GpuBlacklistEntry() {}
221 293
222 GpuBlacklist::GpuBlacklistEntry::GpuBlacklistEntry() 294 GpuBlacklist::GpuBlacklistEntry::GpuBlacklistEntry()
223 : vendor_id_(0), 295 : vendor_id_(0),
224 device_id_(0) { 296 device_id_(0) {
225 } 297 }
226 298
299 bool GpuBlacklist::GpuBlacklistEntry::SetId(
300 const std::string& id_string) {
301 id_ = 0;
302 return (base::HexStringToInt(id_string,
303 reinterpret_cast<int*>(&id_)) &&
Vangelis Kokkevis 2011/01/24 20:55:21 reinterpret_cast 's are kind of scary and potentia
Zhenyao Mo 2011/01/24 22:38:22 Done.
304 id_ != 0);
305 }
306
227 bool GpuBlacklist::GpuBlacklistEntry::SetOsInfo( 307 bool GpuBlacklist::GpuBlacklistEntry::SetOsInfo(
228 const std::string& os, 308 const std::string& os,
229 const std::string& version_op, 309 const std::string& version_op,
230 const std::string& version_string, 310 const std::string& version_string,
231 const std::string& version_string2) { 311 const std::string& version_string2) {
232 os_info_.reset(new OsInfo(os, version_op, version_string, version_string2)); 312 os_info_.reset(new OsInfo(os, version_op, version_string, version_string2));
233 return os_info_->IsValid(); 313 return os_info_->IsValid();
234 } 314 }
235 315
236 bool GpuBlacklist::GpuBlacklistEntry::SetVendorId( 316 bool GpuBlacklist::GpuBlacklistEntry::SetVendorId(
237 const std::string& vendor_id_string) { 317 const std::string& vendor_id_string) {
238 vendor_id_ = 0; 318 vendor_id_ = 0;
239 return base::HexStringToInt(vendor_id_string, 319 return base::HexStringToInt(vendor_id_string,
240 reinterpret_cast<int*>(&vendor_id_)); 320 reinterpret_cast<int*>(&vendor_id_));
241 } 321 }
242 322
243 bool GpuBlacklist::GpuBlacklistEntry::SetDeviceId( 323 bool GpuBlacklist::GpuBlacklistEntry::SetDeviceId(
244 const std::string& device_id_string) { 324 const std::string& device_id_string) {
245 device_id_ = 0; 325 device_id_ = 0;
246 return base::HexStringToInt(device_id_string, 326 return base::HexStringToInt(device_id_string,
247 reinterpret_cast<int*>(&device_id_)); 327 reinterpret_cast<int*>(&device_id_));
248 } 328 }
249 329
330 bool GpuBlacklist::GpuBlacklistEntry::SetDriverVendorInfo(
331 const std::string& vendor_op,
332 const std::string& vendor_value) {
333 driver_vendor_info_.reset(
334 new StringInfo(vendor_op, vendor_value));
335 return driver_vendor_info_->IsValid();
336 }
337
250 bool GpuBlacklist::GpuBlacklistEntry::SetDriverVersionInfo( 338 bool GpuBlacklist::GpuBlacklistEntry::SetDriverVersionInfo(
251 const std::string& version_op, 339 const std::string& version_op,
252 const std::string& version_string, 340 const std::string& version_string,
253 const std::string& version_string2) { 341 const std::string& version_string2) {
254 driver_version_info_.reset( 342 driver_version_info_.reset(
255 new VersionInfo(version_op, version_string, version_string2)); 343 new VersionInfo(version_op, version_string, version_string2));
256 return driver_version_info_->IsValid(); 344 return driver_version_info_->IsValid();
257 } 345 }
258 346
347 bool GpuBlacklist::GpuBlacklistEntry::SetGLRendererInfo(
348 const std::string& renderer_op,
349 const std::string& renderer_value) {
350 gl_renderer_info_.reset(
351 new StringInfo(renderer_op, renderer_value));
352 return gl_renderer_info_->IsValid();
353 }
354
259 bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures( 355 bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures(
260 const std::vector<std::string>& blacklisted_features) { 356 const std::vector<std::string>& blacklisted_features) {
261 size_t size = blacklisted_features.size(); 357 size_t size = blacklisted_features.size();
262 if (size == 0) 358 if (size == 0)
263 return false; 359 return false;
264 uint32 flags = 0; 360 uint32 flags = 0;
265 for (size_t i = 0; i < size; ++i) { 361 for (size_t i = 0; i < size; ++i) {
266 GpuFeatureFlags::GpuFeatureType type = 362 GpuFeatureFlags::GpuFeatureType type =
267 GpuFeatureFlags::StringToGpuFeatureType(blacklisted_features[i]); 363 GpuFeatureFlags::StringToGpuFeatureType(blacklisted_features[i]);
268 switch (type) { 364 switch (type) {
269 case GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas: 365 case GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas:
270 case GpuFeatureFlags::kGpuFeatureAcceleratedCompositing: 366 case GpuFeatureFlags::kGpuFeatureAcceleratedCompositing:
271 case GpuFeatureFlags::kGpuFeatureWebgl: 367 case GpuFeatureFlags::kGpuFeatureWebgl:
272 case GpuFeatureFlags::kGpuFeatureAll: 368 case GpuFeatureFlags::kGpuFeatureAll:
273 flags |= type; 369 flags |= type;
274 break; 370 break;
275 case GpuFeatureFlags::kGpuFeatureUnknown: 371 case GpuFeatureFlags::kGpuFeatureUnknown:
276 return false; 372 return false;
277 } 373 }
278 } 374 }
279 feature_flags_.reset(new GpuFeatureFlags()); 375 feature_flags_.reset(new GpuFeatureFlags());
280 feature_flags_->set_flags(flags); 376 feature_flags_->set_flags(flags);
281 return true; 377 return true;
282 } 378 }
283 379
284 bool GpuBlacklist::GpuBlacklistEntry::Contains( 380 bool GpuBlacklist::GpuBlacklistEntry::Contains(
285 OsType os_type, const Version& os_version, 381 OsType os_type, const Version& os_version,
286 uint32 vendor_id, uint32 device_id, 382 uint32 vendor_id, uint32 device_id,
287 const Version& driver_version) const { 383 const std::string& driver_vendor,
384 const Version& driver_version,
385 const std::string& gl_renderer) const {
288 DCHECK(os_type != kOsAny); 386 DCHECK(os_type != kOsAny);
289 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) 387 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
290 return false; 388 return false;
291 if (vendor_id_ != 0 && vendor_id_ != vendor_id) 389 if (vendor_id_ != 0 && vendor_id_ != vendor_id)
292 return false; 390 return false;
293 if (device_id_ != 0 && device_id_ != device_id) 391 if (device_id_ != 0 && device_id_ != device_id)
294 return false; 392 return false;
295 if (driver_version_info_.get() == NULL) 393 if (driver_vendor_info_.get() != NULL &&
296 return true; 394 !driver_vendor_info_->Contains(driver_vendor))
297 return driver_version_info_->Contains(driver_version); 395 return false;
396 if (driver_version_info_.get() != NULL &&
397 !driver_version_info_->Contains(driver_version))
398 return false;
399 if (gl_renderer_info_.get() != NULL &&
400 !gl_renderer_info_->Contains(gl_renderer))
401 return false;
402 return true;
298 } 403 }
299 404
300 GpuBlacklist::OsType GpuBlacklist::GpuBlacklistEntry::GetOsType() const { 405 GpuBlacklist::OsType GpuBlacklist::GpuBlacklistEntry::GetOsType() const {
301 if (os_info_.get() == NULL) 406 if (os_info_.get() == NULL)
302 return kOsUnknown; 407 return kOsUnknown;
303 return os_info_->type(); 408 return os_info_->type();
304 } 409 }
305 410
411 uint32 GpuBlacklist::GpuBlacklistEntry::id() const {
412 return id_;
413 }
414
306 GpuFeatureFlags GpuBlacklist::GpuBlacklistEntry::GetGpuFeatureFlags() const { 415 GpuFeatureFlags GpuBlacklist::GpuBlacklistEntry::GetGpuFeatureFlags() const {
307 return *feature_flags_; 416 return *feature_flags_;
308 } 417 }
309 418
310 GpuBlacklist::GpuBlacklist() { 419 GpuBlacklist::GpuBlacklist() {
311 } 420 }
312 421
313 GpuBlacklist::~GpuBlacklist() { 422 GpuBlacklist::~GpuBlacklist() {
314 Clear(); 423 Clear();
315 } 424 }
316 425
317 bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context, 426 bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
318 bool current_os_only) { 427 bool current_os_only) {
319 std::vector<GpuBlacklistEntry*> entries; 428 std::vector<GpuBlacklistEntry*> entries;
320 scoped_ptr<Value> root; 429 scoped_ptr<Value> root;
321 root.reset(base::JSONReader::Read(json_context, false)); 430 root.reset(base::JSONReader::Read(json_context, false));
322 if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY)) 431 if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY))
323 return false; 432 return false;
324 433
434 DictionaryValue* root_dictionary = static_cast<DictionaryValue*>(root.get());
435 DCHECK(root_dictionary);
436 std::string version_string;
437 root_dictionary->GetString("version", &version_string);
438 version_.reset(Version::GetVersionFromString(version_string));
439 if (version_.get() == NULL)
440 return false;
441
325 ListValue* list = NULL; 442 ListValue* list = NULL;
326 static_cast<DictionaryValue*>(root.get())->GetList("entries", &list); 443 root_dictionary->GetList("entries", &list);
327 if (list == NULL) 444 if (list == NULL)
328 return false; 445 return false;
329 446
447 uint32 max_entry_id = 0;
330 for (size_t i = 0; i < list->GetSize(); ++i) { 448 for (size_t i = 0; i < list->GetSize(); ++i) {
331 DictionaryValue* list_item = NULL; 449 DictionaryValue* list_item = NULL;
332 bool valid = list->GetDictionary(i, &list_item); 450 bool valid = list->GetDictionary(i, &list_item);
333 if (!valid) 451 if (!valid)
334 break; 452 break;
335 GpuBlacklistEntry* entry = 453 GpuBlacklistEntry* entry =
336 GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item); 454 GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item);
337 if (entry == NULL) 455 if (entry == NULL)
338 break; 456 break;
457 if (entry->id() > max_entry_id)
458 max_entry_id = entry->id();
339 entries.push_back(entry); 459 entries.push_back(entry);
340 } 460 }
341 461
342 if (entries.size() < list->GetSize()) { 462 if (entries.size() < list->GetSize()) {
343 for (size_t i = 0; i < entries.size(); ++i) 463 for (size_t i = 0; i < entries.size(); ++i)
344 delete entries[i]; 464 delete entries[i];
345 return false; 465 return false;
346 } 466 }
347 467
348 Clear(); 468 Clear();
349 // Don't apply GPU blacklist for a non-registered OS. 469 // Don't apply GPU blacklist for a non-registered OS.
350 OsType os_filter = GetOsType(); 470 OsType os_filter = GetOsType();
351 if (os_filter != kOsUnknown) { 471 if (os_filter != kOsUnknown) {
352 for (size_t i = 0; i < entries.size(); ++i) { 472 for (size_t i = 0; i < entries.size(); ++i) {
353 OsType entry_os = entries[i]->GetOsType(); 473 OsType entry_os = entries[i]->GetOsType();
354 if (!current_os_only || 474 if (!current_os_only ||
355 entry_os == kOsAny || entry_os == os_filter) 475 entry_os == kOsAny || entry_os == os_filter)
356 blacklist_.push_back(entries[i]); 476 blacklist_.push_back(entries[i]);
357 else 477 else
358 delete entries[i]; 478 delete entries[i];
359 } 479 }
360 } 480 }
481 max_entry_id_ = max_entry_id;
361 return true; 482 return true;
362 } 483 }
363 484
364 GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags( 485 GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags(
365 GpuBlacklist::OsType os, 486 GpuBlacklist::OsType os,
366 Version* os_version, 487 Version* os_version,
367 const GPUInfo& gpu_info) const { 488 const GPUInfo& gpu_info) {
489 features_.clear();
490 entry_ids_.clear();
368 GpuFeatureFlags flags; 491 GpuFeatureFlags flags;
369 // No need to go through blacklist entries if GPUInfo isn't available. 492 // No need to go through blacklist entries if GPUInfo isn't available.
370 if (gpu_info.progress() == GPUInfo::kUninitialized) 493 if (gpu_info.progress() == GPUInfo::kUninitialized)
371 return flags; 494 return flags;
372 scoped_ptr<Version> driver_version( 495 scoped_ptr<Version> driver_version(
373 Version::GetVersionFromString(gpu_info.driver_version())); 496 Version::GetVersionFromString(gpu_info.driver_version()));
374 if (driver_version.get() == NULL) 497 if (driver_version.get() == NULL)
375 return flags; 498 return flags;
376 499
377 if (os == kOsAny) 500 if (os == kOsAny)
(...skipping 18 matching lines...) Expand all
396 version_string = version_string.substr(0, pos); 519 version_string = version_string.substr(0, pos);
397 #endif 520 #endif
398 my_os_version.reset(Version::GetVersionFromString(version_string)); 521 my_os_version.reset(Version::GetVersionFromString(version_string));
399 os_version = my_os_version.get(); 522 os_version = my_os_version.get();
400 } 523 }
401 DCHECK(os_version != NULL); 524 DCHECK(os_version != NULL);
402 525
403 for (size_t i = 0; i < blacklist_.size(); ++i) { 526 for (size_t i = 0; i < blacklist_.size(); ++i) {
404 if (blacklist_[i]->Contains(os, *os_version, 527 if (blacklist_[i]->Contains(os, *os_version,
405 gpu_info.vendor_id(), gpu_info.device_id(), 528 gpu_info.vendor_id(), gpu_info.device_id(),
406 *driver_version)) { 529 gpu_info.driver_vendor(),
530 *driver_version,
531 gpu_info.gl_renderer())) {
407 flags.Combine(blacklist_[i]->GetGpuFeatureFlags()); 532 flags.Combine(blacklist_[i]->GetGpuFeatureFlags());
533 features_.push_back(blacklist_[i]->GetGpuFeatureFlags().flags());
534 entry_ids_.push_back(blacklist_[i]->id());
408 } 535 }
409 } 536 }
410 return flags; 537 return flags;
411 } 538 }
412 539
540 void GpuBlacklist::GetGpuFeatureFlagEntries(
541 GpuFeatureFlags::GpuFeatureType feature,
542 std::vector<uint32>& entry_ids) const {
543 DCHECK(features_.size() == entry_ids_.size());
544 entry_ids.clear();
545 for (size_t i = 0; i < features_.size(); ++i) {
546 if ((feature & features_[i]) != 0)
547 entry_ids.push_back(entry_ids_[i]);
548 }
549 }
550
551 uint32 GpuBlacklist::max_entry_id() const {
552 return max_entry_id_;
553 }
554
555 bool GpuBlacklist::GetVersion(uint16* major, uint16* minor) const {
556 DCHECK(major && minor);
557 *major = 0;
558 *minor = 0;
559 if (version_.get() == NULL)
560 return false;
561 const std::vector<uint16>& components_reference = version_->components();
562 if (components_reference.size() != 2)
563 return false;
564 *major = components_reference[0];
565 *minor = components_reference[1];
566 return true;
567 }
568
413 GpuBlacklist::OsType GpuBlacklist::GetOsType() { 569 GpuBlacklist::OsType GpuBlacklist::GetOsType() {
414 #if defined(OS_WIN) 570 #if defined(OS_WIN)
415 return kOsWin; 571 return kOsWin;
416 #elif defined(OS_LINUX) 572 #elif defined(OS_LINUX)
417 return kOsLinux; 573 return kOsLinux;
418 #elif defined(OS_MACOSX) 574 #elif defined(OS_MACOSX)
419 return kOsMacosx; 575 return kOsMacosx;
420 #else 576 #else
421 return kOsUnknown; 577 return kOsUnknown;
422 #endif 578 #endif
423 } 579 }
424 580
425 void GpuBlacklist::Clear() { 581 void GpuBlacklist::Clear() {
426 for (size_t i = 0; i < blacklist_.size(); ++i) 582 for (size_t i = 0; i < blacklist_.size(); ++i)
427 delete blacklist_[i]; 583 delete blacklist_[i];
428 blacklist_.clear(); 584 blacklist_.clear();
429 } 585 }
430 586
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698