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

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

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 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) 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void Performance::webkitSetResourceTimingBufferSize(unsigned size) 156 void Performance::webkitSetResourceTimingBufferSize(unsigned size)
157 { 157 {
158 m_resourceTimingBufferSize = size; 158 m_resourceTimingBufferSize = size;
159 if (isResourceTimingBufferFull()) 159 if (isResourceTimingBufferFull())
160 dispatchEvent(Event::create(EventTypeNames::webkitresourcetimingbufferfu ll)); 160 dispatchEvent(Event::create(EventTypeNames::webkitresourcetimingbufferfu ll));
161 } 161 }
162 162
163 static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r equestingDocument, const AtomicString& originalTimingAllowOrigin) 163 static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r equestingDocument, const AtomicString& originalTimingAllowOrigin)
164 { 164 {
165 AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicSt ring("timing-allow-origin")); 165 AtomicallyInitializedStaticReference(AtomicString, timingAllowOrigin, new At omicString("timing-allow-origin"));
166 166
167 RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url( )); 167 RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url( ));
168 if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin( ))) 168 if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin( )))
169 return true; 169 return true;
170 170
171 const AtomicString& timingAllowOriginString = originalTimingAllowOrigin.isEm pty() ? response.httpHeaderField(timingAllowOrigin) : originalTimingAllowOrigin; 171 const AtomicString& timingAllowOriginString = originalTimingAllowOrigin.isEm pty() ? response.httpHeaderField(timingAllowOrigin) : originalTimingAllowOrigin;
172 if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOrigin String, "null")) 172 if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOrigin String, "null"))
173 return false; 173 return false;
174 174
175 if (timingAllowOriginString == starAtom) 175 if (timingAllowOriginString == starAtom)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 { 282 {
283 visitor->trace(m_navigation); 283 visitor->trace(m_navigation);
284 visitor->trace(m_timing); 284 visitor->trace(m_timing);
285 visitor->trace(m_resourceTimingBuffer); 285 visitor->trace(m_resourceTimingBuffer);
286 visitor->trace(m_userTiming); 286 visitor->trace(m_userTiming);
287 EventTargetWithInlineData::trace(visitor); 287 EventTargetWithInlineData::trace(visitor);
288 DOMWindowProperty::trace(visitor); 288 DOMWindowProperty::trace(visitor);
289 } 289 }
290 290
291 } // namespace blink 291 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698