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

Side by Side Diff: Source/platform/weborigin/SecurityPolicy.cpp

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 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
« no previous file with comments | « Source/platform/network/WebSocketHandshakeRequest.cpp ('k') | Source/wtf/HashCountedSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 * 7 *
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO rigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains) 113 void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO rigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
114 { 114 {
115 ASSERT(isMainThread()); 115 ASSERT(isMainThread());
116 ASSERT(!sourceOrigin.isUnique()); 116 ASSERT(!sourceOrigin.isUnique());
117 if (sourceOrigin.isUnique()) 117 if (sourceOrigin.isUnique())
118 return; 118 return;
119 119
120 String sourceString = sourceOrigin.toString(); 120 String sourceString = sourceOrigin.toString();
121 OriginAccessMap::AddResult result = originAccessMap().add(sourceString, null ptr); 121 OriginAccessMap::AddResult result = originAccessMap().add(sourceString, null ptr);
122 if (result.isNewEntry) 122 if (result.isNewEntry)
123 result.iterator->value = adoptPtr(new OriginAccessWhiteList); 123 result.storedValue->value = adoptPtr(new OriginAccessWhiteList);
124 124
125 OriginAccessWhiteList* list = result.iterator->value.get(); 125 OriginAccessWhiteList* list = result.storedValue->value.get();
126 list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allow DestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry:: DisallowSubdomains, OriginAccessEntry::TreatIPAddressAsIPAddress)); 126 list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allow DestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry:: DisallowSubdomains, OriginAccessEntry::TreatIPAddressAsIPAddress));
127 } 127 }
128 128
129 void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sour ceOrigin, const String& destinationProtocol, const String& destinationDomain, bo ol allowDestinationSubdomains) 129 void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sour ceOrigin, const String& destinationProtocol, const String& destinationDomain, bo ol allowDestinationSubdomains)
130 { 130 {
131 ASSERT(isMainThread()); 131 ASSERT(isMainThread());
132 ASSERT(!sourceOrigin.isUnique()); 132 ASSERT(!sourceOrigin.isUnique());
133 if (sourceOrigin.isUnique()) 133 if (sourceOrigin.isUnique())
134 return; 134 return;
135 135
(...skipping 14 matching lines...) Expand all
150 map.remove(it); 150 map.remove(it);
151 } 151 }
152 152
153 void SecurityPolicy::resetOriginAccessWhitelists() 153 void SecurityPolicy::resetOriginAccessWhitelists()
154 { 154 {
155 ASSERT(isMainThread()); 155 ASSERT(isMainThread());
156 originAccessMap().clear(); 156 originAccessMap().clear();
157 } 157 }
158 158
159 } // namespace WebCore 159 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/network/WebSocketHandshakeRequest.cpp ('k') | Source/wtf/HashCountedSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698