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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaDevices.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/mediastream/MediaDevices.h" 5 #include "modules/mediastream/MediaDevices.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 NavigatorUserMediaErrorCallback* errorCallback = new PromiseErrorCallback(re solver); 95 NavigatorUserMediaErrorCallback* errorCallback = new PromiseErrorCallback(re solver);
96 96
97 Document* document = toDocument(scriptState->getExecutionContext()); 97 Document* document = toDocument(scriptState->getExecutionContext());
98 UserMediaController* userMedia = UserMediaController::from(document->frame() ); 98 UserMediaController* userMedia = UserMediaController::from(document->frame() );
99 if (!userMedia) 99 if (!userMedia)
100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "No media device controller available; is this a detac hed window?")); 100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "No media device controller available; is this a detac hed window?"));
101 101
102 MediaErrorState errorState; 102 MediaErrorState errorState;
103 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op tions, successCallback, errorCallback, errorState); 103 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op tions, successCallback, errorCallback, errorState);
104 if (!request) { 104 if (!request) {
105 ASSERT(errorState.hadException()); 105 DCHECK(errorState.hadException());
106 if (errorState.canGenerateException()) { 106 if (errorState.canGenerateException()) {
107 errorState.raiseException(exceptionState); 107 errorState.raiseException(exceptionState);
108 return exceptionState.reject(scriptState); 108 return exceptionState.reject(scriptState);
109 } 109 }
110 ScriptPromise rejectedPromise = resolver->promise(); 110 ScriptPromise rejectedPromise = resolver->promise();
111 resolver->reject(errorState.createError()); 111 resolver->reject(errorState.createError());
112 return rejectedPromise; 112 return rejectedPromise;
113 } 113 }
114 114
115 String errorMessage; 115 String errorMessage;
116 if (!request->isSecureContextUse(errorMessage)) { 116 if (!request->isSecureContextUse(errorMessage)) {
117 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, errorMessage)); 117 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, errorMessage));
118 } 118 }
119 119
120 request->start(); 120 request->start();
121 return resolver->promise(); 121 return resolver->promise();
122 } 122 }
123 123
124 } // namespace blink 124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698