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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp

Issue 1862163002: WebKit MediaStream cleanup: ASSERT-->DCHECK and ASSERT_NOT_REACHED-->NOTREACHED etc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted CHECK --> RELEASE_ASSERT and added TODO Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 bool MediaErrorState::canGenerateException() 74 bool MediaErrorState::canGenerateException()
75 { 75 {
76 return m_errorType == TypeError || m_errorType == DOMException; 76 return m_errorType == TypeError || m_errorType == DOMException;
77 } 77 }
78 78
79 void MediaErrorState::raiseException(ExceptionState& target) 79 void MediaErrorState::raiseException(ExceptionState& target)
80 { 80 {
81 switch (m_errorType) { 81 switch (m_errorType) {
82 case NoError: 82 case NoError:
83 ASSERT_NOT_REACHED(); 83 NOTREACHED();
84 break; 84 break;
85 case TypeError: 85 case TypeError:
86 target.throwTypeError(m_message); 86 target.throwTypeError(m_message);
87 break; 87 break;
88 case DOMException: 88 case DOMException:
89 target.throwDOMException(m_code, m_message); 89 target.throwDOMException(m_code, m_message);
90 break; 90 break;
91 case ConstraintError: 91 case ConstraintError:
92 // This is for the cases where we can't pass back a 92 // This is for the cases where we can't pass back a
93 // NavigatorUserMediaError. 93 // NavigatorUserMediaError.
94 // So far, we have this in the constructor of RTCPeerConnection, 94 // So far, we have this in the constructor of RTCPeerConnection,
95 // which is due to be deprecated. 95 // which is due to be deprecated.
96 // TODO(hta): Remove this code. https://crbug.com/576581 96 // TODO(hta): Remove this code. https://crbug.com/576581
97 target.throwDOMException(NotSupportedError, "Unsatisfiable constraint " + m_constraint); 97 target.throwDOMException(NotSupportedError, "Unsatisfiable constraint " + m_constraint);
98 break; 98 break;
99 default: 99 default:
100 ASSERT_NOT_REACHED(); 100 NOTREACHED();
101 } 101 }
102 } 102 }
103 103
104 String MediaErrorState::getErrorMessage() 104 String MediaErrorState::getErrorMessage()
105 { 105 {
106 switch (m_errorType) { 106 switch (m_errorType) {
107 case NoError: 107 case NoError:
108 ASSERT_NOT_REACHED(); 108 NOTREACHED();
109 break; 109 break;
110 case TypeError: 110 case TypeError:
111 case DOMException: 111 case DOMException:
112 return m_message; 112 return m_message;
113 case ConstraintError: 113 case ConstraintError:
114 // This is for the cases where we can't pass back a 114 // This is for the cases where we can't pass back a
115 // NavigatorUserMediaError. 115 // NavigatorUserMediaError.
116 // So far, we have this in the constructor of RTCPeerConnection, 116 // So far, we have this in the constructor of RTCPeerConnection,
117 // which is due to be deprecated. 117 // which is due to be deprecated.
118 // TODO(hta): Remove this code. https://crbug.com/576581 118 // TODO(hta): Remove this code. https://crbug.com/576581
119 return "Unsatisfiable constraint " + m_constraint; 119 return "Unsatisfiable constraint " + m_constraint;
120 default: 120 default:
121 ASSERT_NOT_REACHED(); 121 NOTREACHED();
122 } 122 }
123 123
124 return String(); 124 return String();
125 } 125 }
126 126
127 NavigatorUserMediaError* MediaErrorState::createError() 127 NavigatorUserMediaError* MediaErrorState::createError()
128 { 128 {
129 ASSERT(m_errorType == ConstraintError); 129 DCHECK(m_errorType == ConstraintError);
130 return NavigatorUserMediaError::create(NavigatorUserMediaError::NameConstrai ntNotSatisfied, m_message, m_constraint); 130 return NavigatorUserMediaError::create(NavigatorUserMediaError::NameConstrai ntNotSatisfied, m_message, m_constraint);
131 } 131 }
132 132
133 133
134 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698