1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_BASE_REQUEST_PRIORITY_H_
6 #define NET_BASE_REQUEST_PRIORITY_H_
7 
8 #include "net/base/net_export.h"
9 
10 namespace net {
11 
12 // Prioritization used in various parts of the networking code such
13 // as connection prioritization and resource loading prioritization.
14 // A Java counterpart will be generated for this enum.
15 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
16 // GENERATED_JAVA_CLASS_NAME_OVERRIDE: RequestPriority
17 //
18 // This enum should be synchronized with the enum NetRequestPriority in
19 // tools/metrics/histograms/enums.xml.
20 enum RequestPriority {
21   THROTTLED = 0,  // Used to signal that resources
22                   // should be reserved for following
23                   // requests (i.e. that higher priority
24                   // following requests are expected).
25   MINIMUM_PRIORITY = THROTTLED,
26   IDLE = 1,  // Default "as resources available" level.
27   LOWEST = 2,
28   DEFAULT_PRIORITY = LOWEST,
29   LOW = 3,
30   MEDIUM = 4,
31   HIGHEST = 5,
32   MAXIMUM_PRIORITY = HIGHEST,
33 };
34 
35 // For simplicity, one can assume that one can index into array of
36 // NUM_PRIORITIES elements with a RequestPriority (i.e.,
37 // MINIMUM_PRIORITY == 0).
38 enum RequestPrioritySize {
39   NUM_PRIORITIES = MAXIMUM_PRIORITY + 1,
40 };
41 
42 NET_EXPORT const char* RequestPriorityToString(RequestPriority priority);
43 
44 }  // namespace net
45 
46 #endif  // NET_BASE_REQUEST_PRIORITY_H_
47