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

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 1115033003: resources: Prevent including the same resource in multiple pack files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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
« ui/base/resource/data_pack.cc ('K') | « ui/base/resource/data_pack.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 new DataPack(scale_factor)); 656 new DataPack(scale_factor));
657 if (data_pack->LoadFromPath(pack_path)) { 657 if (data_pack->LoadFromPath(pack_path)) {
658 AddDataPack(data_pack.release()); 658 AddDataPack(data_pack.release());
659 } else if (!optional) { 659 } else if (!optional) {
660 LOG(ERROR) << "Failed to load " << pack_path.value() 660 LOG(ERROR) << "Failed to load " << pack_path.value()
661 << "\nSome features may not be available."; 661 << "\nSome features may not be available.";
662 } 662 }
663 } 663 }
664 664
665 void ResourceBundle::AddDataPack(DataPack* data_pack) { 665 void ResourceBundle::AddDataPack(DataPack* data_pack) {
666 #if DCHECK_IS_ON()
667 data_pack->CheckForDuplicateResources(data_packs_);
668 #endif
666 data_packs_.push_back(data_pack); 669 data_packs_.push_back(data_pack);
667 670
668 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) > 671 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) >
669 GetScaleForScaleFactor(max_scale_factor_)) 672 GetScaleForScaleFactor(max_scale_factor_))
670 max_scale_factor_ = data_pack->GetScaleFactor(); 673 max_scale_factor_ = data_pack->GetScaleFactor();
671 } 674 }
672 675
673 void ResourceBundle::InitDefaultFontList() { 676 void ResourceBundle::InitDefaultFontList() {
674 #if defined(OS_CHROMEOS) 677 #if defined(OS_CHROMEOS)
675 std::string font_family = base::UTF16ToUTF8( 678 std::string font_family = base::UTF16ToUTF8(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 // static 859 // static
857 bool ResourceBundle::DecodePNG(const unsigned char* buf, 860 bool ResourceBundle::DecodePNG(const unsigned char* buf,
858 size_t size, 861 size_t size,
859 SkBitmap* bitmap, 862 SkBitmap* bitmap,
860 bool* fell_back_to_1x) { 863 bool* fell_back_to_1x) {
861 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 864 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
862 return gfx::PNGCodec::Decode(buf, size, bitmap); 865 return gfx::PNGCodec::Decode(buf, size, bitmap);
863 } 866 }
864 867
865 } // namespace ui 868 } // namespace ui
OLDNEW
« ui/base/resource/data_pack.cc ('K') | « ui/base/resource/data_pack.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698