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

Side by Side Diff: Source/modules/mediastream/UserMediaRequest.cpp

Issue 173363002: Move mediastream module to oilpan transition types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/mediastream/UserMediaRequest.h ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 else { 58 else {
59 bool mediaRequested = false; 59 bool mediaRequested = false;
60 options.get(mediaType, mediaRequested); 60 options.get(mediaType, mediaRequested);
61 if (mediaRequested) 61 if (mediaRequested)
62 constraints = MediaConstraintsImpl::create(); 62 constraints = MediaConstraintsImpl::create();
63 } 63 }
64 64
65 return constraints; 65 return constraints;
66 } 66 }
67 67
68 PassRefPtr<UserMediaRequest> UserMediaRequest::create(ExecutionContext* context, UserMediaController* controller, const Dictionary& options, PassOwnPtr<Navigato rUserMediaSuccessCallback> successCallback, PassOwnPtr<NavigatorUserMediaErrorCa llback> errorCallback, ExceptionState& exceptionState) 68 PassRefPtrWillBeRawPtr<UserMediaRequest> UserMediaRequest::create(ExecutionConte xt* context, UserMediaController* controller, const Dictionary& options, PassOwn Ptr<NavigatorUserMediaSuccessCallback> successCallback, PassOwnPtr<NavigatorUser MediaErrorCallback> errorCallback, ExceptionState& exceptionState)
69 { 69 {
70 blink::WebMediaConstraints audio = parseOptions(options, "audio", exceptionS tate); 70 blink::WebMediaConstraints audio = parseOptions(options, "audio", exceptionS tate);
71 if (exceptionState.hadException()) 71 if (exceptionState.hadException())
72 return nullptr; 72 return nullptr;
73 73
74 blink::WebMediaConstraints video = parseOptions(options, "video", exceptionS tate); 74 blink::WebMediaConstraints video = parseOptions(options, "video", exceptionS tate);
75 if (exceptionState.hadException()) 75 if (exceptionState.hadException())
76 return nullptr; 76 return nullptr;
77 77
78 if (audio.isNull() && video.isNull()) { 78 if (audio.isNull() && video.isNull()) {
79 exceptionState.throwDOMException(SyntaxError, "At least one of audio and video must be requested"); 79 exceptionState.throwDOMException(SyntaxError, "At least one of audio and video must be requested");
80 return nullptr; 80 return nullptr;
81 } 81 }
82 82
83 return adoptRef(new UserMediaRequest(context, controller, audio, video, succ essCallback, errorCallback)); 83 return adoptRefWillBeNoop(new UserMediaRequest(context, controller, audio, v ideo, successCallback, errorCallback));
84 } 84 }
85 85
86 UserMediaRequest::UserMediaRequest(ExecutionContext* context, UserMediaControlle r* controller, blink::WebMediaConstraints audio, blink::WebMediaConstraints vide o, PassOwnPtr<NavigatorUserMediaSuccessCallback> successCallback, PassOwnPtr<Nav igatorUserMediaErrorCallback> errorCallback) 86 UserMediaRequest::UserMediaRequest(ExecutionContext* context, UserMediaControlle r* controller, blink::WebMediaConstraints audio, blink::WebMediaConstraints vide o, PassOwnPtr<NavigatorUserMediaSuccessCallback> successCallback, PassOwnPtr<Nav igatorUserMediaErrorCallback> errorCallback)
87 : ContextLifecycleObserver(context) 87 : ContextLifecycleObserver(context)
88 , m_audio(audio) 88 , m_audio(audio)
89 , m_video(video) 89 , m_video(video)
90 , m_controller(controller) 90 , m_controller(controller)
91 , m_successCallback(successCallback) 91 , m_successCallback(successCallback)
92 , m_errorCallback(errorCallback) 92 , m_errorCallback(errorCallback)
93 { 93 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 { 130 {
131 if (m_controller) 131 if (m_controller)
132 m_controller->requestUserMedia(this); 132 m_controller->requestUserMedia(this);
133 } 133 }
134 134
135 void UserMediaRequest::succeed(PassRefPtr<MediaStreamDescriptor> streamDescripto r) 135 void UserMediaRequest::succeed(PassRefPtr<MediaStreamDescriptor> streamDescripto r)
136 { 136 {
137 if (!executionContext()) 137 if (!executionContext())
138 return; 138 return;
139 139
140 RefPtr<MediaStream> stream = MediaStream::create(executionContext(), streamD escriptor); 140 RefPtrWillBeRawPtr<MediaStream> stream = MediaStream::create(executionContex t(), streamDescriptor);
141 141
142 MediaStreamTrackVector audioTracks = stream->getAudioTracks(); 142 MediaStreamTrackVector audioTracks = stream->getAudioTracks();
143 for (MediaStreamTrackVector::iterator iter = audioTracks.begin(); iter != au dioTracks.end(); ++iter) { 143 for (MediaStreamTrackVector::iterator iter = audioTracks.begin(); iter != au dioTracks.end(); ++iter) {
144 (*iter)->component()->source()->setConstraints(m_audio); 144 (*iter)->component()->source()->setConstraints(m_audio);
145 } 145 }
146 146
147 MediaStreamTrackVector videoTracks = stream->getVideoTracks(); 147 MediaStreamTrackVector videoTracks = stream->getVideoTracks();
148 for (MediaStreamTrackVector::iterator iter = videoTracks.begin(); iter != vi deoTracks.end(); ++iter) { 148 for (MediaStreamTrackVector::iterator iter = videoTracks.begin(); iter != vi deoTracks.end(); ++iter) {
149 (*iter)->component()->source()->setConstraints(m_video); 149 (*iter)->component()->source()->setConstraints(m_video);
150 } 150 }
151 151
152 m_successCallback->handleEvent(stream.get()); 152 m_successCallback->handleEvent(stream.get());
153 } 153 }
154 154
155 void UserMediaRequest::failPermissionDenied(const String& message) 155 void UserMediaRequest::failPermissionDenied(const String& message)
156 { 156 {
157 if (!executionContext()) 157 if (!executionContext())
158 return; 158 return;
159 159
160 RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(Navi gatorUserMediaError::NamePermissionDenied, message, String()); 160 RefPtrWillBeRawPtr<NavigatorUserMediaError> error = NavigatorUserMediaError: :create(NavigatorUserMediaError::NamePermissionDenied, message, String());
161 m_errorCallback->handleEvent(error.get()); 161 m_errorCallback->handleEvent(error.get());
162 } 162 }
163 163
164 void UserMediaRequest::failConstraint(const String& constraintName, const String & message) 164 void UserMediaRequest::failConstraint(const String& constraintName, const String & message)
165 { 165 {
166 ASSERT(!constraintName.isEmpty()); 166 ASSERT(!constraintName.isEmpty());
167 if (!executionContext()) 167 if (!executionContext())
168 return; 168 return;
169 169
170 RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(Navi gatorUserMediaError::NameConstraintNotSatisfied, message, constraintName); 170 RefPtrWillBeRawPtr<NavigatorUserMediaError> error = NavigatorUserMediaError: :create(NavigatorUserMediaError::NameConstraintNotSatisfied, message, constraint Name);
171 m_errorCallback->handleEvent(error.get()); 171 m_errorCallback->handleEvent(error.get());
172 } 172 }
173 173
174 void UserMediaRequest::failUASpecific(const String& name, const String& message, const String& constraintName) 174 void UserMediaRequest::failUASpecific(const String& name, const String& message, const String& constraintName)
175 { 175 {
176 ASSERT(!name.isEmpty()); 176 ASSERT(!name.isEmpty());
177 if (!executionContext()) 177 if (!executionContext())
178 return; 178 return;
179 179
180 RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(name , message, constraintName); 180 RefPtrWillBeRawPtr<NavigatorUserMediaError> error = NavigatorUserMediaError: :create(name, message, constraintName);
181 m_errorCallback->handleEvent(error.get()); 181 m_errorCallback->handleEvent(error.get());
182 } 182 }
183 183
184 void UserMediaRequest::contextDestroyed() 184 void UserMediaRequest::contextDestroyed()
185 { 185 {
186 RefPtr<UserMediaRequest> protect(this); 186 RefPtrWillBeRawPtr<UserMediaRequest> protect(this);
187 187
188 if (m_controller) { 188 if (m_controller) {
189 m_controller->cancelUserMediaRequest(this); 189 m_controller->cancelUserMediaRequest(this);
190 m_controller = 0; 190 m_controller = 0;
191 } 191 }
192 192
193 ContextLifecycleObserver::contextDestroyed(); 193 ContextLifecycleObserver::contextDestroyed();
194 } 194 }
195 195
196 } // namespace WebCore 196 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/UserMediaRequest.h ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698