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

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

Issue 1901103006: Web MIDI: Replace ASSERT macros with DCHECK macros (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 22 matching lines...) Expand all
33 #include "modules/webmidi/MIDIAccess.h" 33 #include "modules/webmidi/MIDIAccess.h"
34 #include "modules/webmidi/MIDIMessageEvent.h" 34 #include "modules/webmidi/MIDIMessageEvent.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 using PortState = MIDIAccessor::MIDIPortState; 39 using PortState = MIDIAccessor::MIDIPortState;
40 40
41 MIDIInput* MIDIInput::create(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version, PortState state) 41 MIDIInput* MIDIInput::create(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version, PortState state)
42 { 42 {
43 ASSERT(access); 43 DCHECK(access);
44 MIDIInput* input = new MIDIInput(access, id, manufacturer, name, version, st ate); 44 MIDIInput* input = new MIDIInput(access, id, manufacturer, name, version, st ate);
45 input->suspendIfNeeded(); 45 input->suspendIfNeeded();
46 return input; 46 return input;
47 } 47 }
48 48
49 MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufac turer, const String& name, const String& version, PortState state) 49 MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufac turer, const String& name, const String& version, PortState state)
50 : MIDIPort(access, id, manufacturer, name, TypeInput, version, state) 50 : MIDIPort(access, id, manufacturer, name, TypeInput, version, state)
51 { 51 {
52 } 52 }
53 53
(...skipping 15 matching lines...) Expand all
69 { 69 {
70 if (eventType == EventTypeNames::midimessage) { 70 if (eventType == EventTypeNames::midimessage) {
71 // Implicit open. See setOnmidimessage(). 71 // Implicit open. See setOnmidimessage().
72 open(); 72 open();
73 } 73 }
74 return EventTarget::addEventListenerInternal(eventType, listener, options); 74 return EventTarget::addEventListenerInternal(eventType, listener, options);
75 } 75 }
76 76
77 void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data , size_t length, double timeStamp) 77 void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data , size_t length, double timeStamp)
78 { 78 {
79 ASSERT(isMainThread()); 79 DCHECK(isMainThread());
80 80
81 if (!length) 81 if (!length)
82 return; 82 return;
83 83
84 if (getConnection() != ConnectionStateOpen) 84 if (getConnection() != ConnectionStateOpen)
85 return; 85 return;
86 86
87 // Drop sysex message here when the client does not request it. Note that th is is not a security check but an 87 // Drop sysex message here when the client does not request it. Note that th is is not a security check but an
88 // automatic filtering for clients that do not want sysex message. Also note that sysex message will never be sent 88 // automatic filtering for clients that do not want sysex message. Also note that sysex message will never be sent
89 // unless the current process has an explicit permission to handle sysex mes sage. 89 // unless the current process has an explicit permission to handle sysex mes sage.
90 if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) 90 if (data[0] == 0xf0 && !midiAccess()->sysexEnabled())
91 return; 91 return;
92 DOMUint8Array* array = DOMUint8Array::create(data, length); 92 DOMUint8Array* array = DOMUint8Array::create(data, length);
93 dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); 93 dispatchEvent(MIDIMessageEvent::create(timeStamp, array));
94 } 94 }
95 95
96 DEFINE_TRACE(MIDIInput) 96 DEFINE_TRACE(MIDIInput)
97 { 97 {
98 MIDIPort::trace(visitor); 98 MIDIPort::trace(visitor);
99 } 99 }
100 100
101 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webmidi/MIDIController.cpp ('k') | third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698