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

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

Issue 2342953002: Update EME errors to use TypeError (Closed)
Patch Set: V8ThrowException Created 4 years, 3 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/cdm_result_promise_helper.h" 5 #include "media/blink/cdm_result_promise_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 blink::WebContentDecryptionModuleException ConvertCdmException( 34 blink::WebContentDecryptionModuleException ConvertCdmException(
35 MediaKeys::Exception exception_code) { 35 MediaKeys::Exception exception_code) {
36 switch (exception_code) { 36 switch (exception_code) {
37 case MediaKeys::NOT_SUPPORTED_ERROR: 37 case MediaKeys::NOT_SUPPORTED_ERROR:
38 return blink::WebContentDecryptionModuleExceptionNotSupportedError; 38 return blink::WebContentDecryptionModuleExceptionNotSupportedError;
39 case MediaKeys::INVALID_STATE_ERROR: 39 case MediaKeys::INVALID_STATE_ERROR:
40 return blink::WebContentDecryptionModuleExceptionInvalidStateError; 40 return blink::WebContentDecryptionModuleExceptionInvalidStateError;
41 case MediaKeys::INVALID_ACCESS_ERROR: 41 case MediaKeys::INVALID_ACCESS_ERROR:
42 return blink::WebContentDecryptionModuleExceptionInvalidAccessError; 42 // TODO(jrummell): Since InvalidAccess is not returned, thus should be
43 // renamed to TYPE_ERROR. http://crbug.com/570216#c11.
44 return blink::WebContentDecryptionModuleExceptionTypeError;
43 case MediaKeys::QUOTA_EXCEEDED_ERROR: 45 case MediaKeys::QUOTA_EXCEEDED_ERROR:
44 return blink::WebContentDecryptionModuleExceptionQuotaExceededError; 46 return blink::WebContentDecryptionModuleExceptionQuotaExceededError;
45 case MediaKeys::UNKNOWN_ERROR: 47 case MediaKeys::UNKNOWN_ERROR:
46 return blink::WebContentDecryptionModuleExceptionUnknownError; 48 return blink::WebContentDecryptionModuleExceptionUnknownError;
47 case MediaKeys::CLIENT_ERROR: 49 case MediaKeys::CLIENT_ERROR:
48 return blink::WebContentDecryptionModuleExceptionClientError;
49 case MediaKeys::OUTPUT_ERROR: 50 case MediaKeys::OUTPUT_ERROR:
50 return blink::WebContentDecryptionModuleExceptionOutputError; 51 // These are deprecated, and should be removed.
52 // http://crbug.com/570216#c11.
53 break;
51 } 54 }
52 NOTREACHED(); 55 NOTREACHED();
53 return blink::WebContentDecryptionModuleExceptionUnknownError; 56 return blink::WebContentDecryptionModuleExceptionUnknownError;
54 } 57 }
55 58
56 void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) { 59 void ReportCdmResultUMA(const std::string& uma_name, CdmResultForUMA result) {
57 if (uma_name.empty()) 60 if (uma_name.empty())
58 return; 61 return;
59 62
60 base::LinearHistogram::FactoryGet( 63 base::LinearHistogram::FactoryGet(
61 uma_name, 64 uma_name,
62 1, 65 1,
63 NUM_RESULT_CODES, 66 NUM_RESULT_CODES,
64 NUM_RESULT_CODES + 1, 67 NUM_RESULT_CODES + 1,
65 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result); 68 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result);
66 } 69 }
67 70
68 } // namespace media 71 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698