| Index: chrome/browser/webrtc_log_upload_manager.h
|
| diff --git a/chrome/browser/webrtc_log_upload_manager.h b/chrome/browser/webrtc_log_upload_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1bbd3e30198f326b5ae7794e69d6f80551a134d5
|
| --- /dev/null
|
| +++ b/chrome/browser/webrtc_log_upload_manager.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_
|
| +#define CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/shared_memory.h"
|
| +#include "net/url_request/url_fetcher_delegate.h"
|
| +#include "net/url_request/url_request_context.h"
|
| +#include "net/url_request/url_request_context_getter.h"
|
| +
|
| +namespace net {
|
| +class FileStream;
|
| +class URLFetcher;
|
| +}
|
| +
|
| +class WebRtcLogURLRequestContextGetter;
|
| +
|
| +// WebRtcLogUploadManager handles uploading WebRTC logs. It's owned by
|
| +// BrowserProcessImpl. WebRtcLoggingHandlerHost calls it when a log should be
|
| +// uploaded and given a shared memory buffer with the log data to be uploaded.
|
| +class WebRtcLogUploadManager : public net::URLFetcherDelegate {
|
| + public:
|
| + WebRtcLogUploadManager();
|
| + virtual ~WebRtcLogUploadManager();
|
| +
|
| + // net::URLFetcherDelegate implementation.
|
| + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
|
| + virtual void OnURLFetchUploadProgress(const net::URLFetcher* source,
|
| + int64 current, int64 total) OVERRIDE;
|
| +
|
| + // Takes ownership of |shared_memory|.
|
| + void UploadLog(base::SharedMemory* shared_memory, uint32 length);
|
| +
|
| + private:
|
| + void ReadAndCompressLog(uint8* input, uint32 input_size,
|
| + uint8* output, uint32* output_size);
|
| + void SetupUpload(uint8* output, uint32 output_size);
|
| + void AddPairString(const std::string& key, const std::string& value);
|
| + void AddUrlChunks();
|
| + void AddLogData(uint8* log_data, uint32 log_data_size);
|
| +
|
| + std::vector<net::URLFetcher*> url_fetchers_;
|
| + scoped_refptr<WebRtcLogURLRequestContextGetter>
|
| + request_context_getter_;
|
| +
|
| + scoped_ptr<net::FileStream> file_stream_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebRtcLogUploadManager);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_WEBRTC_LOG_UPLOAD_MANAGER_H_
|
|
|