| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 29 matching lines...) Expand all Loading... |
| 40 #include "modules/peerconnection/RTCIceCandidateInit.h" | 40 #include "modules/peerconnection/RTCIceCandidateInit.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 RTCIceCandidate* RTCIceCandidate::create( | 44 RTCIceCandidate* RTCIceCandidate::create( |
| 45 ExecutionContext* context, | 45 ExecutionContext* context, |
| 46 const RTCIceCandidateInit& candidateInit, | 46 const RTCIceCandidateInit& candidateInit, |
| 47 ExceptionState& exceptionState) { | 47 ExceptionState& exceptionState) { |
| 48 if (!candidateInit.hasCandidate() || !candidateInit.candidate().length()) { | 48 if (!candidateInit.hasCandidate() || !candidateInit.candidate().length()) { |
| 49 exceptionState.throwDOMException( | 49 exceptionState.throwDOMException( |
| 50 TypeMismatchError, ExceptionMessages::incorrectPropertyType( | 50 TypeMismatchError, |
| 51 "candidate", "is not a string, or is empty.")); | 51 ExceptionMessages::incorrectPropertyType( |
| 52 "candidate", "is not a string, or is empty.")); |
| 52 return nullptr; | 53 return nullptr; |
| 53 } | 54 } |
| 54 | 55 |
| 55 String sdpMid; | 56 String sdpMid; |
| 56 if (candidateInit.hasSdpMid()) | 57 if (candidateInit.hasSdpMid()) |
| 57 sdpMid = candidateInit.sdpMid(); | 58 sdpMid = candidateInit.sdpMid(); |
| 58 | 59 |
| 59 // TODO(guidou): Change default value to -1. crbug.com/614958. | 60 // TODO(guidou): Change default value to -1. crbug.com/614958. |
| 60 unsigned short sdpMLineIndex = 0; | 61 unsigned short sdpMLineIndex = 0; |
| 61 if (candidateInit.hasSdpMLineIndex()) | 62 if (candidateInit.hasSdpMLineIndex()) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 ScriptValue RTCIceCandidate::toJSONForBinding(ScriptState* scriptState) { | 106 ScriptValue RTCIceCandidate::toJSONForBinding(ScriptState* scriptState) { |
| 106 V8ObjectBuilder result(scriptState); | 107 V8ObjectBuilder result(scriptState); |
| 107 result.addString("candidate", m_webCandidate.candidate()); | 108 result.addString("candidate", m_webCandidate.candidate()); |
| 108 result.addString("sdpMid", m_webCandidate.sdpMid()); | 109 result.addString("sdpMid", m_webCandidate.sdpMid()); |
| 109 result.addNumber("sdpMLineIndex", m_webCandidate.sdpMLineIndex()); | 110 result.addNumber("sdpMLineIndex", m_webCandidate.sdpMLineIndex()); |
| 110 return result.scriptValue(); | 111 return result.scriptValue(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |