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

Side by Side Diff: chrome/utility/extensions/extensions_handler.cc

Issue 931993002: Make image_decoder a Leaky LazyInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename instance_ to image_decoder_instance_ for mac linker Created 5 years, 9 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/utility/extensions/extensions_handler.h" 5 #include "chrome/utility/extensions/extensions_handler.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/common/chrome_utility_messages.h" 9 #include "chrome/common/chrome_utility_messages.h"
10 #include "chrome/common/extensions/chrome_extensions_client.h" 10 #include "chrome/common/extensions/chrome_extensions_client.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 ReleaseProcessIfNeeded(); 123 ReleaseProcessIfNeeded();
124 } 124 }
125 125
126 void ExtensionsHandler::OnDecodeImageBase64( 126 void ExtensionsHandler::OnDecodeImageBase64(
127 const std::string& encoded_string) { 127 const std::string& encoded_string) {
128 std::string decoded_string; 128 std::string decoded_string;
129 129
130 if (!base::Base64Decode(encoded_string, &decoded_string)) { 130 if (!base::Base64Decode(encoded_string, &decoded_string)) {
131 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); 131 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(
132 chromeutility::DUMMY_IMAGE_DELEGATE_ID));
132 return; 133 return;
133 } 134 }
134 135
135 std::vector<unsigned char> decoded_vector(decoded_string.size()); 136 std::vector<unsigned char> decoded_vector(decoded_string.size());
136 for (size_t i = 0; i < decoded_string.size(); ++i) { 137 for (size_t i = 0; i < decoded_string.size(); ++i) {
137 decoded_vector[i] = static_cast<unsigned char>(decoded_string[i]); 138 decoded_vector[i] = static_cast<unsigned char>(decoded_string[i]);
138 } 139 }
139 140
140 ChromeContentUtilityClient::DecodeImageAndSend(decoded_vector, false); 141 ChromeContentUtilityClient::DecodeImageAndSend(
142 decoded_vector, false, chromeutility::DUMMY_IMAGE_DELEGATE_ID);
141 } 143 }
142 144
143 void ExtensionsHandler::OnCheckMediaFile( 145 void ExtensionsHandler::OnCheckMediaFile(
144 int64 milliseconds_of_decoding, 146 int64 milliseconds_of_decoding,
145 const IPC::PlatformFileForTransit& media_file) { 147 const IPC::PlatformFileForTransit& media_file) {
146 media::MediaFileChecker checker( 148 media::MediaFileChecker checker(
147 IPC::PlatformFileForTransitToFile(media_file)); 149 IPC::PlatformFileForTransitToFile(media_file));
148 const bool check_success = checker.Start( 150 const bool check_success = checker.Start(
149 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding)); 151 base::TimeDelta::FromMilliseconds(milliseconds_of_decoding));
150 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success)); 152 Send(new ChromeUtilityHostMsg_CheckMediaFile_Finished(check_success));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 228
227 std::string key_data; 229 std::string key_data;
228 std::string error; 230 std::string error;
229 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); 231 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error);
230 232
231 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty())); 233 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty()));
232 } 234 }
233 #endif // defined(OS_WIN) 235 #endif // defined(OS_WIN)
234 236
235 } // namespace extensions 237 } // namespace extensions
OLDNEW
« chrome/common/chrome_utility_messages.h ('K') | « chrome/utility/chrome_content_utility_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698