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

Side by Side Diff: content/renderer/media/webcontentdecryptionmodulesession_impl.cc

Issue 452643002: Add UMA reporting to CdmPromise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/webcontentdecryptionmodulesession_impl.h" 5 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "content/renderer/media/cdm_session_adapter.h" 12 #include "content/renderer/media/cdm_session_adapter.h"
13 #include "media/base/cdm_promise.h" 13 #include "media/base/cdm_promise.h"
14 #include "third_party/WebKit/public/platform/WebURL.h" 14 #include "third_party/WebKit/public/platform/WebURL.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 const char kCreateSessionUMAName[] = "CreateSession";
19
18 // For backwards compatibility with blink not using 20 // For backwards compatibility with blink not using
19 // WebContentDecryptionModuleResult, reserve an index for |outstanding_results_| 21 // WebContentDecryptionModuleResult, reserve an index for |outstanding_results_|
20 // that will not be used when adding a WebContentDecryptionModuleResult. 22 // that will not be used when adding a WebContentDecryptionModuleResult.
21 // TODO(jrummell): Remove once blink always uses 23 // TODO(jrummell): Remove once blink always uses
22 // WebContentDecryptionModuleResult. 24 // WebContentDecryptionModuleResult.
23 const uint32 kReservedIndex = 0; 25 const uint32 kReservedIndex = 0;
24 26
25 static blink::WebContentDecryptionModuleException ConvertException( 27 static blink::WebContentDecryptionModuleException ConvertException(
26 media::MediaKeys::Exception exception_code) { 28 media::MediaKeys::Exception exception_code) {
27 switch (exception_code) { 29 switch (exception_code) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos) 102 DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos)
101 << "init_data_type '" << init_data_type_as_ascii 103 << "init_data_type '" << init_data_type_as_ascii
102 << "' may be a MIME type"; 104 << "' may be a MIME type";
103 105
104 scoped_ptr<media::NewSessionCdmPromise> promise( 106 scoped_ptr<media::NewSessionCdmPromise> promise(
105 new media::NewSessionCdmPromise( 107 new media::NewSessionCdmPromise(
106 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated, 108 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated,
107 weak_ptr_factory_.GetWeakPtr(), 109 weak_ptr_factory_.GetWeakPtr(),
108 kReservedIndex), 110 kReservedIndex),
109 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError, 111 base::Bind(&WebContentDecryptionModuleSessionImpl::OnSessionError,
110 weak_ptr_factory_.GetWeakPtr()))); 112 weak_ptr_factory_.GetWeakPtr()),
113 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName));
111 adapter_->InitializeNewSession(init_data_type_as_ascii, 114 adapter_->InitializeNewSession(init_data_type_as_ascii,
112 init_data, 115 init_data,
113 init_data_length, 116 init_data_length,
114 media::MediaKeys::TEMPORARY_SESSION, 117 media::MediaKeys::TEMPORARY_SESSION,
115 promise.Pass()); 118 promise.Pass());
116 } 119 }
117 120
118 void WebContentDecryptionModuleSessionImpl::update(const uint8* response, 121 void WebContentDecryptionModuleSessionImpl::update(const uint8* response,
119 size_t response_length) { 122 size_t response_length) {
120 DCHECK(response); 123 DCHECK(response);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 << "init_data_type '" << init_data_type_as_ascii 164 << "init_data_type '" << init_data_type_as_ascii
162 << "' may be a MIME type"; 165 << "' may be a MIME type";
163 166
164 scoped_ptr<media::NewSessionCdmPromise> promise( 167 scoped_ptr<media::NewSessionCdmPromise> promise(
165 new media::NewSessionCdmPromise( 168 new media::NewSessionCdmPromise(
166 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated, 169 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionCreated,
167 weak_ptr_factory_.GetWeakPtr(), 170 weak_ptr_factory_.GetWeakPtr(),
168 result_index), 171 result_index),
169 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionError, 172 base::Bind(&WebContentDecryptionModuleSessionImpl::SessionError,
170 weak_ptr_factory_.GetWeakPtr(), 173 weak_ptr_factory_.GetWeakPtr(),
171 result_index))); 174 result_index),
175 adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName));
172 adapter_->InitializeNewSession(init_data_type_as_ascii, 176 adapter_->InitializeNewSession(init_data_type_as_ascii,
173 init_data, 177 init_data,
174 init_data_length, 178 init_data_length,
175 media::MediaKeys::TEMPORARY_SESSION, 179 media::MediaKeys::TEMPORARY_SESSION,
176 promise.Pass()); 180 promise.Pass());
177 } 181 }
178 182
179 void WebContentDecryptionModuleSessionImpl::update( 183 void WebContentDecryptionModuleSessionImpl::update(
180 const uint8* response, 184 const uint8* response,
181 size_t response_length, 185 size_t response_length,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 302
299 uint32 WebContentDecryptionModuleSessionImpl::AddResult( 303 uint32 WebContentDecryptionModuleSessionImpl::AddResult(
300 blink::WebContentDecryptionModuleResult result) { 304 blink::WebContentDecryptionModuleResult result) {
301 uint32 result_index = next_available_result_index_++; 305 uint32 result_index = next_available_result_index_++;
302 DCHECK(result_index != kReservedIndex); 306 DCHECK(result_index != kReservedIndex);
303 outstanding_results_.insert(std::make_pair(result_index, result)); 307 outstanding_results_.insert(std::make_pair(result_index, result));
304 return result_index; 308 return result_index;
305 } 309 }
306 310
307 } // namespace content 311 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698