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

Side by Side Diff: third_party/WebKit/Source/modules/netinfo/NetworkInformation.h

Issue 2863973003: Expose RTT and downlink bandwidth using experimental Javascript API (Closed)
Patch Set: jkarlin comments Created 3 years, 7 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 // 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
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 long 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_mbps) override;
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.
(...skipping 15 matching lines...) Expand all
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 // Touched only on context thread.
65 WebConnectionType type_; 71 WebConnectionType type_;
66 72
67 // Touched only on context thread. 73 // Touched only on context thread.
68 double downlink_max_mbps_; 74 double downlink_max_mbps_;
69 75
76 // Transport RTT estimate. Rounded off to the nearest 25 msec. Touched only on
77 // context thread.
78 int transport_rtt_msec_;
79
80 // Downlink throughput estimate. Rounded off to the nearest 25 kbps. Touched
81 // only on context thread.
82 double downlink_mbps_;
83
70 // Whether this object is listening for events from NetworkStateNotifier. 84 // Whether this object is listening for events from NetworkStateNotifier.
71 bool observing_; 85 bool observing_;
72 86
73 // Whether ContextLifecycleObserver::contextDestroyed has been called. 87 // Whether ContextLifecycleObserver::contextDestroyed has been called.
74 bool context_stopped_; 88 bool context_stopped_;
75 }; 89 };
76 90
77 } // namespace blink 91 } // namespace blink
78 92
79 #endif // NetworkInformation_h 93 #endif // NetworkInformation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698