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

Unified Diff: third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp

Issue 2099213002: Web MIDI: prepare to deprecate MIDIMessageEvent::receivedTime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more test expectation Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp
index 7de4f5131b364bb3453e0b5a9beff5be125aad36..3b8cc2d9e526be7d94f55675fe521b05795cc36d 100644
--- a/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIMessageEvent.cpp
@@ -4,18 +4,37 @@
#include "modules/webmidi/MIDIMessageEvent.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/inspector/ConsoleMessage.h"
#include "modules/webmidi/MIDIMessageEventInit.h"
namespace blink {
-MIDIMessageEvent::MIDIMessageEvent(const AtomicString& type, const MIDIMessageEventInit& initializer)
+namespace {
+
+void showDeprecateMessage(ScriptState* state)
+{
+ state->getExecutionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, InfoMessageLevel, "receivedTime is deprecated and will be removed from MIDIMessageEvent soon. Use timeStamp instead."));
kouhei (in TOK) 2016/06/29 05:25:32 Please use Deprecation.h infra https://cs.chromium
Takashi Toyoshima 2016/06/30 10:12:18 Done.
+}
+
+} // namespace
+
+MIDIMessageEvent::MIDIMessageEvent(ScriptState* state, const AtomicString& type, const MIDIMessageEventInit& initializer)
: Event(type, initializer)
, m_receivedTime(0.0)
{
- if (initializer.hasReceivedTime())
+ if (initializer.hasReceivedTime()) {
+ showDeprecateMessage(state);
m_receivedTime = initializer.receivedTime();
+ }
if (initializer.hasData())
m_data = initializer.data();
}
+double MIDIMessageEvent::receivedTime(ScriptState* state)
+{
+ showDeprecateMessage(state);
+ return m_receivedTime;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698