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

Side by Side Diff: blimp/net/blimp_connection_details.h

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Built debug UI Created 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
Khushal 2016/05/18 00:23:01 A test for this class?
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_NET_BLIMP_CONNECTION_DETAILS_H_
6 #define BLIMP_NET_BLIMP_CONNECTION_DETAILS_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "blimp/net/blimp_net_export.h"
11
12 namespace blimp {
13
14 class NetworkActivityObserver {
Khushal 2016/05/18 00:23:01 Which thread are the NetworkActivityObservers expe
shaktisahu 2016/05/19 21:39:19 Done.
15 public:
16 virtual void UpdateDebugInfo(int received, int sent, int commits) = 0;
17 };
18
19 // Collects network traffic statistics. Maintains a counter for number of
20 // completed commits, bytes sent and received over network and notifies its
21 // observers on the main thread. Presents the data on a per navigation basis.
22 class BLIMP_NET_EXPORT BlimpConnectionDetails {
Khushal 2016/05/18 00:23:01 Could you add a comment about the lifetime of this
shaktisahu 2016/05/19 21:39:19 Done.
23 public:
24 BlimpConnectionDetails(
25 const scoped_refptr<base::TaskRunner>& main_thread_task_runner,
26 const scoped_refptr<base::TaskRunner>& io_thread_task_runner);
27
28 ~BlimpConnectionDetails();
29
30 void EnableDebugInfo(bool enable);
31
32 // Called on the IO thread.
33 void OnPacketReceived(int bytes);
Khushal 2016/05/18 00:23:01 Would be nice to just divide the methods into 2 gr
shaktisahu 2016/05/19 21:39:19 Done.
34 void OnPacketSent(int bytes);
35
36 // Called on the main thread.
37 void OnCommit();
38
39 // Called on the main thread.
40 void ResetStats();
41
42 void SetObserver(base::WeakPtr<NetworkActivityObserver> observer) {
Khushal 2016/05/18 00:23:01 Do you really need an Observer here? We usually us
shaktisahu 2016/05/19 21:39:19 Moved it to constructor. Actually I wanted to make
43 observer_ = observer;
44 }
45
46 private:
47 void ResetStatsOnIOThread();
48
49 // Flag to show/hide the debug data on blimp view.
50 bool debug_info_enabled_;
51
52 // Total number of bytes sent/received during a navigation.
53 int bytes_received_;
Khushal 2016/05/18 00:23:01 Please mark the thread on which these variables ar
54 int bytes_sent_;
55
56 // Total number of commits completed on the client.
57 int commits_;
58
59 base::WeakPtr<NetworkActivityObserver> observer_;
60 scoped_refptr<base::TaskRunner> main_thread_task_runner_;
61 scoped_refptr<base::TaskRunner> io_thread_task_runner_;
62
63 DISALLOW_COPY_AND_ASSIGN(BlimpConnectionDetails);
64 };
65
66 } // namespace blimp
67
68 #endif // BLIMP_NET_BLIMP_CONNECTION_DETAILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698