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

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

Issue 126103003: Changed RefCountedStaticMemory() to accept a void pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 10 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 "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/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 data->set(mmap_->data() + target->file_offset, length); 193 data->set(mmap_->data() + target->file_offset, length);
194 return true; 194 return true;
195 } 195 }
196 196
197 base::RefCountedStaticMemory* DataPack::GetStaticMemory( 197 base::RefCountedStaticMemory* DataPack::GetStaticMemory(
198 uint16 resource_id) const { 198 uint16 resource_id) const {
199 base::StringPiece piece; 199 base::StringPiece piece;
200 if (!GetStringPiece(resource_id, &piece)) 200 if (!GetStringPiece(resource_id, &piece))
201 return NULL; 201 return NULL;
202 202
203 return new base::RefCountedStaticMemory( 203 return new base::RefCountedStaticMemory(piece.data(), piece.length());
204 reinterpret_cast<const unsigned char*>(piece.data()), piece.length());
205 } 204 }
206 205
207 ResourceHandle::TextEncodingType DataPack::GetTextEncodingType() const { 206 ResourceHandle::TextEncodingType DataPack::GetTextEncodingType() const {
208 return text_encoding_type_; 207 return text_encoding_type_;
209 } 208 }
210 209
211 ui::ScaleFactor DataPack::GetScaleFactor() const { 210 ui::ScaleFactor DataPack::GetScaleFactor() const {
212 return scale_factor_; 211 return scale_factor_;
213 } 212 }
214 213
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return false; 296 return false;
298 } 297 }
299 } 298 }
300 299
301 base::CloseFile(file); 300 base::CloseFile(file);
302 301
303 return true; 302 return true;
304 } 303 }
305 304
306 } // namespace ui 305 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_data_source_unittest.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698