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

Side by Side Diff: third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h

Issue 2324033004: Fix "More than one command on the same line" presubmit errors: core/fetch,loader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: decreasePreloadCount() Created 4 years, 3 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 22 matching lines...) Expand all
33 #include "wtf/HashSet.h" 33 #include "wtf/HashSet.h"
34 #include "wtf/text/StringHash.h" 34 #include "wtf/text/StringHash.h"
35 #include <memory> 35 #include <memory>
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class HTTPHeaderMap; 39 class HTTPHeaderMap;
40 class ResourceResponse; 40 class ResourceResponse;
41 41
42 class CrossOriginPreflightResultCacheItem { 42 class CrossOriginPreflightResultCacheItem {
43 WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCacheItem); USING_FAST_MALLOC (CrossOriginPreflightResultCacheItem); 43 WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCacheItem);
44 USING_FAST_MALLOC(CrossOriginPreflightResultCacheItem);
44 public: 45 public:
45 CrossOriginPreflightResultCacheItem(StoredCredentials credentials) 46 CrossOriginPreflightResultCacheItem(StoredCredentials credentials)
46 : m_absoluteExpiryTime(0) 47 : m_absoluteExpiryTime(0)
47 , m_credentials(credentials) 48 , m_credentials(credentials)
48 { 49 {
49 } 50 }
50 51
51 bool parse(const ResourceResponse&, String& errorDescription); 52 bool parse(const ResourceResponse&, String& errorDescription);
52 bool allowsCrossOriginMethod(const String&, String& errorDescription) const; 53 bool allowsCrossOriginMethod(const String&, String& errorDescription) const;
53 bool allowsCrossOriginHeaders(const HTTPHeaderMap&, String& errorDescription ) const; 54 bool allowsCrossOriginHeaders(const HTTPHeaderMap&, String& errorDescription ) const;
54 bool allowsRequest(StoredCredentials, const String& method, const HTTPHeader Map& requestHeaders) const; 55 bool allowsRequest(StoredCredentials, const String& method, const HTTPHeader Map& requestHeaders) const;
55 56
56 private: 57 private:
57 typedef HashSet<String, CaseFoldingHash> HeadersSet; 58 typedef HashSet<String, CaseFoldingHash> HeadersSet;
58 59
59 // FIXME: A better solution to holding onto the absolute expiration time mig ht be 60 // FIXME: A better solution to holding onto the absolute expiration time mig ht be
60 // to start a timer for the expiration delta that removes this from the cach e when 61 // to start a timer for the expiration delta that removes this from the cach e when
61 // it fires. 62 // it fires.
62 double m_absoluteExpiryTime; 63 double m_absoluteExpiryTime;
63 StoredCredentials m_credentials; 64 StoredCredentials m_credentials;
64 HashSet<String> m_methods; 65 HashSet<String> m_methods;
65 HeadersSet m_headers; 66 HeadersSet m_headers;
66 }; 67 };
67 68
68 class CrossOriginPreflightResultCache { 69 class CrossOriginPreflightResultCache {
69 WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCache); USING_FAST_MALLOC(Cro ssOriginPreflightResultCache); 70 WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCache);
71 USING_FAST_MALLOC(CrossOriginPreflightResultCache);
70 public: 72 public:
71 static CrossOriginPreflightResultCache& shared(); 73 static CrossOriginPreflightResultCache& shared();
72 74
73 void appendEntry(const String& origin, const KURL&, std::unique_ptr<CrossOri ginPreflightResultCacheItem>); 75 void appendEntry(const String& origin, const KURL&, std::unique_ptr<CrossOri ginPreflightResultCacheItem>);
74 bool canSkipPreflight(const String& origin, const KURL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders); 76 bool canSkipPreflight(const String& origin, const KURL&, StoredCredentials, const String& method, const HTTPHeaderMap& requestHeaders);
75 77
76 private: 78 private:
77 CrossOriginPreflightResultCache() { } 79 CrossOriginPreflightResultCache() { }
78 80
79 typedef HashMap<std::pair<String, KURL>, std::unique_ptr<CrossOriginPrefligh tResultCacheItem>> CrossOriginPreflightResultHashMap; 81 typedef HashMap<std::pair<String, KURL>, std::unique_ptr<CrossOriginPrefligh tResultCacheItem>> CrossOriginPreflightResultHashMap;
80 82
81 CrossOriginPreflightResultHashMap m_preflightHashMap; 83 CrossOriginPreflightResultHashMap m_preflightHashMap;
82 }; 84 };
83 85
84 } // namespace blink 86 } // namespace blink
85 87
86 #endif 88 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698