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

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

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert ptr to bool for win compile. Created 8 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 | Annotate | Revision Log
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/data_pack.h" 5 #include "ui/base/resource/data_pack.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", ENTRY_NOT_FOUND, 138 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", ENTRY_NOT_FOUND,
139 LOAD_ERRORS_COUNT); 139 LOAD_ERRORS_COUNT);
140 mmap_.reset(); 140 mmap_.reset();
141 return false; 141 return false;
142 } 142 }
143 } 143 }
144 144
145 return true; 145 return true;
146 } 146 }
147 147
148 bool DataPack::HasResource(uint16 resource_id) const {
149 return !!bsearch(&resource_id, mmap_->data() + kHeaderLength, resource_count_,
tony 2012/05/11 21:22:03 Nit: The !! isn't necessary unless you think it im
flackr 2012/05/11 21:59:07 The win_rel try bot complained about casting void*
150 sizeof(DataPackEntry), DataPackEntry::CompareById);
151 }
152
148 bool DataPack::GetStringPiece(uint16 resource_id, 153 bool DataPack::GetStringPiece(uint16 resource_id,
149 base::StringPiece* data) const { 154 base::StringPiece* data) const {
150 // It won't be hard to make this endian-agnostic, but it's not worth 155 // It won't be hard to make this endian-agnostic, but it's not worth
151 // bothering to do right now. 156 // bothering to do right now.
152 #if defined(__BYTE_ORDER) 157 #if defined(__BYTE_ORDER)
153 // Linux check 158 // Linux check
154 COMPILE_ASSERT(__BYTE_ORDER == __LITTLE_ENDIAN, 159 COMPILE_ASSERT(__BYTE_ORDER == __LITTLE_ENDIAN,
155 datapack_assumes_little_endian); 160 datapack_assumes_little_endian);
156 #elif defined(__BIG_ENDIAN__) 161 #elif defined(__BIG_ENDIAN__)
157 // Mac check 162 // Mac check
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return false; 280 return false;
276 } 281 }
277 } 282 }
278 283
279 file_util::CloseFile(file); 284 file_util::CloseFile(file);
280 285
281 return true; 286 return true;
282 } 287 }
283 288
284 } // namespace ui 289 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698