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

Side by Side Diff: chrome/browser/extensions/extension_action_storage_manager.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/extension_action_storage_manager.h" 5 #include "chrome/browser/extensions/extension_action_storage_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return false; 73 return false;
74 74
75 bool success = gfx::PNGCodec::Decode( 75 bool success = gfx::PNGCodec::Decode(
76 reinterpret_cast<unsigned const char*>(raw_str.data()), raw_str.size(), 76 reinterpret_cast<unsigned const char*>(raw_str.data()), raw_str.size(),
77 bitmap); 77 bitmap);
78 return success; 78 return success;
79 } 79 }
80 80
81 // Conversion function for reading/writing to storage. 81 // Conversion function for reading/writing to storage.
82 std::string BitmapToString(const SkBitmap& bitmap) { 82 std::string BitmapToString(const SkBitmap& bitmap) {
83 SkAutoLockPixels lock_image(bitmap);
84 std::vector<unsigned char> data; 83 std::vector<unsigned char> data;
85 bool success = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &data); 84 bool success = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &data);
86 if (!success) 85 if (!success)
87 return std::string(); 86 return std::string();
88 87
89 base::StringPiece raw_str( 88 base::StringPiece raw_str(
90 reinterpret_cast<const char*>(&data[0]), data.size()); 89 reinterpret_cast<const char*>(&data[0]), data.size());
91 std::string base64_str; 90 std::string base64_str;
92 base::Base64Encode(raw_str, &base64_str); 91 base::Base64Encode(raw_str, &base64_str);
93 return base64_str; 92 return base64_str;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return; 276 return;
278 277
279 SetDefaultsFromValue(dict, browser_action); 278 SetDefaultsFromValue(dict, browser_action);
280 } 279 }
281 280
282 StateStore* ExtensionActionStorageManager::GetStateStore() { 281 StateStore* ExtensionActionStorageManager::GetStateStore() {
283 return ExtensionSystem::Get(browser_context_)->state_store(); 282 return ExtensionSystem::Get(browser_context_)->state_store();
284 } 283 }
285 284
286 } // namespace extensions 285 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper_unittest.cc ('k') | chrome/browser/media/webrtc/desktop_media_list_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698