diff options
author | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-25 22:12:50 +0000 |
---|---|---|
committer | ddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-25 22:12:50 +0000 |
commit | f3a1d40d66739544a90212f92dac4080c3f3df71 (patch) | |
tree | 0dce46a8022914f08528623031414904313bec55 /webkit | |
parent | d4c5e4b4ec1706cf6981aafcf4aa3b7c3a8e08f5 (diff) | |
download | chromium_src-f3a1d40d66739544a90212f92dac4080c3f3df71.zip chromium_src-f3a1d40d66739544a90212f92dac4080c3f3df71.tar.gz chromium_src-f3a1d40d66739544a90212f92dac4080c3f3df71.tar.bz2 |
Remove unused variant of KeySystemNameForUMA().
Eliminate the unnecessary conversions from WebString to std::string, and eliminate the subsequently unused
std::string version.
Review URL: https://chromiumcodereview.appspot.com/17607003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/renderer/media/crypto/key_systems.cc | 6 | ||||
-rw-r--r-- | webkit/renderer/media/crypto/key_systems.h | 1 | ||||
-rw-r--r-- | webkit/renderer/media/crypto/key_systems_info.cc | 3 | ||||
-rw-r--r-- | webkit/renderer/media/crypto/key_systems_info.h | 6 | ||||
-rw-r--r-- | webkit/renderer/media/crypto/key_systems_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/renderer/media/webmediaplayer_impl.cc | 12 |
6 files changed, 14 insertions, 28 deletions
diff --git a/webkit/renderer/media/crypto/key_systems.cc b/webkit/renderer/media/crypto/key_systems.cc index 2d056b3..ca26ae1 100644 --- a/webkit/renderer/media/crypto/key_systems.cc +++ b/webkit/renderer/media/crypto/key_systems.cc @@ -142,12 +142,8 @@ bool IsSupportedKeySystemWithMediaMimeType( mime_type, codecs, key_system); } -std::string KeySystemNameForUMA(const std::string& key_system) { - return KeySystemNameForUMAGeneric(key_system); -} - std::string KeySystemNameForUMA(const WebKit::WebString& key_system) { - return KeySystemNameForUMAGeneric(std::string(key_system.utf8().data())); + return KeySystemNameForUMAInternal(key_system); } bool CanUseAesDecryptor(const std::string& key_system) { diff --git a/webkit/renderer/media/crypto/key_systems.h b/webkit/renderer/media/crypto/key_systems.h index a2e439f..2aa9974 100644 --- a/webkit/renderer/media/crypto/key_systems.h +++ b/webkit/renderer/media/crypto/key_systems.h @@ -28,7 +28,6 @@ bool IsSupportedKeySystemWithMediaMimeType( const std::string& key_system); // Returns a name for |key_system| suitable to UMA logging. -std::string KeySystemNameForUMA(const std::string& key_system); std::string KeySystemNameForUMA(const WebKit::WebString& key_system); // Returns whether AesDecryptor can be used for the given |key_system|. diff --git a/webkit/renderer/media/crypto/key_systems_info.cc b/webkit/renderer/media/crypto/key_systems_info.cc index bb04667..8f21b23 100644 --- a/webkit/renderer/media/crypto/key_systems_info.cc +++ b/webkit/renderer/media/crypto/key_systems_info.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "webkit/renderer/media/crypto/key_systems_info.h" +#include "third_party/WebKit/public/platform/WebString.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -144,7 +145,7 @@ bool IsCanPlayTypeSuppressed(const std::string& key_system) { return false; } -std::string KeySystemNameForUMAGeneric(const std::string& key_system) { +std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system) { if (key_system == kClearKeyKeySystem) return "ClearKey"; #if defined(WIDEVINE_CDM_AVAILABLE) diff --git a/webkit/renderer/media/crypto/key_systems_info.h b/webkit/renderer/media/crypto/key_systems_info.h index 0c499db..3567a60 100644 --- a/webkit/renderer/media/crypto/key_systems_info.h +++ b/webkit/renderer/media/crypto/key_systems_info.h @@ -9,6 +9,10 @@ #include "base/basictypes.h" +namespace WebKit { +class WebString; +} + namespace webkit_media { struct MediaFormatAndKeySystem { @@ -61,7 +65,7 @@ bool IsCanPlayTypeSuppressed(const std::string& key_system); // Returns the name that UMA will use for the given |key_system|. // This function can be called frequently. Hence this function should be // implemented not to impact performance. -std::string KeySystemNameForUMAGeneric(const std::string& key_system); +std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system); // Returns whether built-in AesDecryptor can be used for the given |key_system|. bool CanUseBuiltInAesDecryptor(const std::string& key_system); diff --git a/webkit/renderer/media/crypto/key_systems_unittest.cc b/webkit/renderer/media/crypto/key_systems_unittest.cc index 98cc950..f030bdd4 100644 --- a/webkit/renderer/media/crypto/key_systems_unittest.cc +++ b/webkit/renderer/media/crypto/key_systems_unittest.cc @@ -169,7 +169,6 @@ TEST_F(KeySystemsTest, ClearKey_Basic) { EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( "video/webm", no_codecs(), "org.w3.clearkey")); - EXPECT_STREQ("ClearKey", KeySystemNameForUMA(std::string(kClearKey)).c_str()); EXPECT_STREQ("ClearKey", KeySystemNameForUMA(WebString::fromUTF8(kClearKey)).c_str()); @@ -189,8 +188,6 @@ TEST_F(KeySystemsTest, ClearKey_Parent) { // The parent is not supported for most things. EXPECT_STREQ("Unknown", - KeySystemNameForUMA(std::string(kClearKeyParent)).c_str()); - EXPECT_STREQ("Unknown", KeySystemNameForUMA(WebString::fromUTF8(kClearKeyParent)).c_str()); EXPECT_FALSE(CanUseAesDecryptor(kClearKeyParent)); #if defined(ENABLE_PEPPER_CDMS) @@ -355,9 +352,6 @@ TEST_F(KeySystemsTest, ExternalClearKey_Basic) { // External Clear Key does not have a UMA name because it is for testing. EXPECT_STREQ( "Unknown", - KeySystemNameForUMA(std::string(kExternalClearKey)).c_str()); - EXPECT_STREQ( - "Unknown", KeySystemNameForUMA(WebString::fromUTF8(kExternalClearKey)).c_str()); EXPECT_FALSE(CanUseAesDecryptor(kExternalClearKey)); @@ -377,9 +371,6 @@ TEST_F(KeySystemsTest, ExternalClearKey_Parent) { "video/webm", no_codecs(), kExternalClearKeyParent)); // The parent is not supported for most things. - EXPECT_STREQ( - "Unknown", - KeySystemNameForUMA(std::string(kExternalClearKeyParent)).c_str()); EXPECT_STREQ("Unknown", KeySystemNameForUMA( WebString::fromUTF8(kExternalClearKeyParent)).c_str()); @@ -557,9 +548,6 @@ TEST_F(KeySystemsTest, Widevine_Basic) { #endif EXPECT_STREQ( kWidevineUmaName, - KeySystemNameForUMA(std::string(kWidevineAlpha)).c_str()); - EXPECT_STREQ( - kWidevineUmaName, KeySystemNameForUMA(WebString::fromUTF8(kWidevineAlpha)).c_str()); EXPECT_FALSE(CanUseAesDecryptor(kWidevineAlpha)); @@ -588,8 +576,6 @@ TEST_F(KeySystemsTest, Widevine_Parent) { // The parent is not supported for most things. EXPECT_STREQ("Unknown", - KeySystemNameForUMA(std::string(kWidevineParent)).c_str()); - EXPECT_STREQ("Unknown", KeySystemNameForUMA(WebString::fromUTF8(kWidevineParent)).c_str()); EXPECT_FALSE(CanUseAesDecryptor(kWidevineParent)); #if defined(ENABLE_PEPPER_CDMS) diff --git a/webkit/renderer/media/webmediaplayer_impl.cc b/webkit/renderer/media/webmediaplayer_impl.cc index 25c9c5a..14b3129 100644 --- a/webkit/renderer/media/webmediaplayer_impl.cc +++ b/webkit/renderer/media/webmediaplayer_impl.cc @@ -620,7 +620,7 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( // UMA_HISTOGRAM_COUNTS. The reason that we cannot use those macros directly is // that UMA_* macros require the names to be constant throughout the process' // lifetime. -static void EmeUMAHistogramEnumeration(const std::string& key_system, +static void EmeUMAHistogramEnumeration(const WebKit::WebString& key_system, const std::string& method, int sample, int boundary_value) { @@ -630,7 +630,7 @@ static void EmeUMAHistogramEnumeration(const std::string& key_system, base::Histogram::kUmaTargetedHistogramFlag)->Add(sample); } -static void EmeUMAHistogramCounts(const std::string& key_system, +static void EmeUMAHistogramCounts(const WebKit::WebString& key_system, const std::string& method, int sample) { // Use the same parameters as UMA_HISTOGRAM_COUNTS. @@ -671,7 +671,7 @@ static void ReportMediaKeyExceptionToUMA( MediaKeyException result_id = MediaKeyExceptionForUMA(e); DCHECK_NE(result_id, kUnknownResultId) << e; EmeUMAHistogramEnumeration( - key_system.utf8(), method, result_id, kMaxMediaKeyException); + key_system, method, result_id, kMaxMediaKeyException); } WebMediaPlayer::MediaKeyException @@ -844,7 +844,7 @@ void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { SetNetworkState(PipelineErrorToNetworkState(error)); if (error == media::PIPELINE_ERROR_DECRYPT) - EmeUMAHistogramCounts(current_key_system_.utf8(), "DecryptError", 1); + EmeUMAHistogramCounts(current_key_system_, "DecryptError", 1); // Repaint to trigger UI update. Repaint(); @@ -887,7 +887,7 @@ void WebMediaPlayerImpl::OnDemuxerOpened( void WebMediaPlayerImpl::OnKeyAdded(const std::string& session_id) { DCHECK(main_loop_->BelongsToCurrentThread()); - EmeUMAHistogramCounts(current_key_system_.utf8(), "KeyAdded", 1); + EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); GetClient()->keyAdded(current_key_system_, WebString::fromUTF8(session_id)); } @@ -936,7 +936,7 @@ void WebMediaPlayerImpl::OnKeyError(const std::string& session_id, int system_code) { DCHECK(main_loop_->BelongsToCurrentThread()); - EmeUMAHistogramEnumeration(current_key_system_.utf8(), "KeyError", + EmeUMAHistogramEnumeration(current_key_system_, "KeyError", error_code, media::MediaKeys::kMaxKeyError); GetClient()->keyError( |