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

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: tot-merge 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
« no previous file with comments | « ui/base/resource/data_pack.cc ('k') | ui/base/ui_base_paths.cc » ('j') | 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 new DataPack(scale_factor)); 655 new DataPack(scale_factor));
656 if (data_pack->LoadFromPath(pack_path)) { 656 if (data_pack->LoadFromPath(pack_path)) {
657 AddDataPack(data_pack.release()); 657 AddDataPack(data_pack.release());
658 } else if (!optional) { 658 } else if (!optional) {
659 LOG(ERROR) << "Failed to load " << pack_path.value() 659 LOG(ERROR) << "Failed to load " << pack_path.value()
660 << "\nSome features may not be available."; 660 << "\nSome features may not be available.";
661 } 661 }
662 } 662 }
663 663
664 void ResourceBundle::AddDataPack(DataPack* data_pack) { 664 void ResourceBundle::AddDataPack(DataPack* data_pack) {
665 #if DCHECK_IS_ON()
666 data_pack->CheckForDuplicateResources(data_packs_);
667 #endif
665 data_packs_.push_back(data_pack); 668 data_packs_.push_back(data_pack);
666 669
667 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) > 670 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) >
668 GetScaleForScaleFactor(max_scale_factor_)) 671 GetScaleForScaleFactor(max_scale_factor_))
669 max_scale_factor_ = data_pack->GetScaleFactor(); 672 max_scale_factor_ = data_pack->GetScaleFactor();
670 } 673 }
671 674
672 void ResourceBundle::InitDefaultFontList() { 675 void ResourceBundle::InitDefaultFontList() {
673 #if defined(OS_CHROMEOS) 676 #if defined(OS_CHROMEOS)
674 std::string font_family = base::UTF16ToUTF8( 677 std::string font_family = base::UTF16ToUTF8(
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 // static 857 // static
855 bool ResourceBundle::DecodePNG(const unsigned char* buf, 858 bool ResourceBundle::DecodePNG(const unsigned char* buf,
856 size_t size, 859 size_t size,
857 SkBitmap* bitmap, 860 SkBitmap* bitmap,
858 bool* fell_back_to_1x) { 861 bool* fell_back_to_1x) {
859 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 862 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
860 return gfx::PNGCodec::Decode(buf, size, bitmap); 863 return gfx::PNGCodec::Decode(buf, size, bitmap);
861 } 864 }
862 865
863 } // namespace ui 866 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/data_pack.cc ('k') | ui/base/ui_base_paths.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698