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

Side by Side Diff: Source/core/timing/Performance.cpp

Issue 102103002: Have HashMap<KeyType, AtomicString>::get() return a const reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use AtomicString::ConstructFromLiteral Created 7 years 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/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XMLHttpRequest.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r equestingDocument) 162 static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r equestingDocument)
163 { 163 {
164 AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicSt ring("timing-allow-origin")); 164 AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicSt ring("timing-allow-origin"));
165 165
166 RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url( )); 166 RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url( ));
167 if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin( ))) 167 if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin( )))
168 return true; 168 return true;
169 169
170 const String& timingAllowOriginString = response.httpHeaderField(timingAllow Origin); 170 const AtomicString& timingAllowOriginString = response.httpHeaderField(timin gAllowOrigin);
171 if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOrigin String, "null")) 171 if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOrigin String, "null"))
172 return false; 172 return false;
173 173
174 if (timingAllowOriginString == "*") 174 if (timingAllowOriginString == "*")
175 return true; 175 return true;
176 176
177 const String& securityOrigin = requestingDocument->securityOrigin()->toStrin g(); 177 const String& securityOrigin = requestingDocument->securityOrigin()->toStrin g();
178 Vector<String> timingAllowOrigins; 178 Vector<String> timingAllowOrigins;
179 timingAllowOriginString.split(" ", timingAllowOrigins); 179 timingAllowOriginString.string().split(" ", timingAllowOrigins);
180 for (size_t i = 0; i < timingAllowOrigins.size(); ++i) { 180 for (size_t i = 0; i < timingAllowOrigins.size(); ++i) {
181 if (timingAllowOrigins[i] == securityOrigin) 181 if (timingAllowOrigins[i] == securityOrigin)
182 return true; 182 return true;
183 } 183 }
184 184
185 return false; 185 return false;
186 } 186 }
187 187
188 static bool allowsTimingRedirect(const Vector<ResourceResponse>& redirectChain, const ResourceResponse& finalResponse, Document* initiatorDocument) 188 static bool allowsTimingRedirect(const Vector<ResourceResponse>& redirectChain, const ResourceResponse& finalResponse, Document* initiatorDocument)
189 { 189 {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 m_userTiming = UserTiming::create(this); 271 m_userTiming = UserTiming::create(this);
272 m_userTiming->clearMeasures(measureName); 272 m_userTiming->clearMeasures(measureName);
273 } 273 }
274 274
275 double Performance::now() const 275 double Performance::now() const
276 { 276 {
277 return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime); 277 return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime);
278 } 278 }
279 279
280 } // namespace WebCore 280 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698