| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "modules/mediastream/RTCIceCandidate.h" | 33 #include "modules/mediastream/RTCIceCandidate.h" |
| 34 | 34 |
| 35 #include "bindings/v8/Dictionary.h" | 35 #include "bindings/v8/Dictionary.h" |
| 36 #include "bindings/v8/ExceptionMessages.h" | 36 #include "bindings/v8/ExceptionMessages.h" |
| 37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 PassRefPtr<RTCIceCandidate> RTCIceCandidate::create(const Dictionary& dictionary
, ExceptionState& exceptionState) | 42 DEFINE_GC_INFO(RTCIceCandidate); |
| 43 |
| 44 PassRefPtrWillBeRawPtr<RTCIceCandidate> RTCIceCandidate::create(const Dictionary
& dictionary, ExceptionState& exceptionState) |
| 43 { | 45 { |
| 44 String candidate; | 46 String candidate; |
| 45 bool ok = dictionary.get("candidate", candidate); | 47 bool ok = dictionary.get("candidate", candidate); |
| 46 if (!ok || !candidate.length()) { | 48 if (!ok || !candidate.length()) { |
| 47 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::i
ncorrectPropertyType("candidate", "is not a string, or is empty.")); | 49 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::i
ncorrectPropertyType("candidate", "is not a string, or is empty.")); |
| 48 return 0; | 50 return 0; |
| 49 } | 51 } |
| 50 | 52 |
| 51 String sdpMid; | 53 String sdpMid; |
| 52 dictionary.get("sdpMid", sdpMid); | 54 dictionary.get("sdpMid", sdpMid); |
| 53 | 55 |
| 54 unsigned short sdpMLineIndex = 0; | 56 unsigned short sdpMLineIndex = 0; |
| 55 dictionary.get("sdpMLineIndex", sdpMLineIndex); | 57 dictionary.get("sdpMLineIndex", sdpMLineIndex); |
| 56 | 58 |
| 57 return adoptRef(new RTCIceCandidate(blink::WebRTCICECandidate(candidate, sdp
Mid, sdpMLineIndex))); | 59 return adoptRefWillBeNoop(new RTCIceCandidate(blink::WebRTCICECandidate(cand
idate, sdpMid, sdpMLineIndex))); |
| 58 } | 60 } |
| 59 | 61 |
| 60 PassRefPtr<RTCIceCandidate> RTCIceCandidate::create(blink::WebRTCICECandidate we
bCandidate) | 62 PassRefPtrWillBeRawPtr<RTCIceCandidate> RTCIceCandidate::create(blink::WebRTCICE
Candidate webCandidate) |
| 61 { | 63 { |
| 62 return adoptRef(new RTCIceCandidate(webCandidate)); | 64 return adoptRefWillBeNoop(new RTCIceCandidate(webCandidate)); |
| 63 } | 65 } |
| 64 | 66 |
| 65 RTCIceCandidate::RTCIceCandidate(blink::WebRTCICECandidate webCandidate) | 67 RTCIceCandidate::RTCIceCandidate(blink::WebRTCICECandidate webCandidate) |
| 66 : m_webCandidate(webCandidate) | 68 : m_webCandidate(webCandidate) |
| 67 { | 69 { |
| 68 ScriptWrappable::init(this); | 70 ScriptWrappable::init(this); |
| 69 } | 71 } |
| 70 | 72 |
| 71 String RTCIceCandidate::candidate() const | 73 String RTCIceCandidate::candidate() const |
| 72 { | 74 { |
| 73 return m_webCandidate.candidate(); | 75 return m_webCandidate.candidate(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 String RTCIceCandidate::sdpMid() const | 78 String RTCIceCandidate::sdpMid() const |
| 77 { | 79 { |
| 78 return m_webCandidate.sdpMid(); | 80 return m_webCandidate.sdpMid(); |
| 79 } | 81 } |
| 80 | 82 |
| 81 unsigned short RTCIceCandidate::sdpMLineIndex() const | 83 unsigned short RTCIceCandidate::sdpMLineIndex() const |
| 82 { | 84 { |
| 83 return m_webCandidate.sdpMLineIndex(); | 85 return m_webCandidate.sdpMLineIndex(); |
| 84 } | 86 } |
| 85 | 87 |
| 86 blink::WebRTCICECandidate RTCIceCandidate::webCandidate() | 88 blink::WebRTCICECandidate RTCIceCandidate::webCandidate() |
| 87 { | 89 { |
| 88 return m_webCandidate; | 90 return m_webCandidate; |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace WebCore | 93 } // namespace WebCore |
| OLD | NEW |