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

Unified Diff: content/browser/download/base_file.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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 | « content/browser/appcache/appcache_url_request_job.cc ('k') | content/browser/download/base_file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/base_file.cc
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc
index ecbae15e4e8614086819326c48e87da327cd9d47..f1fbd87219863472d4dc95897c843ae5db0cdbe2 100644
--- a/content/browser/download/base_file.cc
+++ b/content/browser/download/base_file.cc
@@ -23,6 +23,7 @@
#include "crypto/secure_hash.h"
#include "net/base/net_errors.h"
#include "net/log/net_log.h"
+#include "net/log/net_log_event_type.h"
namespace content {
@@ -96,7 +97,7 @@ DownloadInterruptReason BaseFile::AppendDataToFile(const char* data,
size_t write_count = 0;
size_t len = data_len;
const char* current_data = data;
- bound_net_log_.BeginEvent(net::NetLog::TYPE_DOWNLOAD_FILE_WRITTEN);
+ bound_net_log_.BeginEvent(net::NetLogEventType::DOWNLOAD_FILE_WRITTEN);
while (len > 0) {
write_count++;
int write_result = file_.WriteAtCurrentPos(current_data, len);
@@ -113,7 +114,7 @@ DownloadInterruptReason BaseFile::AppendDataToFile(const char* data,
current_data += write_size;
bytes_so_far_ += write_size;
}
- bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_WRITTEN,
+ bound_net_log_.EndEvent(net::NetLogEventType::DOWNLOAD_FILE_WRITTEN,
net::NetLog::Int64Callback("bytes", data_len));
RecordDownloadWriteSize(data_len);
@@ -141,7 +142,7 @@ DownloadInterruptReason BaseFile::Rename(const base::FilePath& new_path) {
Close();
bound_net_log_.BeginEvent(
- net::NetLog::TYPE_DOWNLOAD_FILE_RENAMED,
+ net::NetLogEventType::DOWNLOAD_FILE_RENAMED,
base::Bind(&FileRenamedNetLogCallback, &full_path_, &new_path));
base::CreateDirectory(new_path.DirName());
@@ -150,7 +151,7 @@ DownloadInterruptReason BaseFile::Rename(const base::FilePath& new_path) {
// permissions / security descriptors that makes sense in the new directory.
rename_result = MoveFileAndAdjustPermissions(new_path);
- bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_RENAMED);
+ bound_net_log_.EndEvent(net::NetLogEventType::DOWNLOAD_FILE_RENAMED);
if (rename_result == DOWNLOAD_INTERRUPT_REASON_NONE)
full_path_ = new_path;
@@ -167,19 +168,19 @@ DownloadInterruptReason BaseFile::Rename(const base::FilePath& new_path) {
void BaseFile::Detach() {
detached_ = true;
- bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DETACHED);
+ bound_net_log_.AddEvent(net::NetLogEventType::DOWNLOAD_FILE_DETACHED);
}
void BaseFile::Cancel() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!detached_);
- bound_net_log_.AddEvent(net::NetLog::TYPE_CANCELLED);
+ bound_net_log_.AddEvent(net::NetLogEventType::CANCELLED);
Close();
if (!full_path_.empty()) {
- bound_net_log_.AddEvent(net::NetLog::TYPE_DOWNLOAD_FILE_DELETED);
+ bound_net_log_.AddEvent(net::NetLogEventType::DOWNLOAD_FILE_DELETED);
base::DeleteFile(full_path_, false);
}
@@ -297,7 +298,7 @@ DownloadInterruptReason BaseFile::Open(const std::string& hash_so_far) {
}
bound_net_log_.BeginEvent(
- net::NetLog::TYPE_DOWNLOAD_FILE_OPENED,
+ net::NetLogEventType::DOWNLOAD_FILE_OPENED,
base::Bind(&FileOpenedNetLogCallback, &full_path_, bytes_so_far_));
if (!secure_hash_) {
@@ -348,14 +349,14 @@ void BaseFile::ClearFile() {
// This should only be called when we have a stream.
DCHECK(file_.IsValid());
file_.Close();
- bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_FILE_OPENED);
+ bound_net_log_.EndEvent(net::NetLogEventType::DOWNLOAD_FILE_OPENED);
}
DownloadInterruptReason BaseFile::LogNetError(
const char* operation,
net::Error error) {
bound_net_log_.AddEvent(
- net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
+ net::NetLogEventType::DOWNLOAD_FILE_ERROR,
base::Bind(&FileErrorNetLogCallback, operation, error));
return ConvertNetErrorToInterruptReason(error, DOWNLOAD_INTERRUPT_FROM_DISK);
}
@@ -378,7 +379,7 @@ DownloadInterruptReason BaseFile::LogInterruptReason(
<< " os_error:" << os_error
<< " reason:" << DownloadInterruptReasonToString(reason);
bound_net_log_.AddEvent(
- net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
+ net::NetLogEventType::DOWNLOAD_FILE_ERROR,
base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason));
return reason;
}
« no previous file with comments | « content/browser/appcache/appcache_url_request_job.cc ('k') | content/browser/download/base_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698