Index: content/renderer/media/cdm_result_promise.h |
diff --git a/content/renderer/media/cdm_result_promise.h b/content/renderer/media/cdm_result_promise.h |
index 39bcc0d0e7f1962130019fc5f61a7b22579f2e1d..f1f99196d551ae945b1878fce03cd97d22b4fa62 100644 |
--- a/content/renderer/media/cdm_result_promise.h |
+++ b/content/renderer/media/cdm_result_promise.h |
@@ -13,6 +13,19 @@ |
namespace content { |
+// A superset of media::MediaKeys::Exception for UMA reporting. |
+enum ResultCodeForUMA { |
+ SUCCESS, |
xhwang
2014/09/29 18:32:58
Assign numbers to these values to make sure they m
jrummell
2014/09/29 22:08:38
Done.
|
+ NOT_SUPPORTED_ERROR, |
+ INVALID_STATE_ERROR, |
+ INVALID_ACCESS_ERROR, |
+ QUOTA_EXCEEDED_ERROR, |
+ UNKNOWN_ERROR, |
+ CLIENT_ERROR, |
+ OUTPUT_ERROR, |
+ NUM_RESULT_CODES |
+}; |
+ |
// Used to convert a WebContentDecryptionModuleResult into a CdmPromise so that |
// it can be passed through Chromium. When CdmPromise::resolve(T) is called, |
// OnResolve(T) will be called and will call the appropriate complete...() |
@@ -24,22 +37,29 @@ namespace content { |
template <typename T> |
class CdmResultPromise : public media::CdmPromiseTemplate<T> { |
public: |
- explicit CdmResultPromise( |
- const blink::WebContentDecryptionModuleResult& result); |
CdmResultPromise(const blink::WebContentDecryptionModuleResult& result, |
const std::string& uma_name); |
virtual ~CdmResultPromise(); |
+ virtual void resolve(const T& result) OVERRIDE; |
xhwang
2014/09/29 18:32:58
// CdmPromiseTemplate<T> implementation.
jrummell
2014/09/29 22:08:38
Done.
|
+ virtual void reject(media::MediaKeys::Exception exception_code, |
+ uint32 system_code, |
+ const std::string& error_message) OVERRIDE; |
+ |
protected: |
- // OnResolve() is virtual as it may need special handling in derived classes. |
- virtual void OnResolve(const T& result); |
- void OnReject(media::MediaKeys::Exception exception_code, |
- uint32 system_code, |
- const std::string& error_message); |
+ // Called by all resolve()/reject() methods to report the UMA result if |
ddorwin
2014/09/26 22:40:00
// All implementations must call this method in re
jrummell
2014/09/29 22:08:38
Removed.
|
+ // applicable, and update |is_pending_|. |
+ void ReportResultToUMA(ResultCodeForUMA result); |
blink::WebContentDecryptionModuleResult web_cdm_result_; |
private: |
+ // UMA name to report result to. |
+ std::string uma_name_; |
+ |
+ // Keep track of whether the promise hasn't been resolved or rejected yet. |
+ bool is_pending_; |
+ |
DISALLOW_COPY_AND_ASSIGN(CdmResultPromise); |
}; |
@@ -47,21 +67,28 @@ class CdmResultPromise : public media::CdmPromiseTemplate<T> { |
template <> |
class CdmResultPromise<void> : public media::CdmPromiseTemplate<void> { |
public: |
- explicit CdmResultPromise( |
- const blink::WebContentDecryptionModuleResult& result); |
CdmResultPromise(const blink::WebContentDecryptionModuleResult& result, |
const std::string& uma_name); |
virtual ~CdmResultPromise(); |
- protected: |
- virtual void OnResolve(); |
- void OnReject(media::MediaKeys::Exception exception_code, |
- uint32 system_code, |
- const std::string& error_message); |
+ virtual void resolve() OVERRIDE; |
xhwang
2014/09/29 18:32:58
// CdmPromiseTemplate<void> implementation.
jrummell
2014/09/29 22:08:38
Done.
|
+ virtual void reject(media::MediaKeys::Exception exception_code, |
+ uint32 system_code, |
+ const std::string& error_message) OVERRIDE; |
+ |
+ private: |
+ // Called by all resolve()/reject() methods to report the UMA result if |
ddorwin
2014/09/26 22:40:00
ditto
jrummell
2014/09/29 22:08:38
Done.
|
+ // applicable, and update |is_pending_|. |
+ void ReportResultToUMA(ResultCodeForUMA result); |
blink::WebContentDecryptionModuleResult web_cdm_result_; |
- private: |
+ // UMA name to report result to. |
ddorwin
2014/09/26 22:40:00
Kind of sad that we have to implement these member
jrummell
2014/09/29 22:08:38
Acknowledged.
|
+ std::string uma_name_; |
+ |
+ // Keep track of whether the promise hasn't been resolved or rejected yet. |
+ bool is_pending_; |
+ |
DISALLOW_COPY_AND_ASSIGN(CdmResultPromise); |
}; |