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

Side by Side Diff: third_party/WebKit/Source/platform/network/ResourceError.h

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: check ERR_CACHE_MISS directly in ResourceError Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 25 matching lines...) Expand all
36 36
37 // Used for errors that won't be exposed to clients. 37 // Used for errors that won't be exposed to clients.
38 PLATFORM_EXPORT extern const char errorDomainBlinkInternal[]; 38 PLATFORM_EXPORT extern const char errorDomainBlinkInternal[];
39 39
40 class PLATFORM_EXPORT ResourceError final { 40 class PLATFORM_EXPORT ResourceError final {
41 DISALLOW_NEW(); 41 DISALLOW_NEW();
42 42
43 public: 43 public:
44 static ResourceError cancelledError(const String& failingURL); 44 static ResourceError cancelledError(const String& failingURL);
45 static ResourceError cancelledDueToAccessCheckError(const String& failingURL); 45 static ResourceError cancelledDueToAccessCheckError(const String& failingURL);
46 static ResourceError cacheMissError();
46 47
47 ResourceError() 48 ResourceError()
48 : m_errorCode(0), 49 : m_errorCode(0),
49 m_isNull(true), 50 m_isNull(true),
50 m_isCancellation(false), 51 m_isCancellation(false),
51 m_isAccessCheck(false), 52 m_isAccessCheck(false),
52 m_isTimeout(false), 53 m_isTimeout(false),
53 m_staleCopyInCache(false), 54 m_staleCopyInCache(false),
54 m_wasIgnoredByHandler(false) {} 55 m_wasIgnoredByHandler(false) {}
55 56
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void setStaleCopyInCache(bool staleCopyInCache) { 93 void setStaleCopyInCache(bool staleCopyInCache) {
93 m_staleCopyInCache = staleCopyInCache; 94 m_staleCopyInCache = staleCopyInCache;
94 } 95 }
95 bool staleCopyInCache() const { return m_staleCopyInCache; } 96 bool staleCopyInCache() const { return m_staleCopyInCache; }
96 97
97 void setWasIgnoredByHandler(bool ignoredByHandler) { 98 void setWasIgnoredByHandler(bool ignoredByHandler) {
98 m_wasIgnoredByHandler = ignoredByHandler; 99 m_wasIgnoredByHandler = ignoredByHandler;
99 } 100 }
100 bool wasIgnoredByHandler() const { return m_wasIgnoredByHandler; } 101 bool wasIgnoredByHandler() const { return m_wasIgnoredByHandler; }
101 102
103 bool isCacheMiss() const;
104
102 static bool compare(const ResourceError&, const ResourceError&); 105 static bool compare(const ResourceError&, const ResourceError&);
103 106
104 private: 107 private:
105 String m_domain; 108 String m_domain;
106 int m_errorCode; 109 int m_errorCode;
107 String m_failingURL; 110 String m_failingURL;
108 String m_localizedDescription; 111 String m_localizedDescription;
109 bool m_isNull; 112 bool m_isNull;
110 bool m_isCancellation; 113 bool m_isCancellation;
111 bool m_isAccessCheck; 114 bool m_isAccessCheck;
112 bool m_isTimeout; 115 bool m_isTimeout;
113 bool m_staleCopyInCache; 116 bool m_staleCopyInCache;
114 bool m_wasIgnoredByHandler; 117 bool m_wasIgnoredByHandler;
115 }; 118 };
116 119
117 inline bool operator==(const ResourceError& a, const ResourceError& b) { 120 inline bool operator==(const ResourceError& a, const ResourceError& b) {
118 return ResourceError::compare(a, b); 121 return ResourceError::compare(a, b);
119 } 122 }
120 inline bool operator!=(const ResourceError& a, const ResourceError& b) { 123 inline bool operator!=(const ResourceError& a, const ResourceError& b) {
121 return !(a == b); 124 return !(a == b);
122 } 125 }
123 126
124 // Pretty printer for gtest. Declared here to avoid ODR violations. 127 // Pretty printer for gtest. Declared here to avoid ODR violations.
125 std::ostream& operator<<(std::ostream&, const ResourceError&); 128 std::ostream& operator<<(std::ostream&, const ResourceError&);
126 129
127 } // namespace blink 130 } // namespace blink
128 131
129 #endif // ResourceError_h 132 #endif // ResourceError_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698