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

Unified Diff: content/common/url_request_struct_traits.cc

Issue 2646343007: [Mojo-Loading] Implement URLLoader::SetPriority (Closed)
Patch Set: fix Created 3 years, 11 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/common/url_request_struct_traits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/url_request_struct_traits.cc
diff --git a/content/common/url_request_struct_traits.cc b/content/common/url_request_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..be0a3e42a1465135c0a57b51a0fa5a231a6fd1d8
--- /dev/null
+++ b/content/common/url_request_struct_traits.cc
@@ -0,0 +1,60 @@
+// Copyright 2017 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.
+
+#include "content/common/url_request_struct_traits.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+
+content::mojom::RequestPriority
+EnumTraits<content::mojom::RequestPriority, net::RequestPriority>::ToMojom(
+ net::RequestPriority priority) {
+ switch (priority) {
+ case net::THROTTLED:
+ return content::mojom::RequestPriority::kThrottled;
+ case net::IDLE:
+ return content::mojom::RequestPriority::kIdle;
+ case net::LOWEST:
+ return content::mojom::RequestPriority::kLowest;
+ case net::LOW:
+ return content::mojom::RequestPriority::kLow;
+ case net::MEDIUM:
+ return content::mojom::RequestPriority::kMedium;
+ case net::HIGHEST:
+ return content::mojom::RequestPriority::kHighest;
+ }
+ NOTREACHED();
+ return static_cast<content::mojom::RequestPriority>(priority);
+}
+
+bool EnumTraits<content::mojom::RequestPriority, net::RequestPriority>::
+ FromMojom(content::mojom::RequestPriority in, net::RequestPriority* out) {
+ switch (in) {
+ case content::mojom::RequestPriority::kThrottled:
+ *out = net::THROTTLED;
+ return true;
+ case content::mojom::RequestPriority::kIdle:
+ *out = net::IDLE;
+ return true;
+ case content::mojom::RequestPriority::kLowest:
+ *out = net::LOWEST;
+ return true;
+ case content::mojom::RequestPriority::kLow:
+ *out = net::LOW;
+ return true;
+ case content::mojom::RequestPriority::kMedium:
+ *out = net::MEDIUM;
+ return true;
+ case content::mojom::RequestPriority::kHighest:
+ *out = net::HIGHEST;
+ return true;
+ }
+
+ NOTREACHED();
+ *out = static_cast<net::RequestPriority>(in);
+ return true;
+}
+
+} // namespace mojo
« no previous file with comments | « content/common/url_request_struct_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698