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

Side by Side Diff: chrome/browser/media/webrtc_log_uploader.h

Issue 299903002: Convert WebRtcLoggingHandlerHost to use the blocking thread pool. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix after r273980 Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_
6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/sequence_checker.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "chrome/browser/media/webrtc_logging_handler_host.h" 16 #include "chrome/browser/media/webrtc_logging_handler_host.h"
16 #include "net/url_request/url_fetcher_delegate.h" 17 #include "net/url_request/url_fetcher_delegate.h"
17 18
18 class Profile; 19 class Profile;
19 20
20 namespace base { 21 namespace base {
21 class SharedMemory; 22 class SharedMemory;
22 } 23 }
23 24
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 void ResizeForNextOutput(std::vector<uint8>* compressed_log, 113 void ResizeForNextOutput(std::vector<uint8>* compressed_log,
113 z_stream* stream); 114 z_stream* stream);
114 115
115 void CreateAndStartURLFetcher( 116 void CreateAndStartURLFetcher(
116 const WebRtcLogUploadDoneData& upload_done_data, 117 const WebRtcLogUploadDoneData& upload_done_data,
117 scoped_ptr<std::string> post_data); 118 scoped_ptr<std::string> post_data);
118 119
119 void DecreaseLogCount(); 120 void DecreaseLogCount();
120 121
121 // Must be called on the FILE thread. 122 // Must be called on the blocking task pool.
122 void WriteCompressedLogToFile(const std::vector<uint8>& compressed_log, 123 void WriteCompressedLogToFile(const std::vector<uint8>& compressed_log,
123 const base::FilePath& log_file_path); 124 const base::FilePath& log_file_path);
124 125
125 // Append information (upload time, report ID and local ID) about a log to a 126 // Append information (upload time, report ID and local ID) about a log to a
126 // log list file, limited to |kLogListLimitLines| entries. This list is used 127 // log list file, limited to |kLogListLimitLines| entries. This list is used
127 // for viewing the logs under chrome://webrtc-logs, see WebRtcLogUploadList. 128 // for viewing the logs under chrome://webrtc-logs, see WebRtcLogUploadList.
128 // The list has the format 129 // The list has the format
129 // upload_time,report_id,local_id 130 // upload_time,report_id,local_id
130 // upload_time,report_id,local_id 131 // upload_time,report_id,local_id
131 // etc. 132 // etc.
132 // where each line represents a log. "upload_time" is the time when the log 133 // where each line represents a log. "upload_time" is the time when the log
133 // was uploaded in Unix time. "report_id" is the ID reported back by the 134 // was uploaded in Unix time. "report_id" is the ID reported back by the
134 // server. "local_id" is the ID for the locally stored log. It's the time 135 // server. "local_id" is the ID for the locally stored log. It's the time
135 // stored in Unix time and it's also used as file name. 136 // stored in Unix time and it's also used as file name.
136 // AddLocallyStoredLogInfoToUploadListFile() will first be called, 137 // AddLocallyStoredLogInfoToUploadListFile() will first be called,
137 // "upload_time" and "report_id" is the left empty in the entry written to the 138 // "upload_time" and "report_id" is the left empty in the entry written to the
138 // list file. If uploading is successful, AddUploadedLogInfoToUploadListFile() 139 // list file. If uploading is successful, AddUploadedLogInfoToUploadListFile()
139 // is called and those empty items are filled out. 140 // is called and those empty items are filled out.
140 // Must be called on the FILE thread. 141 // Must be called on the blocking task pool.
141 void AddLocallyStoredLogInfoToUploadListFile( 142 void AddLocallyStoredLogInfoToUploadListFile(
142 const base::FilePath& upload_list_path, 143 const base::FilePath& upload_list_path,
143 const std::string& local_log_id); 144 const std::string& local_log_id);
144 void AddUploadedLogInfoToUploadListFile( 145 void AddUploadedLogInfoToUploadListFile(
145 const base::FilePath& upload_list_path, 146 const base::FilePath& upload_list_path,
146 const std::string& local_log_id, 147 const std::string& local_log_id,
147 const std::string& report_id); 148 const std::string& report_id);
148 149
149 void NotifyUploadDone(int response_code, 150 void NotifyUploadDone(int response_code,
150 const std::string& report_id, 151 const std::string& report_id,
151 const WebRtcLogUploadDoneData& upload_done_data); 152 const WebRtcLogUploadDoneData& upload_done_data);
152 153
153 // This is the UI thread for Chromium. Some other thread for tests. 154 // This is the UI thread for Chromium. Some other thread for tests.
154 base::ThreadChecker create_thread_checker_; 155 base::ThreadChecker create_thread_checker_;
155 156
156 // This is the FILE thread for Chromium. Some other thread for tests. 157 // This is the blocking task pool.
157 base::ThreadChecker file_thread_checker_; 158 base::SequenceChecker blocking_sequence_checker_;
158 159
159 // Keeps track of number of currently open logs. Must be accessed on the UI 160 // Keeps track of number of currently open logs. Must be accessed on the UI
160 // thread. 161 // thread.
161 int log_count_; 162 int log_count_;
162 163
163 // For testing purposes, see OverrideUploadWithBufferForTesting. Only accessed 164 // For testing purposes, see OverrideUploadWithBufferForTesting. Only accessed
164 // on the FILE thread. 165 // on the blocking thread pool.
165 std::string* post_data_; 166 std::string* post_data_;
166 167
167 typedef std::map<const net::URLFetcher*, WebRtcLogUploadDoneData> 168 typedef std::map<const net::URLFetcher*, WebRtcLogUploadDoneData>
168 UploadDoneDataMap; 169 UploadDoneDataMap;
169 // Only accessed on the UI thread. 170 // Only accessed on the UI thread.
170 UploadDoneDataMap upload_done_data_; 171 UploadDoneDataMap upload_done_data_;
171 172
172 // When shutting down, don't create new URLFetchers. 173 // When shutting down, don't create new URLFetchers.
173 bool shutting_down_; 174 bool shutting_down_;
174 175
175 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader); 176 DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader);
176 }; 177 };
177 178
178 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_ 179 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | chrome/browser/media/webrtc_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698