request_priority.h 1.5 KB

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