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

Unified Diff: chrome/browser/media/webrtc_log_uploader.h

Issue 211033006: Move destruction of WebRtcLogUploader to post threads teardown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix to unit test + rebase. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/media/webrtc_log_uploader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/webrtc_log_uploader.h
diff --git a/chrome/browser/media/webrtc_log_uploader.h b/chrome/browser/media/webrtc_log_uploader.h
index 75f7de510e6c141bb1872f1486e6818de5c6fa74..40d95547bf78a001dc88f6b36d3810394249ea10 100644
--- a/chrome/browser/media/webrtc_log_uploader.h
+++ b/chrome/browser/media/webrtc_log_uploader.h
@@ -11,8 +11,6 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/media/webrtc_logging_handler_host.h"
#include "net/url_request/url_fetcher_delegate.h"
@@ -25,7 +23,6 @@ class SharedMemory;
namespace net {
class URLFetcher;
-class URLRequestContextGetter;
}
typedef struct z_stream_s z_stream;
@@ -42,8 +39,6 @@ struct WebRtcLogUploadDoneData {
std::string local_log_id;
};
-class WebRtcLogURLRequestContextGetter;
-
// WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have
// been started and denies further logs if a limit is reached. It also adds
// the timestamp and report ID of the uploded log to a text file. There must
@@ -77,12 +72,16 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// |upload_done_data.local_log_id| is set and used internally and should be
// left empty.
void LoggingStoppedDoUpload(
- net::URLRequestContextGetter* request_context,
scoped_ptr<unsigned char[]> log_buffer,
uint32 length,
const std::map<std::string, std::string>& meta_data,
const WebRtcLogUploadDoneData& upload_done_data);
+ // Cancels URL fetcher operation by deleting all URL fetchers. This cancels
+ // any pending uploads and releases SystemURLRequestContextGetter references.
+ // Sets |shutting_down_| which prevent new fetchers to be created.
+ void StartShutdown();
+
// For testing purposes. If called, the multipart will not be uploaded, but
// written to |post_data_| instead.
void OverrideUploadWithBufferForTesting(std::string* post_data) {
@@ -114,7 +113,6 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
z_stream* stream);
void CreateAndStartURLFetcher(
- scoped_refptr<net::URLRequestContextGetter> request_context,
const WebRtcLogUploadDoneData& upload_done_data,
scoped_ptr<std::string> post_data);
@@ -158,6 +156,8 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// This is the FILE thread for Chromium. Some other thread for tests.
base::ThreadChecker file_thread_checker_;
+ // Keeps track of number of currently open logs. Must be accessed on the UI
+ // thread.
int log_count_;
// For testing purposes, see OverrideUploadWithBufferForTesting. Only accessed
@@ -169,6 +169,9 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// Only accessed on the UI thread.
UploadDoneDataMap upload_done_data_;
+ // When shutting down, don't create new URLFetchers.
+ bool shutting_down_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader);
};
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/media/webrtc_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698