| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 { | 56 { |
| 57 if (ExecutionContext* context = getExecutionContext()) { | 57 if (ExecutionContext* context = getExecutionContext()) { |
| 58 return toDocument(context); | 58 return toDocument(context); |
| 59 } | 59 } |
| 60 | 60 |
| 61 return 0; | 61 return 0; |
| 62 } | 62 } |
| 63 | 63 |
| 64 ScriptPromise MediaDevicesRequest::start() | 64 ScriptPromise MediaDevicesRequest::start() |
| 65 { | 65 { |
| 66 ASSERT(m_controller); | 66 DCHECK(m_controller); |
| 67 m_resolver->keepAliveWhilePending(); | 67 m_resolver->keepAliveWhilePending(); |
| 68 m_controller->requestMediaDevices(this); | 68 m_controller->requestMediaDevices(this); |
| 69 return m_resolver->promise(); | 69 return m_resolver->promise(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void MediaDevicesRequest::succeed(const MediaDeviceInfoVector& mediaDevices) | 72 void MediaDevicesRequest::succeed(const MediaDeviceInfoVector& mediaDevices) |
| 73 { | 73 { |
| 74 if (!getExecutionContext() || !m_resolver) | 74 if (!getExecutionContext() || !m_resolver) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 m_resolver->resolve(mediaDevices); | 77 m_resolver->resolve(mediaDevices); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void MediaDevicesRequest::stop() | 80 void MediaDevicesRequest::stop() |
| 81 { | 81 { |
| 82 m_controller.clear(); | 82 m_controller.clear(); |
| 83 m_resolver.clear(); | 83 m_resolver.clear(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 DEFINE_TRACE(MediaDevicesRequest) | 86 DEFINE_TRACE(MediaDevicesRequest) |
| 87 { | 87 { |
| 88 visitor->trace(m_controller); | 88 visitor->trace(m_controller); |
| 89 visitor->trace(m_resolver); | 89 visitor->trace(m_resolver); |
| 90 ActiveDOMObject::trace(visitor); | 90 ActiveDOMObject::trace(visitor); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |