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

Side by Side Diff: media/blink/webencryptedmediaclient_impl.cc

Issue 1259673002: Make UTF16ToASCII and UTF16TOUTF8 take a StringPiece (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « media/blink/webcontentdecryptionmodulesession_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webencryptedmediaclient_impl.h" 5 #include "webencryptedmediaclient_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const blink::WebString& error_message) { 144 const blink::WebString& error_message) {
145 request.requestNotSupported(error_message); 145 request.requestNotSupported(error_message);
146 } 146 }
147 147
148 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( 148 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter(
149 const blink::WebString& key_system) { 149 const blink::WebString& key_system) {
150 // Assumes that empty will not be found by GetKeySystemNameForUMA(). 150 // Assumes that empty will not be found by GetKeySystemNameForUMA().
151 // TODO(sandersd): Avoid doing ASCII conversion more than once. 151 // TODO(sandersd): Avoid doing ASCII conversion more than once.
152 std::string key_system_ascii; 152 std::string key_system_ascii;
153 if (base::IsStringASCII(key_system)) 153 if (base::IsStringASCII(key_system))
154 key_system_ascii = base::UTF16ToASCII(key_system); 154 key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system));
155 155
156 // Return a per-frame singleton so that UMA reports will be once-per-frame. 156 // Return a per-frame singleton so that UMA reports will be once-per-frame.
157 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); 157 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii);
158 Reporter* reporter = reporters_.get(uma_name); 158 Reporter* reporter = reporters_.get(uma_name);
159 if (!reporter) { 159 if (!reporter) {
160 reporter = new Reporter(uma_name); 160 reporter = new Reporter(uma_name);
161 reporters_.add(uma_name, make_scoped_ptr(reporter)); 161 reporters_.add(uma_name, make_scoped_ptr(reporter));
162 } 162 }
163 return reporter; 163 return reporter;
164 } 164 }
165 165
166 } // namespace media 166 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmodulesession_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698