OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 46 |
47 ResourceError() | 47 ResourceError() |
48 : m_errorCode(0), | 48 : m_errorCode(0), |
49 m_isNull(true), | 49 m_isNull(true), |
50 m_isCancellation(false), | 50 m_isCancellation(false), |
51 m_isAccessCheck(false), | 51 m_isAccessCheck(false), |
52 m_isTimeout(false), | 52 m_isTimeout(false), |
53 m_staleCopyInCache(false), | 53 m_staleCopyInCache(false), |
54 m_wasIgnoredByHandler(false) {} | 54 m_wasIgnoredByHandler(false), |
| 55 m_isCacheMiss(false) {} |
55 | 56 |
56 ResourceError(const String& domain, | 57 ResourceError(const String& domain, |
57 int errorCode, | 58 int errorCode, |
58 const String& failingURL, | 59 const String& failingURL, |
59 const String& localizedDescription) | 60 const String& localizedDescription) |
60 : m_domain(domain), | 61 : m_domain(domain), |
61 m_errorCode(errorCode), | 62 m_errorCode(errorCode), |
62 m_failingURL(failingURL), | 63 m_failingURL(failingURL), |
63 m_localizedDescription(localizedDescription), | 64 m_localizedDescription(localizedDescription), |
64 m_isNull(false), | 65 m_isNull(false), |
65 m_isCancellation(false), | 66 m_isCancellation(false), |
66 m_isAccessCheck(false), | 67 m_isAccessCheck(false), |
67 m_isTimeout(false), | 68 m_isTimeout(false), |
68 m_staleCopyInCache(false), | 69 m_staleCopyInCache(false), |
69 m_wasIgnoredByHandler(false) {} | 70 m_wasIgnoredByHandler(false), |
| 71 m_isCacheMiss(false) {} |
70 | 72 |
71 // Makes a deep copy. Useful for when you need to use a ResourceError on | 73 // Makes a deep copy. Useful for when you need to use a ResourceError on |
72 // another thread. | 74 // another thread. |
73 ResourceError copy() const; | 75 ResourceError copy() const; |
74 | 76 |
75 bool isNull() const { return m_isNull; } | 77 bool isNull() const { return m_isNull; } |
76 | 78 |
77 const String& domain() const { return m_domain; } | 79 const String& domain() const { return m_domain; } |
78 int errorCode() const { return m_errorCode; } | 80 int errorCode() const { return m_errorCode; } |
79 const String& failingURL() const { return m_failingURL; } | 81 const String& failingURL() const { return m_failingURL; } |
(...skipping 12 matching lines...) Expand all Loading... |
92 void setStaleCopyInCache(bool staleCopyInCache) { | 94 void setStaleCopyInCache(bool staleCopyInCache) { |
93 m_staleCopyInCache = staleCopyInCache; | 95 m_staleCopyInCache = staleCopyInCache; |
94 } | 96 } |
95 bool staleCopyInCache() const { return m_staleCopyInCache; } | 97 bool staleCopyInCache() const { return m_staleCopyInCache; } |
96 | 98 |
97 void setWasIgnoredByHandler(bool ignoredByHandler) { | 99 void setWasIgnoredByHandler(bool ignoredByHandler) { |
98 m_wasIgnoredByHandler = ignoredByHandler; | 100 m_wasIgnoredByHandler = ignoredByHandler; |
99 } | 101 } |
100 bool wasIgnoredByHandler() const { return m_wasIgnoredByHandler; } | 102 bool wasIgnoredByHandler() const { return m_wasIgnoredByHandler; } |
101 | 103 |
| 104 void setIsCacheMiss(bool isCacheMiss) { m_isCacheMiss = isCacheMiss; } |
| 105 bool isCacheMiss() const { return m_isCacheMiss; } |
| 106 |
102 static bool compare(const ResourceError&, const ResourceError&); | 107 static bool compare(const ResourceError&, const ResourceError&); |
103 | 108 |
104 private: | 109 private: |
105 String m_domain; | 110 String m_domain; |
106 int m_errorCode; | 111 int m_errorCode; |
107 String m_failingURL; | 112 String m_failingURL; |
108 String m_localizedDescription; | 113 String m_localizedDescription; |
109 bool m_isNull; | 114 bool m_isNull; |
110 bool m_isCancellation; | 115 bool m_isCancellation; |
111 bool m_isAccessCheck; | 116 bool m_isAccessCheck; |
112 bool m_isTimeout; | 117 bool m_isTimeout; |
113 bool m_staleCopyInCache; | 118 bool m_staleCopyInCache; |
114 bool m_wasIgnoredByHandler; | 119 bool m_wasIgnoredByHandler; |
| 120 bool m_isCacheMiss; |
115 }; | 121 }; |
116 | 122 |
117 inline bool operator==(const ResourceError& a, const ResourceError& b) { | 123 inline bool operator==(const ResourceError& a, const ResourceError& b) { |
118 return ResourceError::compare(a, b); | 124 return ResourceError::compare(a, b); |
119 } | 125 } |
120 inline bool operator!=(const ResourceError& a, const ResourceError& b) { | 126 inline bool operator!=(const ResourceError& a, const ResourceError& b) { |
121 return !(a == b); | 127 return !(a == b); |
122 } | 128 } |
123 | 129 |
124 // Pretty printer for gtest. Declared here to avoid ODR violations. | 130 // Pretty printer for gtest. Declared here to avoid ODR violations. |
125 std::ostream& operator<<(std::ostream&, const ResourceError&); | 131 std::ostream& operator<<(std::ostream&, const ResourceError&); |
126 | 132 |
127 } // namespace blink | 133 } // namespace blink |
128 | 134 |
129 #endif // ResourceError_h | 135 #endif // ResourceError_h |
OLD | NEW |