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

Side by Side Diff: remoting/base/telemetry_log_writer.h

Issue 2643483003: [Remoting Android] Refactor ClientTelemetryLogger (Closed)
Patch Set: PTAL Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 REMOTING_BASE_TELEMETRY_LOG_WRITER_H_ 5 #ifndef REMOTING_BASE_TELEMETRY_LOG_WRITER_H_
6 #define REMOTING_BASE_TELEMETRY_LOG_WRITER_H_ 6 #define REMOTING_BASE_TELEMETRY_LOG_WRITER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 // The closure will be called when the request fails with unauthorized error 37 // The closure will be called when the request fails with unauthorized error
38 // code. The closure should call SetAuthToken to set the token. 38 // code. The closure should call SetAuthToken to set the token.
39 // If the closure is not set, the log writer will try to resend the logs 39 // If the closure is not set, the log writer will try to resend the logs
40 // immediately. 40 // immediately.
41 void SetAuthClosure(const base::Closure& closure) override; 41 void SetAuthClosure(const base::Closure& closure) override;
42 42
43 // Push the log entry to the pending list and send out all the pending logs. 43 // Push the log entry to the pending list and send out all the pending logs.
44 void Log(const ChromotingEvent& entry) override; 44 void Log(const ChromotingEvent& entry) override;
45 45
46 // Can be called on any thread.
Sergey Ulanov 2017/01/19 00:50:38 Do we actually need to allow it to be called on an
Yuwei 2017/01/19 23:00:00 Obsolete.
47 base::WeakPtr<TelemetryLogWriter> GetWeakPtr();
48
46 ~TelemetryLogWriter() override; 49 ~TelemetryLogWriter() override;
47 50
48 private: 51 private:
49 void SendPendingEntries(); 52 void SendPendingEntries();
50 void PostJsonToServer(const std::string& json); 53 void PostJsonToServer(const std::string& json);
51 void OnSendLogResult(const remoting::UrlRequest::Result& result); 54 void OnSendLogResult(const remoting::UrlRequest::Result& result);
52 55
53 base::ThreadChecker thread_checker_; 56 base::ThreadChecker thread_checker_;
54 std::string telemetry_base_url_; 57 std::string telemetry_base_url_;
55 std::unique_ptr<UrlRequestFactory> request_factory_; 58 std::unique_ptr<UrlRequestFactory> request_factory_;
56 std::string auth_token_; 59 std::string auth_token_;
57 base::Closure auth_closure_; 60 base::Closure auth_closure_;
58 std::unique_ptr<UrlRequest> request_; 61 std::unique_ptr<UrlRequest> request_;
59 62
60 // Entries to be sent. 63 // Entries to be sent.
61 std::deque<ChromotingEvent> pending_entries_; 64 std::deque<ChromotingEvent> pending_entries_;
62 65
63 // Entries being sent. 66 // Entries being sent.
64 // These will be pushed back to pending_entries if error occurs. 67 // These will be pushed back to pending_entries if error occurs.
65 std::deque<ChromotingEvent> sending_entries_; 68 std::deque<ChromotingEvent> sending_entries_;
66 69
70 base::WeakPtr<TelemetryLogWriter> weak_ptr_;
71 base::WeakPtrFactory<TelemetryLogWriter> weak_factory_;
67 DISALLOW_COPY_AND_ASSIGN(TelemetryLogWriter); 72 DISALLOW_COPY_AND_ASSIGN(TelemetryLogWriter);
Sergey Ulanov 2017/01/19 00:50:38 nit: add empty line here
Yuwei 2017/01/19 23:00:00 Obsolete.
68 }; 73 };
69 74
70 } // namespace remoting 75 } // namespace remoting
71 #endif // REMOTING_BASE_TELEMETRY_LOG_WRITER_H_ 76 #endif // REMOTING_BASE_TELEMETRY_LOG_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698