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

Side by Side Diff: third_party/WebKit/Source/modules/audio_output_devices/SetSinkIdCallbacks.cpp

Issue 2862963003: Replace ASSERT with DCHECK in modules/ (Closed)
Patch Set: NOTREACHED instead of DCHECK(false) Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/audio_output_devices/SetSinkIdCallbacks.h" 5 #include "modules/audio_output_devices/SetSinkIdCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" 9 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h"
10 10
(...skipping 19 matching lines...) Expand all
30 return DOMException::Create(kAbortError, "Invalid error code"); 30 return DOMException::Create(kAbortError, "Invalid error code");
31 } 31 }
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 SetSinkIdCallbacks::SetSinkIdCallbacks(ScriptPromiseResolver* resolver, 36 SetSinkIdCallbacks::SetSinkIdCallbacks(ScriptPromiseResolver* resolver,
37 HTMLMediaElement& element, 37 HTMLMediaElement& element,
38 const String& sink_id) 38 const String& sink_id)
39 : resolver_(resolver), element_(element), sink_id_(sink_id) { 39 : resolver_(resolver), element_(element), sink_id_(sink_id) {
40 ASSERT(resolver_); 40 DCHECK(resolver_);
41 } 41 }
42 42
43 SetSinkIdCallbacks::~SetSinkIdCallbacks() {} 43 SetSinkIdCallbacks::~SetSinkIdCallbacks() {}
44 44
45 void SetSinkIdCallbacks::OnSuccess() { 45 void SetSinkIdCallbacks::OnSuccess() {
46 if (!resolver_->GetExecutionContext() || 46 if (!resolver_->GetExecutionContext() ||
47 resolver_->GetExecutionContext()->IsContextDestroyed()) 47 resolver_->GetExecutionContext()->IsContextDestroyed())
48 return; 48 return;
49 49
50 HTMLMediaElementAudioOutputDevice& aod_element = 50 HTMLMediaElementAudioOutputDevice& aod_element =
51 HTMLMediaElementAudioOutputDevice::From(*element_); 51 HTMLMediaElementAudioOutputDevice::From(*element_);
52 aod_element.setSinkId(sink_id_); 52 aod_element.setSinkId(sink_id_);
53 resolver_->Resolve(); 53 resolver_->Resolve();
54 } 54 }
55 55
56 void SetSinkIdCallbacks::OnError(WebSetSinkIdError error) { 56 void SetSinkIdCallbacks::OnError(WebSetSinkIdError error) {
57 if (!resolver_->GetExecutionContext() || 57 if (!resolver_->GetExecutionContext() ||
58 resolver_->GetExecutionContext()->IsContextDestroyed()) 58 resolver_->GetExecutionContext()->IsContextDestroyed())
59 return; 59 return;
60 60
61 resolver_->Reject(ToException(error)); 61 resolver_->Reject(ToException(error));
62 } 62 }
63 63
64 } // namespace blink 64 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/ModulesInitializer.cpp ('k') | third_party/WebKit/Source/modules/cachestorage/Cache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698