OLD | NEW |
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 "chrome/browser/gpu_blacklist.h" | 5 #include "chrome/browser/gpu_blacklist.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 (value2_ <= value && value <= value_)); | 308 (value2_ <= value && value <= value_)); |
309 } | 309 } |
310 | 310 |
311 bool GpuBlacklist::FloatInfo::IsValid() const { | 311 bool GpuBlacklist::FloatInfo::IsValid() const { |
312 return op_ != kUnknown; | 312 return op_ != kUnknown; |
313 } | 313 } |
314 | 314 |
315 // static | 315 // static |
316 GpuBlacklist::ScopedGpuBlacklistEntry | 316 GpuBlacklist::ScopedGpuBlacklistEntry |
317 GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( | 317 GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( |
318 DictionaryValue* value, bool top_level) { | 318 const DictionaryValue* value, bool top_level) { |
319 DCHECK(value); | 319 DCHECK(value); |
320 ScopedGpuBlacklistEntry entry(new GpuBlacklistEntry()); | 320 ScopedGpuBlacklistEntry entry(new GpuBlacklistEntry()); |
321 | 321 |
322 size_t dictionary_entry_count = 0; | 322 size_t dictionary_entry_count = 0; |
323 | 323 |
324 if (top_level) { | 324 if (top_level) { |
325 uint32 id; | 325 uint32 id; |
326 if (!value->GetInteger("id", reinterpret_cast<int*>(&id)) || | 326 if (!value->GetInteger("id", reinterpret_cast<int*>(&id)) || |
327 !entry->SetId(id)) { | 327 !entry->SetId(id)) { |
328 LOG(WARNING) << "Malformed id entry " << entry->id(); | 328 LOG(WARNING) << "Malformed id entry " << entry->id(); |
329 return NULL; | 329 return NULL; |
330 } | 330 } |
331 dictionary_entry_count++; | 331 dictionary_entry_count++; |
332 | 332 |
333 bool disabled; | 333 bool disabled; |
334 if (value->GetBoolean("disabled", &disabled)) { | 334 if (value->GetBoolean("disabled", &disabled)) { |
335 entry->SetDisabled(disabled); | 335 entry->SetDisabled(disabled); |
336 dictionary_entry_count++; | 336 dictionary_entry_count++; |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 std::string description; | 340 std::string description; |
341 if (value->GetString("description", &description)) { | 341 if (value->GetString("description", &description)) { |
342 entry->description_ = description; | 342 entry->description_ = description; |
343 dictionary_entry_count++; | 343 dictionary_entry_count++; |
344 } else { | 344 } else { |
345 entry->description_ = "The GPU is unavailable for an unexplained reason."; | 345 entry->description_ = "The GPU is unavailable for an unexplained reason."; |
346 } | 346 } |
347 | 347 |
348 ListValue* cr_bugs; | 348 const ListValue* cr_bugs; |
349 if (value->GetList("cr_bugs", &cr_bugs)) { | 349 if (value->GetList("cr_bugs", &cr_bugs)) { |
350 for (size_t i = 0; i < cr_bugs->GetSize(); ++i) { | 350 for (size_t i = 0; i < cr_bugs->GetSize(); ++i) { |
351 int bug_id; | 351 int bug_id; |
352 if (cr_bugs->GetInteger(i, &bug_id)) { | 352 if (cr_bugs->GetInteger(i, &bug_id)) { |
353 entry->cr_bugs_.push_back(bug_id); | 353 entry->cr_bugs_.push_back(bug_id); |
354 } else { | 354 } else { |
355 LOG(WARNING) << "Malformed cr_bugs entry " << entry->id(); | 355 LOG(WARNING) << "Malformed cr_bugs entry " << entry->id(); |
356 return NULL; | 356 return NULL; |
357 } | 357 } |
358 } | 358 } |
359 dictionary_entry_count++; | 359 dictionary_entry_count++; |
360 } | 360 } |
361 | 361 |
362 ListValue* webkit_bugs; | 362 const ListValue* webkit_bugs; |
363 if (value->GetList("webkit_bugs", &webkit_bugs)) { | 363 if (value->GetList("webkit_bugs", &webkit_bugs)) { |
364 for (size_t i = 0; i < webkit_bugs->GetSize(); ++i) { | 364 for (size_t i = 0; i < webkit_bugs->GetSize(); ++i) { |
365 int bug_id; | 365 int bug_id; |
366 if (webkit_bugs->GetInteger(i, &bug_id)) { | 366 if (webkit_bugs->GetInteger(i, &bug_id)) { |
367 entry->webkit_bugs_.push_back(bug_id); | 367 entry->webkit_bugs_.push_back(bug_id); |
368 } else { | 368 } else { |
369 LOG(WARNING) << "Malformed webkit_bugs entry " << entry->id(); | 369 LOG(WARNING) << "Malformed webkit_bugs entry " << entry->id(); |
370 return NULL; | 370 return NULL; |
371 } | 371 } |
372 } | 372 } |
373 dictionary_entry_count++; | 373 dictionary_entry_count++; |
374 } | 374 } |
375 | 375 |
376 DictionaryValue* os_value = NULL; | 376 const DictionaryValue* os_value = NULL; |
377 if (value->GetDictionary("os", &os_value)) { | 377 if (value->GetDictionary("os", &os_value)) { |
378 std::string os_type; | 378 std::string os_type; |
379 std::string os_version_op = "any"; | 379 std::string os_version_op = "any"; |
380 std::string os_version_string; | 380 std::string os_version_string; |
381 std::string os_version_string2; | 381 std::string os_version_string2; |
382 os_value->GetString("type", &os_type); | 382 os_value->GetString("type", &os_type); |
383 DictionaryValue* os_version_value = NULL; | 383 const DictionaryValue* os_version_value = NULL; |
384 if (os_value->GetDictionary("version", &os_version_value)) { | 384 if (os_value->GetDictionary("version", &os_version_value)) { |
385 os_version_value->GetString("op", &os_version_op); | 385 os_version_value->GetString("op", &os_version_op); |
386 os_version_value->GetString("number", &os_version_string); | 386 os_version_value->GetString("number", &os_version_string); |
387 os_version_value->GetString("number2", &os_version_string2); | 387 os_version_value->GetString("number2", &os_version_string2); |
388 } | 388 } |
389 if (!entry->SetOsInfo(os_type, os_version_op, os_version_string, | 389 if (!entry->SetOsInfo(os_type, os_version_op, os_version_string, |
390 os_version_string2)) { | 390 os_version_string2)) { |
391 LOG(WARNING) << "Malformed os entry " << entry->id(); | 391 LOG(WARNING) << "Malformed os entry " << entry->id(); |
392 return NULL; | 392 return NULL; |
393 } | 393 } |
394 dictionary_entry_count++; | 394 dictionary_entry_count++; |
395 } | 395 } |
396 | 396 |
397 std::string vendor_id; | 397 std::string vendor_id; |
398 if (value->GetString("vendor_id", &vendor_id)) { | 398 if (value->GetString("vendor_id", &vendor_id)) { |
399 if (!entry->SetVendorId(vendor_id)) { | 399 if (!entry->SetVendorId(vendor_id)) { |
400 LOG(WARNING) << "Malformed vendor_id entry " << entry->id(); | 400 LOG(WARNING) << "Malformed vendor_id entry " << entry->id(); |
401 return NULL; | 401 return NULL; |
402 } | 402 } |
403 dictionary_entry_count++; | 403 dictionary_entry_count++; |
404 } | 404 } |
405 | 405 |
406 ListValue* device_id_list; | 406 const ListValue* device_id_list; |
407 if (value->GetList("device_id", &device_id_list)) { | 407 if (value->GetList("device_id", &device_id_list)) { |
408 for (size_t i = 0; i < device_id_list->GetSize(); ++i) { | 408 for (size_t i = 0; i < device_id_list->GetSize(); ++i) { |
409 std::string device_id; | 409 std::string device_id; |
410 if (!device_id_list->GetString(i, &device_id) || | 410 if (!device_id_list->GetString(i, &device_id) || |
411 !entry->AddDeviceId(device_id)) { | 411 !entry->AddDeviceId(device_id)) { |
412 LOG(WARNING) << "Malformed device_id entry " << entry->id(); | 412 LOG(WARNING) << "Malformed device_id entry " << entry->id(); |
413 return NULL; | 413 return NULL; |
414 } | 414 } |
415 } | 415 } |
416 dictionary_entry_count++; | 416 dictionary_entry_count++; |
(...skipping 10 matching lines...) Expand all Loading... |
427 | 427 |
428 std::string multi_gpu_category; | 428 std::string multi_gpu_category; |
429 if (value->GetString("multi_gpu_category", &multi_gpu_category)) { | 429 if (value->GetString("multi_gpu_category", &multi_gpu_category)) { |
430 if (!entry->SetMultiGpuCategory(multi_gpu_category)) { | 430 if (!entry->SetMultiGpuCategory(multi_gpu_category)) { |
431 LOG(WARNING) << "Malformed multi_gpu_category entry " << entry->id(); | 431 LOG(WARNING) << "Malformed multi_gpu_category entry " << entry->id(); |
432 return NULL; | 432 return NULL; |
433 } | 433 } |
434 dictionary_entry_count++; | 434 dictionary_entry_count++; |
435 } | 435 } |
436 | 436 |
437 DictionaryValue* driver_vendor_value = NULL; | 437 const DictionaryValue* driver_vendor_value = NULL; |
438 if (value->GetDictionary("driver_vendor", &driver_vendor_value)) { | 438 if (value->GetDictionary("driver_vendor", &driver_vendor_value)) { |
439 std::string vendor_op; | 439 std::string vendor_op; |
440 std::string vendor_value; | 440 std::string vendor_value; |
441 driver_vendor_value->GetString("op", &vendor_op); | 441 driver_vendor_value->GetString("op", &vendor_op); |
442 driver_vendor_value->GetString("value", &vendor_value); | 442 driver_vendor_value->GetString("value", &vendor_value); |
443 if (!entry->SetDriverVendorInfo(vendor_op, vendor_value)) { | 443 if (!entry->SetDriverVendorInfo(vendor_op, vendor_value)) { |
444 LOG(WARNING) << "Malformed driver_vendor entry " << entry->id(); | 444 LOG(WARNING) << "Malformed driver_vendor entry " << entry->id(); |
445 return NULL; | 445 return NULL; |
446 } | 446 } |
447 dictionary_entry_count++; | 447 dictionary_entry_count++; |
448 } | 448 } |
449 | 449 |
450 DictionaryValue* driver_version_value = NULL; | 450 const DictionaryValue* driver_version_value = NULL; |
451 if (value->GetDictionary("driver_version", &driver_version_value)) { | 451 if (value->GetDictionary("driver_version", &driver_version_value)) { |
452 std::string driver_version_op = "any"; | 452 std::string driver_version_op = "any"; |
453 std::string driver_version_style; | 453 std::string driver_version_style; |
454 std::string driver_version_string; | 454 std::string driver_version_string; |
455 std::string driver_version_string2; | 455 std::string driver_version_string2; |
456 driver_version_value->GetString("op", &driver_version_op); | 456 driver_version_value->GetString("op", &driver_version_op); |
457 driver_version_value->GetString("style", &driver_version_style); | 457 driver_version_value->GetString("style", &driver_version_style); |
458 driver_version_value->GetString("number", &driver_version_string); | 458 driver_version_value->GetString("number", &driver_version_string); |
459 driver_version_value->GetString("number2", &driver_version_string2); | 459 driver_version_value->GetString("number2", &driver_version_string2); |
460 if (!entry->SetDriverVersionInfo(driver_version_op, | 460 if (!entry->SetDriverVersionInfo(driver_version_op, |
461 driver_version_style, | 461 driver_version_style, |
462 driver_version_string, | 462 driver_version_string, |
463 driver_version_string2)) { | 463 driver_version_string2)) { |
464 LOG(WARNING) << "Malformed driver_version entry " << entry->id(); | 464 LOG(WARNING) << "Malformed driver_version entry " << entry->id(); |
465 return NULL; | 465 return NULL; |
466 } | 466 } |
467 dictionary_entry_count++; | 467 dictionary_entry_count++; |
468 } | 468 } |
469 | 469 |
470 DictionaryValue* driver_date_value = NULL; | 470 const DictionaryValue* driver_date_value = NULL; |
471 if (value->GetDictionary("driver_date", &driver_date_value)) { | 471 if (value->GetDictionary("driver_date", &driver_date_value)) { |
472 std::string driver_date_op = "any"; | 472 std::string driver_date_op = "any"; |
473 std::string driver_date_string; | 473 std::string driver_date_string; |
474 std::string driver_date_string2; | 474 std::string driver_date_string2; |
475 driver_date_value->GetString("op", &driver_date_op); | 475 driver_date_value->GetString("op", &driver_date_op); |
476 driver_date_value->GetString("number", &driver_date_string); | 476 driver_date_value->GetString("number", &driver_date_string); |
477 driver_date_value->GetString("number2", &driver_date_string2); | 477 driver_date_value->GetString("number2", &driver_date_string2); |
478 if (!entry->SetDriverDateInfo(driver_date_op, driver_date_string, | 478 if (!entry->SetDriverDateInfo(driver_date_op, driver_date_string, |
479 driver_date_string2)) { | 479 driver_date_string2)) { |
480 LOG(WARNING) << "Malformed driver_date entry " << entry->id(); | 480 LOG(WARNING) << "Malformed driver_date entry " << entry->id(); |
481 return NULL; | 481 return NULL; |
482 } | 482 } |
483 dictionary_entry_count++; | 483 dictionary_entry_count++; |
484 } | 484 } |
485 | 485 |
486 DictionaryValue* gl_vendor_value = NULL; | 486 const DictionaryValue* gl_vendor_value = NULL; |
487 if (value->GetDictionary("gl_vendor", &gl_vendor_value)) { | 487 if (value->GetDictionary("gl_vendor", &gl_vendor_value)) { |
488 std::string vendor_op; | 488 std::string vendor_op; |
489 std::string vendor_value; | 489 std::string vendor_value; |
490 gl_vendor_value->GetString("op", &vendor_op); | 490 gl_vendor_value->GetString("op", &vendor_op); |
491 gl_vendor_value->GetString("value", &vendor_value); | 491 gl_vendor_value->GetString("value", &vendor_value); |
492 if (!entry->SetGLVendorInfo(vendor_op, vendor_value)) { | 492 if (!entry->SetGLVendorInfo(vendor_op, vendor_value)) { |
493 LOG(WARNING) << "Malformed gl_vendor entry " << entry->id(); | 493 LOG(WARNING) << "Malformed gl_vendor entry " << entry->id(); |
494 return NULL; | 494 return NULL; |
495 } | 495 } |
496 dictionary_entry_count++; | 496 dictionary_entry_count++; |
497 } | 497 } |
498 | 498 |
499 DictionaryValue* gl_renderer_value = NULL; | 499 const DictionaryValue* gl_renderer_value = NULL; |
500 if (value->GetDictionary("gl_renderer", &gl_renderer_value)) { | 500 if (value->GetDictionary("gl_renderer", &gl_renderer_value)) { |
501 std::string renderer_op; | 501 std::string renderer_op; |
502 std::string renderer_value; | 502 std::string renderer_value; |
503 gl_renderer_value->GetString("op", &renderer_op); | 503 gl_renderer_value->GetString("op", &renderer_op); |
504 gl_renderer_value->GetString("value", &renderer_value); | 504 gl_renderer_value->GetString("value", &renderer_value); |
505 if (!entry->SetGLRendererInfo(renderer_op, renderer_value)) { | 505 if (!entry->SetGLRendererInfo(renderer_op, renderer_value)) { |
506 LOG(WARNING) << "Malformed gl_renderer entry " << entry->id(); | 506 LOG(WARNING) << "Malformed gl_renderer entry " << entry->id(); |
507 return NULL; | 507 return NULL; |
508 } | 508 } |
509 dictionary_entry_count++; | 509 dictionary_entry_count++; |
510 } | 510 } |
511 | 511 |
512 DictionaryValue* perf_graphics_value = NULL; | 512 const DictionaryValue* perf_graphics_value = NULL; |
513 if (value->GetDictionary("perf_graphics", &perf_graphics_value)) { | 513 if (value->GetDictionary("perf_graphics", &perf_graphics_value)) { |
514 std::string op; | 514 std::string op; |
515 std::string float_value; | 515 std::string float_value; |
516 std::string float_value2; | 516 std::string float_value2; |
517 perf_graphics_value->GetString("op", &op); | 517 perf_graphics_value->GetString("op", &op); |
518 perf_graphics_value->GetString("value", &float_value); | 518 perf_graphics_value->GetString("value", &float_value); |
519 perf_graphics_value->GetString("value2", &float_value2); | 519 perf_graphics_value->GetString("value2", &float_value2); |
520 if (!entry->SetPerfGraphicsInfo(op, float_value, float_value2)) { | 520 if (!entry->SetPerfGraphicsInfo(op, float_value, float_value2)) { |
521 LOG(WARNING) << "Malformed perf_graphics entry " << entry->id(); | 521 LOG(WARNING) << "Malformed perf_graphics entry " << entry->id(); |
522 return NULL; | 522 return NULL; |
523 } | 523 } |
524 dictionary_entry_count++; | 524 dictionary_entry_count++; |
525 } | 525 } |
526 | 526 |
527 DictionaryValue* perf_gaming_value = NULL; | 527 const DictionaryValue* perf_gaming_value = NULL; |
528 if (value->GetDictionary("perf_gaming", &perf_gaming_value)) { | 528 if (value->GetDictionary("perf_gaming", &perf_gaming_value)) { |
529 std::string op; | 529 std::string op; |
530 std::string float_value; | 530 std::string float_value; |
531 std::string float_value2; | 531 std::string float_value2; |
532 perf_gaming_value->GetString("op", &op); | 532 perf_gaming_value->GetString("op", &op); |
533 perf_gaming_value->GetString("value", &float_value); | 533 perf_gaming_value->GetString("value", &float_value); |
534 perf_gaming_value->GetString("value2", &float_value2); | 534 perf_gaming_value->GetString("value2", &float_value2); |
535 if (!entry->SetPerfGamingInfo(op, float_value, float_value2)) { | 535 if (!entry->SetPerfGamingInfo(op, float_value, float_value2)) { |
536 LOG(WARNING) << "Malformed perf_gaming entry " << entry->id(); | 536 LOG(WARNING) << "Malformed perf_gaming entry " << entry->id(); |
537 return NULL; | 537 return NULL; |
538 } | 538 } |
539 dictionary_entry_count++; | 539 dictionary_entry_count++; |
540 } | 540 } |
541 | 541 |
542 DictionaryValue* perf_overall_value = NULL; | 542 const DictionaryValue* perf_overall_value = NULL; |
543 if (value->GetDictionary("perf_overall", &perf_overall_value)) { | 543 if (value->GetDictionary("perf_overall", &perf_overall_value)) { |
544 std::string op; | 544 std::string op; |
545 std::string float_value; | 545 std::string float_value; |
546 std::string float_value2; | 546 std::string float_value2; |
547 perf_overall_value->GetString("op", &op); | 547 perf_overall_value->GetString("op", &op); |
548 perf_overall_value->GetString("value", &float_value); | 548 perf_overall_value->GetString("value", &float_value); |
549 perf_overall_value->GetString("value2", &float_value2); | 549 perf_overall_value->GetString("value2", &float_value2); |
550 if (!entry->SetPerfOverallInfo(op, float_value, float_value2)) { | 550 if (!entry->SetPerfOverallInfo(op, float_value, float_value2)) { |
551 LOG(WARNING) << "Malformed perf_overall entry " << entry->id(); | 551 LOG(WARNING) << "Malformed perf_overall entry " << entry->id(); |
552 return NULL; | 552 return NULL; |
553 } | 553 } |
554 dictionary_entry_count++; | 554 dictionary_entry_count++; |
555 } | 555 } |
556 | 556 |
557 if (top_level) { | 557 if (top_level) { |
558 ListValue* blacklist_value = NULL; | 558 const ListValue* blacklist_value = NULL; |
559 if (!value->GetList("blacklist", &blacklist_value)) { | 559 if (!value->GetList("blacklist", &blacklist_value)) { |
560 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); | 560 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); |
561 return NULL; | 561 return NULL; |
562 } | 562 } |
563 std::vector<std::string> blacklist; | 563 std::vector<std::string> blacklist; |
564 for (size_t i = 0; i < blacklist_value->GetSize(); ++i) { | 564 for (size_t i = 0; i < blacklist_value->GetSize(); ++i) { |
565 std::string feature; | 565 std::string feature; |
566 if (blacklist_value->GetString(i, &feature)) { | 566 if (blacklist_value->GetString(i, &feature)) { |
567 blacklist.push_back(feature); | 567 blacklist.push_back(feature); |
568 } else { | 568 } else { |
569 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); | 569 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); |
570 return NULL; | 570 return NULL; |
571 } | 571 } |
572 } | 572 } |
573 if (!entry->SetBlacklistedFeatures(blacklist)) { | 573 if (!entry->SetBlacklistedFeatures(blacklist)) { |
574 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); | 574 LOG(WARNING) << "Malformed blacklist entry " << entry->id(); |
575 return NULL; | 575 return NULL; |
576 } | 576 } |
577 dictionary_entry_count++; | 577 dictionary_entry_count++; |
578 } | 578 } |
579 | 579 |
580 if (top_level) { | 580 if (top_level) { |
581 ListValue* exception_list_value = NULL; | 581 const ListValue* exception_list_value = NULL; |
582 if (value->GetList("exceptions", &exception_list_value)) { | 582 if (value->GetList("exceptions", &exception_list_value)) { |
583 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { | 583 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { |
584 DictionaryValue* exception_value = NULL; | 584 const DictionaryValue* exception_value = NULL; |
585 if (!exception_list_value->GetDictionary(i, &exception_value)) { | 585 if (!exception_list_value->GetDictionary(i, &exception_value)) { |
586 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | 586 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); |
587 return NULL; | 587 return NULL; |
588 } | 588 } |
589 ScopedGpuBlacklistEntry exception( | 589 ScopedGpuBlacklistEntry exception( |
590 GetGpuBlacklistEntryFromValue(exception_value, false)); | 590 GetGpuBlacklistEntryFromValue(exception_value, false)); |
591 if (exception == NULL) { | 591 if (exception == NULL) { |
592 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | 592 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); |
593 return NULL; | 593 return NULL; |
594 } | 594 } |
595 if (exception->contains_unknown_fields_) { | 595 if (exception->contains_unknown_fields_) { |
596 LOG(WARNING) << "Exception with unknown fields " << entry->id(); | 596 LOG(WARNING) << "Exception with unknown fields " << entry->id(); |
597 entry->contains_unknown_fields_ = true; | 597 entry->contains_unknown_fields_ = true; |
598 } else { | 598 } else { |
599 entry->AddException(exception); | 599 entry->AddException(exception); |
600 } | 600 } |
601 } | 601 } |
602 dictionary_entry_count++; | 602 dictionary_entry_count++; |
603 } | 603 } |
604 | 604 |
605 DictionaryValue* browser_version_value = NULL; | 605 const DictionaryValue* browser_version_value = NULL; |
606 // browser_version is processed in LoadGpuBlacklist(). | 606 // browser_version is processed in LoadGpuBlacklist(). |
607 if (value->GetDictionary("browser_version", &browser_version_value)) | 607 if (value->GetDictionary("browser_version", &browser_version_value)) |
608 dictionary_entry_count++; | 608 dictionary_entry_count++; |
609 } | 609 } |
610 | 610 |
611 if (value->size() != dictionary_entry_count) { | 611 if (value->size() != dictionary_entry_count) { |
612 LOG(WARNING) << "Entry with unknown fields " << entry->id(); | 612 LOG(WARNING) << "Entry with unknown fields " << entry->id(); |
613 entry->contains_unknown_fields_ = true; | 613 entry->contains_unknown_fields_ = true; |
614 } | 614 } |
615 return entry; | 615 return entry; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 if (!version_->IsValid()) | 968 if (!version_->IsValid()) |
969 return false; | 969 return false; |
970 | 970 |
971 const ListValue* list = NULL; | 971 const ListValue* list = NULL; |
972 if (!parsed_json.GetList("entries", &list)) | 972 if (!parsed_json.GetList("entries", &list)) |
973 return false; | 973 return false; |
974 | 974 |
975 uint32 max_entry_id = 0; | 975 uint32 max_entry_id = 0; |
976 bool contains_unknown_fields = false; | 976 bool contains_unknown_fields = false; |
977 for (size_t i = 0; i < list->GetSize(); ++i) { | 977 for (size_t i = 0; i < list->GetSize(); ++i) { |
978 DictionaryValue* list_item = NULL; | 978 const DictionaryValue* list_item = NULL; |
979 bool valid = list->GetDictionary(i, &list_item); | 979 bool valid = list->GetDictionary(i, &list_item); |
980 if (!valid || list_item == NULL) | 980 if (!valid || list_item == NULL) |
981 return false; | 981 return false; |
982 // Check browser version compatibility: if the entry is not for the | 982 // Check browser version compatibility: if the entry is not for the |
983 // current browser version, don't process it. | 983 // current browser version, don't process it. |
984 BrowserVersionSupport browser_version_support = | 984 BrowserVersionSupport browser_version_support = |
985 IsEntrySupportedByCurrentBrowserVersion(list_item); | 985 IsEntrySupportedByCurrentBrowserVersion(list_item); |
986 if (browser_version_support == kMalformed) | 986 if (browser_version_support == kMalformed) |
987 return false; | 987 return false; |
988 if (browser_version_support == kUnsupported) | 988 if (browser_version_support == kUnsupported) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 | 1131 |
1132 void GpuBlacklist::Clear() { | 1132 void GpuBlacklist::Clear() { |
1133 blacklist_.clear(); | 1133 blacklist_.clear(); |
1134 active_entries_.clear(); | 1134 active_entries_.clear(); |
1135 max_entry_id_ = 0; | 1135 max_entry_id_ = 0; |
1136 contains_unknown_fields_ = false; | 1136 contains_unknown_fields_ = false; |
1137 } | 1137 } |
1138 | 1138 |
1139 GpuBlacklist::BrowserVersionSupport | 1139 GpuBlacklist::BrowserVersionSupport |
1140 GpuBlacklist::IsEntrySupportedByCurrentBrowserVersion( | 1140 GpuBlacklist::IsEntrySupportedByCurrentBrowserVersion( |
1141 DictionaryValue* value) { | 1141 const DictionaryValue* value) { |
1142 DCHECK(value); | 1142 DCHECK(value); |
1143 DictionaryValue* browser_version_value = NULL; | 1143 const DictionaryValue* browser_version_value = NULL; |
1144 if (value->GetDictionary("browser_version", &browser_version_value)) { | 1144 if (value->GetDictionary("browser_version", &browser_version_value)) { |
1145 std::string version_op = "any"; | 1145 std::string version_op = "any"; |
1146 std::string version_string; | 1146 std::string version_string; |
1147 std::string version_string2; | 1147 std::string version_string2; |
1148 browser_version_value->GetString("op", &version_op); | 1148 browser_version_value->GetString("op", &version_op); |
1149 browser_version_value->GetString("number", &version_string); | 1149 browser_version_value->GetString("number", &version_string); |
1150 browser_version_value->GetString("number2", &version_string2); | 1150 browser_version_value->GetString("number2", &version_string2); |
1151 scoped_ptr<VersionInfo> browser_version_info; | 1151 scoped_ptr<VersionInfo> browser_version_info; |
1152 browser_version_info.reset( | 1152 browser_version_info.reset( |
1153 new VersionInfo(version_op, "", version_string, version_string2)); | 1153 new VersionInfo(version_op, "", version_string, version_string2)); |
(...skipping 22 matching lines...) Expand all Loading... |
1176 if (op == ">") | 1176 if (op == ">") |
1177 return kGT; | 1177 return kGT; |
1178 if (op == ">=") | 1178 if (op == ">=") |
1179 return kGE; | 1179 return kGE; |
1180 if (op == "any") | 1180 if (op == "any") |
1181 return kAny; | 1181 return kAny; |
1182 if (op == "between") | 1182 if (op == "between") |
1183 return kBetween; | 1183 return kBetween; |
1184 return kUnknown; | 1184 return kUnknown; |
1185 } | 1185 } |
OLD | NEW |