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

Side by Side Diff: media/blink/encrypted_media_player_support.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
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 "media/blink/encrypted_media_player_support.h" 5 #include "media/blink/encrypted_media_player_support.h"
6 6
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 20 matching lines...) Expand all
31 31
32 #define BIND_TO_RENDER_LOOP1(function, arg1) \ 32 #define BIND_TO_RENDER_LOOP1(function, arg1) \
33 (BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) 33 (BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1)))
34 34
35 // Prefix for histograms related to Encrypted Media Extensions. 35 // Prefix for histograms related to Encrypted Media Extensions.
36 static const char* kMediaEme = "Media.EME."; 36 static const char* kMediaEme = "Media.EME.";
37 37
38 // Convert a WebString to ASCII, falling back on an empty string in the case 38 // Convert a WebString to ASCII, falling back on an empty string in the case
39 // of a non-ASCII string. 39 // of a non-ASCII string.
40 static std::string ToASCIIOrEmpty(const WebString& string) { 40 static std::string ToASCIIOrEmpty(const WebString& string) {
41 return base::IsStringASCII(string) ? base::UTF16ToASCII(string) 41 return base::IsStringASCII(string)
42 : std::string(); 42 ? base::UTF16ToASCII(base::StringPiece16(string))
43 : std::string();
43 } 44 }
44 45
45 // Helper functions to report media EME related stats to UMA. They follow the 46 // Helper functions to report media EME related stats to UMA. They follow the
46 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and 47 // convention of more commonly used macros UMA_HISTOGRAM_ENUMERATION and
47 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is 48 // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is
48 // that UMA_* macros require the names to be constant throughout the process' 49 // that UMA_* macros require the names to be constant throughout the process'
49 // lifetime. 50 // lifetime.
50 static void EmeUMAHistogramEnumeration(const std::string& key_system, 51 static void EmeUMAHistogramEnumeration(const std::string& key_system,
51 const std::string& method, 52 const std::string& method,
52 int sample, 53 int sample,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 319
319 client_->keyMessage( 320 client_->keyMessage(
320 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), 321 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)),
321 WebString::fromUTF8(session_id), 322 WebString::fromUTF8(session_id),
322 message.empty() ? NULL : &message[0], 323 message.empty() ? NULL : &message[0],
323 base::saturated_cast<unsigned int>(message.size()), 324 base::saturated_cast<unsigned int>(message.size()),
324 destination_url); 325 destination_url);
325 } 326 }
326 327
327 } // namespace media 328 } // namespace media
OLDNEW
« no previous file with comments | « content/renderer/speech_recognition_dispatcher.cc ('k') | media/blink/key_system_config_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698