Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NetworkInformation_h | 5 #ifndef NetworkInformation_h |
| 6 #define NetworkInformation_h | 6 #define NetworkInformation_h |
| 7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
| 10 #include "platform/bindings/ActiveScriptWrappable.h" | 10 #include "platform/bindings/ActiveScriptWrappable.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 public NetworkStateNotifier::NetworkStateObserver { | 22 public NetworkStateNotifier::NetworkStateObserver { |
| 23 USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation); | 23 USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation); |
| 24 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
| 25 | 25 |
| 26 public: | 26 public: |
| 27 static NetworkInformation* Create(ExecutionContext*); | 27 static NetworkInformation* Create(ExecutionContext*); |
| 28 ~NetworkInformation() override; | 28 ~NetworkInformation() override; |
| 29 | 29 |
| 30 String type() const; | 30 String type() const; |
| 31 double downlinkMax() const; | 31 double downlinkMax() const; |
| 32 double rtt() const; | |
| 33 double downlink() const; | |
| 32 | 34 |
| 33 // NetworkStateObserver overrides. | 35 // NetworkStateObserver overrides. |
| 34 void ConnectionChange(WebConnectionType, double downlink_max_mbps) override; | 36 void ConnectionChange(WebConnectionType, |
| 37 double downlink_max_mbps, | |
| 38 int http_rtt_msec, | |
| 39 int transport_rtt_msec, | |
| 40 double downlink_throughput_mbps) override; | |
|
bengr
2017/05/12 19:09:55
Names are weird. Either do s/downlink_max_mbps/dow
tbansal1
2017/05/12 22:18:17
Done.
| |
| 35 | 41 |
| 36 // EventTarget overrides. | 42 // EventTarget overrides. |
| 37 const AtomicString& InterfaceName() const override; | 43 const AtomicString& InterfaceName() const override; |
| 38 ExecutionContext* GetExecutionContext() const override; | 44 ExecutionContext* GetExecutionContext() const override; |
| 39 void RemoveAllEventListeners() override; | 45 void RemoveAllEventListeners() override; |
| 40 | 46 |
| 41 // ScriptWrappable | 47 // ScriptWrappable |
| 42 bool HasPendingActivity() const final; | 48 bool HasPendingActivity() const final; |
| 43 | 49 |
| 44 // ContextLifecycleObserver overrides. | 50 // ContextLifecycleObserver overrides. |
| 45 void ContextDestroyed(ExecutionContext*) override; | 51 void ContextDestroyed(ExecutionContext*) override; |
| 46 | 52 |
| 47 DECLARE_VIRTUAL_TRACE(); | 53 DECLARE_VIRTUAL_TRACE(); |
| 48 | 54 |
| 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 55 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
| 50 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); // Deprecated | 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); // Deprecated |
| 51 | 57 |
| 52 protected: | 58 protected: |
| 53 // EventTarget overrides. | 59 // EventTarget overrides. |
| 54 void AddedEventListener(const AtomicString& event_type, | 60 void AddedEventListener(const AtomicString& event_type, |
| 55 RegisteredEventListener&) final; | 61 RegisteredEventListener&) final; |
| 56 void RemovedEventListener(const AtomicString& event_type, | 62 void RemovedEventListener(const AtomicString& event_type, |
| 57 const RegisteredEventListener&) final; | 63 const RegisteredEventListener&) final; |
| 58 | 64 |
| 59 private: | 65 private: |
| 60 explicit NetworkInformation(ExecutionContext*); | 66 explicit NetworkInformation(ExecutionContext*); |
| 61 void StartObserving(); | 67 void StartObserving(); |
| 62 void StopObserving(); | 68 void StopObserving(); |
| 63 | 69 |
| 64 // Touched only on context thread. | 70 // Variables below are touched only on context thread. |
| 65 WebConnectionType type_; | 71 WebConnectionType type_; |
| 66 | |
| 67 // Touched only on context thread. | |
| 68 double downlink_max_mbps_; | 72 double downlink_max_mbps_; |
| 73 int transport_rtt_msec_; | |
| 74 double downlink_throughput_mbps_; | |
|
bengr
2017/05/12 19:09:55
Names are similarly weird.
tbansal1
2017/05/12 22:18:17
Done.
| |
| 69 | 75 |
| 70 // Whether this object is listening for events from NetworkStateNotifier. | 76 // Whether this object is listening for events from NetworkStateNotifier. |
| 71 bool observing_; | 77 bool observing_; |
| 72 | 78 |
| 73 // Whether ContextLifecycleObserver::contextDestroyed has been called. | 79 // Whether ContextLifecycleObserver::contextDestroyed has been called. |
| 74 bool context_stopped_; | 80 bool context_stopped_; |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 } // namespace blink | 83 } // namespace blink |
| 78 | 84 |
| 79 #endif // NetworkInformation_h | 85 #endif // NetworkInformation_h |
| OLD | NEW |