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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp

Issue 1862163002: WebKit MediaStream cleanup: ASSERT-->DCHECK and ASSERT_NOT_REACHED-->NOTREACHED etc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted CHECK --> RELEASE_ASSERT and added TODO Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 27
28 #include "bindings/core/v8/ScriptState.h" 28 #include "bindings/core/v8/ScriptState.h"
29 #include "bindings/core/v8/ScriptValue.h" 29 #include "bindings/core/v8/ScriptValue.h"
30 #include "bindings/core/v8/V8ObjectBuilder.h" 30 #include "bindings/core/v8/V8ObjectBuilder.h"
31 #include "wtf/text/WTFString.h" 31 #include "wtf/text/WTFString.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 MediaDeviceInfo* MediaDeviceInfo::create(const WebMediaDeviceInfo& webMediaDevic eInfo) 35 MediaDeviceInfo* MediaDeviceInfo::create(const WebMediaDeviceInfo& webMediaDevic eInfo)
36 { 36 {
37 ASSERT(!webMediaDeviceInfo.isNull()); 37 DCHECK(!webMediaDeviceInfo.isNull());
38 return new MediaDeviceInfo(webMediaDeviceInfo); 38 return new MediaDeviceInfo(webMediaDeviceInfo);
39 } 39 }
40 40
41 MediaDeviceInfo::MediaDeviceInfo(const WebMediaDeviceInfo& webMediaDeviceInfo) 41 MediaDeviceInfo::MediaDeviceInfo(const WebMediaDeviceInfo& webMediaDeviceInfo)
42 : m_webMediaDeviceInfo(webMediaDeviceInfo) 42 : m_webMediaDeviceInfo(webMediaDeviceInfo)
43 { 43 {
44 } 44 }
45 45
46 String MediaDeviceInfo::deviceId() const 46 String MediaDeviceInfo::deviceId() const
47 { 47 {
48 return m_webMediaDeviceInfo.deviceId(); 48 return m_webMediaDeviceInfo.deviceId();
49 } 49 }
50 50
51 String MediaDeviceInfo::kind() const 51 String MediaDeviceInfo::kind() const
52 { 52 {
53 switch (m_webMediaDeviceInfo.kind()) { 53 switch (m_webMediaDeviceInfo.kind()) {
54 case WebMediaDeviceInfo::MediaDeviceKindAudioInput: 54 case WebMediaDeviceInfo::MediaDeviceKindAudioInput:
55 return "audioinput"; 55 return "audioinput";
56 case WebMediaDeviceInfo::MediaDeviceKindAudioOutput: 56 case WebMediaDeviceInfo::MediaDeviceKindAudioOutput:
57 return "audiooutput"; 57 return "audiooutput";
58 case WebMediaDeviceInfo::MediaDeviceKindVideoInput: 58 case WebMediaDeviceInfo::MediaDeviceKindVideoInput:
59 return "videoinput"; 59 return "videoinput";
60 } 60 }
61 61
62 ASSERT_NOT_REACHED(); 62 NOTREACHED();
63 return String(); 63 return String();
64 } 64 }
65 65
66 String MediaDeviceInfo::label() const 66 String MediaDeviceInfo::label() const
67 { 67 {
68 return m_webMediaDeviceInfo.label(); 68 return m_webMediaDeviceInfo.label();
69 } 69 }
70 70
71 String MediaDeviceInfo::groupId() const 71 String MediaDeviceInfo::groupId() const
72 { 72 {
73 return m_webMediaDeviceInfo.groupId(); 73 return m_webMediaDeviceInfo.groupId();
74 } 74 }
75 75
76 ScriptValue MediaDeviceInfo::toJSONForBinding(ScriptState* scriptState) 76 ScriptValue MediaDeviceInfo::toJSONForBinding(ScriptState* scriptState)
77 { 77 {
78 V8ObjectBuilder result(scriptState); 78 V8ObjectBuilder result(scriptState);
79 result.addString("deviceId", deviceId()); 79 result.addString("deviceId", deviceId());
80 result.addString("kind", kind()); 80 result.addString("kind", kind());
81 result.addString("label", label()); 81 result.addString("label", label());
82 result.addString("groupId", groupId()); 82 result.addString("groupId", groupId());
83 return result.scriptValue(); 83 return result.scriptValue();
84 } 84 }
85 85
86 } // namespace blink 86 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698