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

Side by Side Diff: ui/base/resource/resource_bundle.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
« no previous file with comments | « ui/base/resource/data_pack.cc ('k') | ui/base/resource/resource_bundle_gtk.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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 int resource_id, 399 int resource_id,
400 ScaleFactor scale_factor) const { 400 ScaleFactor scale_factor) const {
401 base::RefCountedStaticMemory* bytes = NULL; 401 base::RefCountedStaticMemory* bytes = NULL;
402 if (delegate_) 402 if (delegate_)
403 bytes = delegate_->LoadDataResourceBytes(resource_id, scale_factor); 403 bytes = delegate_->LoadDataResourceBytes(resource_id, scale_factor);
404 404
405 if (!bytes) { 405 if (!bytes) {
406 base::StringPiece data = 406 base::StringPiece data =
407 GetRawDataResourceForScale(resource_id, scale_factor); 407 GetRawDataResourceForScale(resource_id, scale_factor);
408 if (!data.empty()) { 408 if (!data.empty()) {
409 bytes = new base::RefCountedStaticMemory( 409 bytes = new base::RefCountedStaticMemory(data.data(), data.length());
410 reinterpret_cast<const unsigned char*>(data.data()), data.length());
411 } 410 }
412 } 411 }
413 412
414 return bytes; 413 return bytes;
415 } 414 }
416 415
417 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { 416 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const {
418 return GetRawDataResourceForScale(resource_id, ui::SCALE_FACTOR_NONE); 417 return GetRawDataResourceForScale(resource_id, ui::SCALE_FACTOR_NONE);
419 } 418 }
420 419
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 // static 798 // static
800 bool ResourceBundle::DecodePNG(const unsigned char* buf, 799 bool ResourceBundle::DecodePNG(const unsigned char* buf,
801 size_t size, 800 size_t size,
802 SkBitmap* bitmap, 801 SkBitmap* bitmap,
803 bool* fell_back_to_1x) { 802 bool* fell_back_to_1x) {
804 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 803 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
805 return gfx::PNGCodec::Decode(buf, size, bitmap); 804 return gfx::PNGCodec::Decode(buf, size, bitmap);
806 } 805 }
807 806
808 } // namespace ui 807 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/data_pack.cc ('k') | ui/base/resource/resource_bundle_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698