Commit 449be640 authored by ortuno's avatar ortuno Committed by Commit bot

bluetooth: Add usecounter for gattserverdisconnected

We are looking into changing gattserverdisconnected to
gattserverdisconnect.

Review-Url: https://codereview.chromium.org/2841293002
Cr-Commit-Position: refs/heads/master@{#467594}
parent e30ecdc9
...@@ -1578,6 +1578,7 @@ class CORE_EXPORT UseCounter { ...@@ -1578,6 +1578,7 @@ class CORE_EXPORT UseCounter {
kDispatchMouseEventOnDisabledFormControl = 1967, kDispatchMouseEventOnDisabledFormControl = 1967,
kElementNameDOMInvalidHTMLParserValid = 1968, kElementNameDOMInvalidHTMLParserValid = 1968,
kElementNameDOMValidHTMLParserInvalid = 1969, kElementNameDOMValidHTMLParserInvalid = 1969,
kGATTServerDisconnectedEvent = 1970,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -4,17 +4,19 @@ ...@@ -4,17 +4,19 @@
#include "modules/bluetooth/BluetoothDevice.h" #include "modules/bluetooth/BluetoothDevice.h"
#include <memory>
#include <utility>
#include "bindings/core/v8/CallbackPromiseAdapter.h" #include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ScriptPromise.h" #include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptPromiseResolver.h"
#include "core/dom/DOMException.h" #include "core/dom/DOMException.h"
#include "core/events/Event.h" #include "core/events/Event.h"
#include "core/frame/UseCounter.h"
#include "modules/bluetooth/Bluetooth.h" #include "modules/bluetooth/Bluetooth.h"
#include "modules/bluetooth/BluetoothAttributeInstanceMap.h" #include "modules/bluetooth/BluetoothAttributeInstanceMap.h"
#include "modules/bluetooth/BluetoothError.h" #include "modules/bluetooth/BluetoothError.h"
#include "modules/bluetooth/BluetoothRemoteGATTServer.h" #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
#include <memory>
#include <utility>
namespace blink { namespace blink {
...@@ -96,4 +98,15 @@ DEFINE_TRACE(BluetoothDevice) { ...@@ -96,4 +98,15 @@ DEFINE_TRACE(BluetoothDevice) {
ContextLifecycleObserver::Trace(visitor); ContextLifecycleObserver::Trace(visitor);
} }
void BluetoothDevice::AddedEventListener(
const AtomicString& event_type,
RegisteredEventListener& registered_listener) {
EventTargetWithInlineData::AddedEventListener(event_type,
registered_listener);
if (event_type == EventTypeNames::gattserverdisconnected) {
UseCounter::Count(GetExecutionContext(),
UseCounter::kGATTServerDisconnectedEvent);
}
}
} // namespace blink } // namespace blink
...@@ -91,6 +91,11 @@ class BluetoothDevice final : public EventTargetWithInlineData, ...@@ -91,6 +91,11 @@ class BluetoothDevice final : public EventTargetWithInlineData,
DEFINE_ATTRIBUTE_EVENT_LISTENER(gattserverdisconnected); DEFINE_ATTRIBUTE_EVENT_LISTENER(gattserverdisconnected);
protected:
// EventTarget overrides:
void AddedEventListener(const AtomicString& eventType,
RegisteredEventListener&) override;
private: private:
// Holds all GATT Attributes associated with this BluetoothDevice. // Holds all GATT Attributes associated with this BluetoothDevice.
Member<BluetoothAttributeInstanceMap> attribute_instance_map_; Member<BluetoothAttributeInstanceMap> attribute_instance_map_;
......
...@@ -97386,6 +97386,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -97386,6 +97386,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="1967" label="DispatchMouseEventOnDisabledFormControl"/> <int value="1967" label="DispatchMouseEventOnDisabledFormControl"/>
<int value="1968" label="ElementNameDOMInvalidHTMLParserValid"/> <int value="1968" label="ElementNameDOMInvalidHTMLParserValid"/>
<int value="1969" label="ElementNameDOMValidHTMLParserInvalid"/> <int value="1969" label="ElementNameDOMValidHTMLParserInvalid"/>
<int value="1970" label="GATTServerDisconnectedEvent"/>
</enum> </enum>
<enum name="FetchRequestMode" type="int"> <enum name="FetchRequestMode" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment