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

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

Issue 23691066: Hook up WebRTC logging extension API to the underlying functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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
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 ecd53d645198066b3fa3e0e0b89de35ebd189622..167ccbbdab33b9372a8069f6af4c90944af1d20a 100644
--- a/chrome/browser/media/webrtc_log_uploader.h
+++ b/chrome/browser/media/webrtc_log_uploader.h
@@ -5,13 +5,14 @@
#ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_
#define CHROME_BROWSER_MEDIA_WEBRTC_LOG_UPLOADER_H_
+#include <map>
#include <string>
-#include <vector>
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
+#include "chrome/browser/media/webrtc_logging_handler_host.h"
#include "net/url_request/url_fetcher_delegate.h"
namespace base {
@@ -25,6 +26,12 @@ class URLRequestContextGetter;
typedef struct z_stream_s z_stream;
+// Used when uploading is done to inform about that it's done.
+typedef struct {
+ WebRtcLoggingHandlerHost::UploadDoneCallback callback;
+ scoped_refptr<WebRtcLoggingHandlerHost> host;
+} WebRtcLogUploadDoneData;
+
class WebRtcLogURLRequestContextGetter;
// WebRtcLogUploader uploads WebRTC logs, keeps count of how many logs have
@@ -45,15 +52,24 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// count if true is returned. Must be called before UploadLog().
bool ApplyForStartLogging();
- // Uploads log and decreases log count. May only be called if permission to
- // to log has been granted by calling ApplyForStartLogging() and getting true
- // in return. After UploadLog has been called, a new permission must be
- // granted.
- void UploadLog(net::URLRequestContextGetter* request_context,
- scoped_ptr<base::SharedMemory> shared_memory,
- uint32 length,
- const std::string& app_session_id,
- const std::string& app_url);
+ // Notifies that logging has stopped and that the log should not be uploaded.
+ // Decreases log count. May only be called if permission to log has been
+ // granted by calling ApplyForStartLogging() and getting true in return.
+ // After this function has been called, a new permission must be granted.
+ // Call either this function or LoggingStoppedDoUpload().
+ void LoggingStoppedDontUpload();
+
+ // Notifies that that logging has stopped and that the log should be uploaded.
+ // Decreases log count. May only be called if permission to log has been
+ // granted by calling ApplyForStartLogging() and getting true in return. After
+ // this function has been called, a new permission must be granted. Call
+ // either this function or LoggingStoppedDontUpload().
+ void LoggingStoppedDoUpload(
+ net::URLRequestContextGetter* request_context,
+ scoped_ptr<base::SharedMemory> shared_memory,
+ uint32 length,
+ const std::map<std::string, std::string>& meta_data,
+ const WebRtcLogUploadDoneData& upload_done_data);
// For testing purposes. If called, the multipart will not be uploaded, but
// written to |post_data_| instead.
@@ -69,8 +85,7 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// to RFC 2046.
void SetupMultipart(std::string* post_data, uint8* log_buffer,
uint32 log_buffer_length,
- const std::string& app_session_id,
- const std::string& app_url);
+ const std::map<std::string, std::string>& meta_data);
void AddLogData(std::string* post_data, uint8* log_buffer,
uint32 log_buffer_length);
@@ -99,6 +114,10 @@ class WebRtcLogUploader : public net::URLFetcherDelegate {
// on the FILE thread.
std::string* post_data_;
+ typedef std::map<const net::URLFetcher*, WebRtcLogUploadDoneData>
+ UploadDoneDataMap;
+ UploadDoneDataMap upload_done_data_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploader);
};

Powered by Google App Engine
This is Rietveld 408576698