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

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

Issue 138493002: Added field to error structures to signal existence of a stale copy in (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 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 class PLATFORM_EXPORT ResourceError { 37 class PLATFORM_EXPORT ResourceError {
38 public: 38 public:
39 static ResourceError cancelledError(const String& failingURL); 39 static ResourceError cancelledError(const String& failingURL);
40 40
41 ResourceError() 41 ResourceError()
42 : m_errorCode(0) 42 : m_errorCode(0)
43 , m_isNull(true) 43 , m_isNull(true)
44 , m_isCancellation(false) 44 , m_isCancellation(false)
45 , m_isTimeout(false) 45 , m_isTimeout(false)
46 , m_staleCopyInCache(false)
46 { 47 {
47 } 48 }
48 49
49 ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription) 50 ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
50 : m_domain(domain) 51 : m_domain(domain)
51 , m_errorCode(errorCode) 52 , m_errorCode(errorCode)
52 , m_failingURL(failingURL) 53 , m_failingURL(failingURL)
53 , m_localizedDescription(localizedDescription) 54 , m_localizedDescription(localizedDescription)
54 , m_isNull(false) 55 , m_isNull(false)
55 , m_isCancellation(false) 56 , m_isCancellation(false)
56 , m_isTimeout(false) 57 , m_isTimeout(false)
58 , m_staleCopyInCache(false)
57 { 59 {
58 } 60 }
59 61
60 // Makes a deep copy. Useful for when you need to use a ResourceError on ano ther thread. 62 // Makes a deep copy. Useful for when you need to use a ResourceError on ano ther thread.
61 ResourceError copy() const; 63 ResourceError copy() const;
62 64
63 bool isNull() const { return m_isNull; } 65 bool isNull() const { return m_isNull; }
64 66
65 const String& domain() const { return m_domain; } 67 const String& domain() const { return m_domain; }
66 int errorCode() const { return m_errorCode; } 68 int errorCode() const { return m_errorCode; }
67 const String& failingURL() const { return m_failingURL; } 69 const String& failingURL() const { return m_failingURL; }
68 const String& localizedDescription() const { return m_localizedDescription; } 70 const String& localizedDescription() const { return m_localizedDescription; }
69 71
70 void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellat ion; } 72 void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellat ion; }
71 bool isCancellation() const { return m_isCancellation; } 73 bool isCancellation() const { return m_isCancellation; }
72 74
73 void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; } 75 void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; }
74 bool isTimeout() const { return m_isTimeout; } 76 bool isTimeout() const { return m_isTimeout; }
77 void setStaleCopyInCache(bool staleCopyInCache) { m_staleCopyInCache = stale CopyInCache; }
78 bool staleCopyInCache() const { return m_staleCopyInCache; }
75 79
76 static bool compare(const ResourceError&, const ResourceError&); 80 static bool compare(const ResourceError&, const ResourceError&);
77 81
78 private: 82 private:
79 String m_domain; 83 String m_domain;
80 int m_errorCode; 84 int m_errorCode;
81 String m_failingURL; 85 String m_failingURL;
82 String m_localizedDescription; 86 String m_localizedDescription;
83 bool m_isNull; 87 bool m_isNull;
84 bool m_isCancellation; 88 bool m_isCancellation;
85 bool m_isTimeout; 89 bool m_isTimeout;
90 bool m_staleCopyInCache;
86 }; 91 };
87 92
88 inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceError::compare(a, b); } 93 inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceError::compare(a, b); }
89 inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); } 94 inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
90 95
91 } // namespace WebCore 96 } // namespace WebCore
92 97
93 #endif // ResourceError_h 98 #endif // ResourceError_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698