| 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 18 matching lines...) Expand all Loading... |
| 29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
| 30 #include "core/dom/DOMException.h" | 30 #include "core/dom/DOMException.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "modules/mediastream/UserMediaController.h" | 32 #include "modules/mediastream/UserMediaController.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 MediaDevicesRequest* MediaDevicesRequest::create( | 36 MediaDevicesRequest* MediaDevicesRequest::create( |
| 37 ScriptState* state, | 37 ScriptState* state, |
| 38 UserMediaController* controller) { | 38 UserMediaController* controller) { |
| 39 MediaDevicesRequest* request = new MediaDevicesRequest(state, controller); | 39 return new MediaDevicesRequest(state, controller); |
| 40 request->suspendIfNeeded(); | |
| 41 return request; | |
| 42 } | 40 } |
| 43 | 41 |
| 44 MediaDevicesRequest::MediaDevicesRequest(ScriptState* state, | 42 MediaDevicesRequest::MediaDevicesRequest(ScriptState* state, |
| 45 UserMediaController* controller) | 43 UserMediaController* controller) |
| 46 : SuspendableObject(state->getExecutionContext()), | 44 : ContextLifecycleObserver(state->getExecutionContext()), |
| 47 m_controller(controller), | 45 m_controller(controller), |
| 48 m_resolver(ScriptPromiseResolver::create(state)) {} | 46 m_resolver(ScriptPromiseResolver::create(state)) {} |
| 49 | 47 |
| 50 MediaDevicesRequest::~MediaDevicesRequest() {} | 48 MediaDevicesRequest::~MediaDevicesRequest() {} |
| 51 | 49 |
| 52 Document* MediaDevicesRequest::ownerDocument() { | 50 Document* MediaDevicesRequest::ownerDocument() { |
| 53 if (ExecutionContext* context = getExecutionContext()) { | 51 if (ExecutionContext* context = getExecutionContext()) { |
| 54 return toDocument(context); | 52 return toDocument(context); |
| 55 } | 53 } |
| 56 | 54 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 72 } | 70 } |
| 73 | 71 |
| 74 void MediaDevicesRequest::contextDestroyed() { | 72 void MediaDevicesRequest::contextDestroyed() { |
| 75 m_controller.clear(); | 73 m_controller.clear(); |
| 76 m_resolver.clear(); | 74 m_resolver.clear(); |
| 77 } | 75 } |
| 78 | 76 |
| 79 DEFINE_TRACE(MediaDevicesRequest) { | 77 DEFINE_TRACE(MediaDevicesRequest) { |
| 80 visitor->trace(m_controller); | 78 visitor->trace(m_controller); |
| 81 visitor->trace(m_resolver); | 79 visitor->trace(m_resolver); |
| 82 SuspendableObject::trace(visitor); | 80 ContextLifecycleObserver::trace(visitor); |
| 83 } | 81 } |
| 84 | 82 |
| 85 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |