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

Side by Side Diff: third_party/WebKit/Source/modules/webmidi/MIDIPort.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 String MIDIPort::connection() const { 63 String MIDIPort::connection() const {
64 switch (m_connection) { 64 switch (m_connection) {
65 case ConnectionStateOpen: 65 case ConnectionStateOpen:
66 return "open"; 66 return "open";
67 case ConnectionStateClosed: 67 case ConnectionStateClosed:
68 return "closed"; 68 return "closed";
69 case ConnectionStatePending: 69 case ConnectionStatePending:
70 return "pending"; 70 return "pending";
71 } 71 }
72 return emptyString(); 72 return emptyString;
73 } 73 }
74 74
75 String MIDIPort::state() const { 75 String MIDIPort::state() const {
76 switch (m_state) { 76 switch (m_state) {
77 case PortState::DISCONNECTED: 77 case PortState::DISCONNECTED:
78 return "disconnected"; 78 return "disconnected";
79 case PortState::CONNECTED: 79 case PortState::CONNECTED:
80 return "connected"; 80 return "connected";
81 case PortState::OPENED: 81 case PortState::OPENED:
82 NOTREACHED(); 82 NOTREACHED();
83 return "connected"; 83 return "connected";
84 } 84 }
85 return emptyString(); 85 return emptyString;
86 } 86 }
87 87
88 String MIDIPort::type() const { 88 String MIDIPort::type() const {
89 switch (m_type) { 89 switch (m_type) {
90 case TypeInput: 90 case TypeInput:
91 return "input"; 91 return "input";
92 case TypeOutput: 92 case TypeOutput:
93 return "output"; 93 return "output";
94 } 94 }
95 return emptyString(); 95 return emptyString;
96 } 96 }
97 97
98 ScriptPromise MIDIPort::open(ScriptState* scriptState) { 98 ScriptPromise MIDIPort::open(ScriptState* scriptState) {
99 open(); 99 open();
100 return accept(scriptState); 100 return accept(scriptState);
101 } 101 }
102 102
103 ScriptPromise MIDIPort::close(ScriptState* scriptState) { 103 ScriptPromise MIDIPort::close(ScriptState* scriptState) {
104 if (m_connection != ConnectionStateClosed) { 104 if (m_connection != ConnectionStateClosed) {
105 // TODO(toyoshim): Do clear() operation on MIDIOutput. 105 // TODO(toyoshim): Do clear() operation on MIDIOutput.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); 204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen);
205 if (m_state == state && m_connection == connection) 205 if (m_state == state && m_connection == connection)
206 return; 206 return;
207 m_state = state; 207 m_state = state;
208 m_connection = connection; 208 m_connection = connection;
209 dispatchEvent(MIDIConnectionEvent::create(this)); 209 dispatchEvent(MIDIConnectionEvent::create(this));
210 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); 210 m_access->dispatchEvent(MIDIConnectionEvent::create(this));
211 } 211 }
212 212
213 } // namespace blink 213 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698