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

Unified Diff: content/browser/service_worker/service_worker_url_request_job.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
Index: content/browser/service_worker/service_worker_url_request_job.cc
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc
index caf7c0fc1f2e14927721ad9c23906a98e776cd9f..cdaa9dbef3f7ed1157262246483ac5fc3d91bff0 100644
--- a/content/browser/service_worker/service_worker_url_request_job.cc
+++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -40,6 +40,7 @@
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"
#include "net/log/net_log.h"
+#include "net/log/net_log_event_type.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/blob/blob_storage_context.h"
@@ -49,45 +50,45 @@ namespace content {
namespace {
-net::NetLog::EventType RequestJobResultToNetEventType(
+net::NetLogEventType RequestJobResultToNetEventType(
ServiceWorkerMetrics::URLRequestJobResult result) {
- using n = net::NetLog;
+ using n = net::NetLogEventType;
using m = ServiceWorkerMetrics;
switch (result) {
case m::REQUEST_JOB_FALLBACK_RESPONSE:
- return n::TYPE_SERVICE_WORKER_FALLBACK_RESPONSE;
+ return n::SERVICE_WORKER_FALLBACK_RESPONSE;
case m::REQUEST_JOB_FALLBACK_FOR_CORS:
- return n::TYPE_SERVICE_WORKER_FALLBACK_FOR_CORS;
+ return n::SERVICE_WORKER_FALLBACK_FOR_CORS;
case m::REQUEST_JOB_HEADERS_ONLY_RESPONSE:
- return n::TYPE_SERVICE_WORKER_HEADERS_ONLY_RESPONSE;
+ return n::SERVICE_WORKER_HEADERS_ONLY_RESPONSE;
case m::REQUEST_JOB_STREAM_RESPONSE:
- return n::TYPE_SERVICE_WORKER_STREAM_RESPONSE;
+ return n::SERVICE_WORKER_STREAM_RESPONSE;
case m::REQUEST_JOB_BLOB_RESPONSE:
- return n::TYPE_SERVICE_WORKER_BLOB_RESPONSE;
+ return n::SERVICE_WORKER_BLOB_RESPONSE;
case m::REQUEST_JOB_ERROR_RESPONSE_STATUS_ZERO:
- return n::TYPE_SERVICE_WORKER_ERROR_RESPONSE_STATUS_ZERO;
+ return n::SERVICE_WORKER_ERROR_RESPONSE_STATUS_ZERO;
case m::REQUEST_JOB_ERROR_BAD_BLOB:
- return n::TYPE_SERVICE_WORKER_ERROR_BAD_BLOB;
+ return n::SERVICE_WORKER_ERROR_BAD_BLOB;
case m::REQUEST_JOB_ERROR_NO_PROVIDER_HOST:
- return n::TYPE_SERVICE_WORKER_ERROR_NO_PROVIDER_HOST;
+ return n::SERVICE_WORKER_ERROR_NO_PROVIDER_HOST;
case m::REQUEST_JOB_ERROR_NO_ACTIVE_VERSION:
- return n::TYPE_SERVICE_WORKER_ERROR_NO_ACTIVE_VERSION;
+ return n::SERVICE_WORKER_ERROR_NO_ACTIVE_VERSION;
case m::REQUEST_JOB_ERROR_FETCH_EVENT_DISPATCH:
- return n::TYPE_SERVICE_WORKER_ERROR_FETCH_EVENT_DISPATCH;
+ return n::SERVICE_WORKER_ERROR_FETCH_EVENT_DISPATCH;
case m::REQUEST_JOB_ERROR_BLOB_READ:
- return n::TYPE_SERVICE_WORKER_ERROR_BLOB_READ;
+ return n::SERVICE_WORKER_ERROR_BLOB_READ;
case m::REQUEST_JOB_ERROR_STREAM_ABORTED:
- return n::TYPE_SERVICE_WORKER_ERROR_STREAM_ABORTED;
+ return n::SERVICE_WORKER_ERROR_STREAM_ABORTED;
case m::REQUEST_JOB_ERROR_KILLED:
- return n::TYPE_SERVICE_WORKER_ERROR_KILLED;
+ return n::SERVICE_WORKER_ERROR_KILLED;
case m::REQUEST_JOB_ERROR_KILLED_WITH_BLOB:
- return n::TYPE_SERVICE_WORKER_ERROR_KILLED_WITH_BLOB;
+ return n::SERVICE_WORKER_ERROR_KILLED_WITH_BLOB;
case m::REQUEST_JOB_ERROR_KILLED_WITH_STREAM:
- return n::TYPE_SERVICE_WORKER_ERROR_KILLED_WITH_STREAM;
+ return n::SERVICE_WORKER_ERROR_KILLED_WITH_STREAM;
case m::REQUEST_JOB_ERROR_BAD_DELEGATE:
- return n::TYPE_SERVICE_WORKER_ERROR_BAD_DELEGATE;
+ return n::SERVICE_WORKER_ERROR_BAD_DELEGATE;
case m::REQUEST_JOB_ERROR_REQUEST_BODY_BLOB_FAILED:
- return n::TYPE_SERVICE_WORKER_ERROR_REQUEST_BODY_BLOB_FAILED;
+ return n::SERVICE_WORKER_ERROR_REQUEST_BODY_BLOB_FAILED;
// We can't log if there's no request; fallthrough.
case m::REQUEST_JOB_ERROR_NO_REQUEST:
// Obsolete types; fallthrough.
@@ -99,7 +100,7 @@ net::NetLog::EventType RequestJobResultToNetEventType(
NOTREACHED() << result;
}
NOTREACHED() << result;
- return n::TYPE_FAILED;
+ return n::FAILED;
}
} // namespace
@@ -111,12 +112,12 @@ class ServiceWorkerURLRequestJob::BlobConstructionWaiter {
TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker", "BlobConstructionWaiter", this,
"URL", owner_->request()->url().spec());
owner_->request()->net_log().BeginEvent(
- net::NetLog::TYPE_SERVICE_WORKER_WAITING_FOR_REQUEST_BODY_BLOB);
+ net::NetLogEventType::SERVICE_WORKER_WAITING_FOR_REQUEST_BODY_BLOB);
}
~BlobConstructionWaiter() {
owner_->request()->net_log().EndEvent(
- net::NetLog::TYPE_SERVICE_WORKER_WAITING_FOR_REQUEST_BODY_BLOB,
+ net::NetLogEventType::SERVICE_WORKER_WAITING_FOR_REQUEST_BODY_BLOB,
net::NetLog::BoolCallback("success", phase_ == Phase::SUCCESS));
TRACE_EVENT_ASYNC_END1("ServiceWorker", "BlobConstructionWaiter", this,
"Success", phase_ == Phase::SUCCESS);
@@ -392,7 +393,8 @@ void ServiceWorkerURLRequestJob::MaybeStartRequest() {
}
void ServiceWorkerURLRequestJob::StartRequest() {
- request()->net_log().AddEvent(net::NetLog::TYPE_SERVICE_WORKER_START_REQUEST);
+ request()->net_log().AddEvent(
+ net::NetLogEventType::SERVICE_WORKER_START_REQUEST);
switch (response_type_) {
case NOT_DETERMINED:
« no previous file with comments | « content/browser/service_worker/service_worker_fetch_dispatcher.cc ('k') | extensions/browser/api/cast_channel/cast_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698