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

Side by Side Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 1095183004: [chrome/browser/t*] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding files Created 5 years, 8 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
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/themes/browser_theme_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 delete [] tints_; 644 delete [] tints_;
645 delete [] colors_; 645 delete [] colors_;
646 delete [] display_properties_; 646 delete [] display_properties_;
647 delete [] source_images_; 647 delete [] source_images_;
648 } 648 }
649 } 649 }
650 650
651 // static 651 // static
652 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromExtension( 652 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromExtension(
653 const Extension* extension) { 653 const Extension* extension) {
654 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 654 DCHECK_CURRENTLY_ON(BrowserThread::UI);
655 DCHECK(extension); 655 DCHECK(extension);
656 DCHECK(extension->is_theme()); 656 DCHECK(extension->is_theme());
657 657
658 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); 658 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack);
659 pack->BuildHeader(extension); 659 pack->BuildHeader(extension);
660 pack->BuildTintsFromJSON(extensions::ThemeInfo::GetTints(extension)); 660 pack->BuildTintsFromJSON(extensions::ThemeInfo::GetTints(extension));
661 pack->BuildColorsFromJSON(extensions::ThemeInfo::GetColors(extension)); 661 pack->BuildColorsFromJSON(extensions::ThemeInfo::GetColors(extension));
662 pack->BuildDisplayPropertiesFromJSON( 662 pack->BuildDisplayPropertiesFromJSON(
663 extensions::ThemeInfo::GetDisplayProperties(extension)); 663 extensions::ThemeInfo::GetDisplayProperties(extension));
664 664
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 pack->GenerateRawImageForAllSupportedScales(kPreloadIDs[i]); 705 pack->GenerateRawImageForAllSupportedScales(kPreloadIDs[i]);
706 } 706 }
707 707
708 // The BrowserThemePack is now in a consistent state. 708 // The BrowserThemePack is now in a consistent state.
709 return pack; 709 return pack;
710 } 710 }
711 711
712 // static 712 // static
713 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( 713 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack(
714 const base::FilePath& path, const std::string& expected_id) { 714 const base::FilePath& path, const std::string& expected_id) {
715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 715 DCHECK_CURRENTLY_ON(BrowserThread::UI);
716 // Allow IO on UI thread due to deep-seated theme design issues. 716 // Allow IO on UI thread due to deep-seated theme design issues.
717 // (see http://crbug.com/80206) 717 // (see http://crbug.com/80206)
718 base::ThreadRestrictions::ScopedAllowIO allow_io; 718 base::ThreadRestrictions::ScopedAllowIO allow_io;
719 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); 719 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack);
720 // Scale factor parameter is moot as data pack has image resources for all 720 // Scale factor parameter is moot as data pack has image resources for all
721 // supported scale factors. 721 // supported scale factors.
722 pack->data_pack_.reset( 722 pack->data_pack_.reset(
723 new ui::DataPack(ui::SCALE_FACTOR_NONE)); 723 new ui::DataPack(ui::SCALE_FACTOR_NONE));
724 724
725 if (!pack->data_pack_->LoadFromPath(path)) { 725 if (!pack->data_pack_->LoadFromPath(path)) {
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 false, 1628 false,
1629 &bitmap_data)) { 1629 &bitmap_data)) {
1630 NOTREACHED() << "Unable to encode theme image for prs_id=" 1630 NOTREACHED() << "Unable to encode theme image for prs_id="
1631 << prs_id << " for scale_factor=" << scale_factors_[i]; 1631 << prs_id << " for scale_factor=" << scale_factors_[i];
1632 break; 1632 break;
1633 } 1633 }
1634 image_memory_[scaled_raw_id] = 1634 image_memory_[scaled_raw_id] =
1635 base::RefCountedBytes::TakeVector(&bitmap_data); 1635 base::RefCountedBytes::TakeVector(&bitmap_data);
1636 } 1636 }
1637 } 1637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698