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

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

Issue 1318393002: Refactor "track options" to be a dictionary. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Used MediaTrackConstraintSet in union types Created 5 years, 2 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
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 25 matching lines...) Expand all
36 #include "bindings/core/v8/Dictionary.h" 36 #include "bindings/core/v8/Dictionary.h"
37 #include "bindings/core/v8/ExceptionMessages.h" 37 #include "bindings/core/v8/ExceptionMessages.h"
38 #include "bindings/core/v8/ExceptionState.h" 38 #include "bindings/core/v8/ExceptionState.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/ExceptionCode.h" 40 #include "core/dom/ExceptionCode.h"
41 #include "core/dom/SpaceSplitString.h" 41 #include "core/dom/SpaceSplitString.h"
42 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
43 #include "modules/mediastream/MediaConstraintsImpl.h" 43 #include "modules/mediastream/MediaConstraintsImpl.h"
44 #include "modules/mediastream/MediaStream.h" 44 #include "modules/mediastream/MediaStream.h"
45 #include "modules/mediastream/MediaStreamConstraints.h" 45 #include "modules/mediastream/MediaStreamConstraints.h"
46 #include "modules/mediastream/MediaTrackConstraintSet.h"
46 #include "modules/mediastream/UserMediaController.h" 47 #include "modules/mediastream/UserMediaController.h"
47 #include "platform/mediastream/MediaStreamCenter.h" 48 #include "platform/mediastream/MediaStreamCenter.h"
48 #include "platform/mediastream/MediaStreamDescriptor.h" 49 #include "platform/mediastream/MediaStreamDescriptor.h"
49 50
50 namespace blink { 51 namespace blink {
51 52
52 static WebMediaConstraints parseOptions(const BooleanOrDictionary& options, Exce ptionState& exceptionState) 53 static WebMediaConstraints parseOptions(const BooleanOrMediaTrackConstraintSet& options, ExceptionState& exceptionState)
53 { 54 {
54 WebMediaConstraints constraints; 55 WebMediaConstraints constraints;
55 56
56 Dictionary constraintsDictionary; 57 Dictionary constraintsDictionary;
57 if (options.isDictionary()) { 58 if (options.isNull()) {
58 constraints = MediaConstraintsImpl::create(options.getAsDictionary(), ex ceptionState); 59 // Do nothing.
Guido Urdaneta 2015/10/05 12:34:12 Is this possible? Should there be a NOTREACHED her
hta - Chromium 2015/10/05 12:54:01 It is possible. When you call getUserMedia({video:
60 } else if (options.isMediaTrackConstraintSet()) {
61 constraints = MediaConstraintsImpl::create(options.getAsMediaTrackConstr aintSet(), exceptionState);
59 } else { 62 } else {
63 ASSERT(options.isBoolean());
60 if (options.getAsBoolean()) { 64 if (options.getAsBoolean()) {
61 constraints = MediaConstraintsImpl::create(); 65 constraints = MediaConstraintsImpl::create();
62 } 66 }
63 } 67 }
64 68
65 return constraints; 69 return constraints;
66 } 70 }
67 71
68 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC ontroller* controller, const MediaStreamConstraints& options, NavigatorUserMedia SuccessCallback* successCallback, NavigatorUserMediaErrorCallback* errorCallback , ExceptionState& exceptionState) 72 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC ontroller* controller, const MediaStreamConstraints& options, NavigatorUserMedia SuccessCallback* successCallback, NavigatorUserMediaErrorCallback* errorCallback , ExceptionState& exceptionState)
69 { 73 {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 208
205 DEFINE_TRACE(UserMediaRequest) 209 DEFINE_TRACE(UserMediaRequest)
206 { 210 {
207 visitor->trace(m_controller); 211 visitor->trace(m_controller);
208 visitor->trace(m_successCallback); 212 visitor->trace(m_successCallback);
209 visitor->trace(m_errorCallback); 213 visitor->trace(m_errorCallback);
210 ContextLifecycleObserver::trace(visitor); 214 ContextLifecycleObserver::trace(visitor);
211 } 215 }
212 216
213 } // namespace blink 217 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698