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

Unified Diff: Source/core/timing/Performance.cpp

Issue 663693005: Use C++11 features in core/timing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/timing/Performance.h ('k') | Source/core/timing/PerformanceTiming.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/timing/Performance.cpp
diff --git a/Source/core/timing/Performance.cpp b/Source/core/timing/Performance.cpp
index 6d5c0ba47a6b7925e35885dffb117527a8d26286..1b7af0801ddaa18adb83790644e3df584d681ec6 100644
--- a/Source/core/timing/Performance.cpp
+++ b/Source/core/timing/Performance.cpp
@@ -65,7 +65,7 @@ const AtomicString& Performance::interfaceName() const
ExecutionContext* Performance::executionContext() const
{
if (!frame())
- return 0;
+ return nullptr;
return frame()->document();
}
@@ -109,9 +109,10 @@ PerformanceEntryVector Performance::getEntriesByType(const String& entryType)
{
PerformanceEntryVector entries;
- if (equalIgnoringCase(entryType, "resource"))
- for (PerformanceEntryVector::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
- entries.append(*resource);
+ if (equalIgnoringCase(entryType, "resource")) {
+ for (const auto& resource : m_resourceTimingBuffer)
+ entries.append(resource);
+ }
if (m_userTiming) {
if (equalIgnoringCase(entryType, "mark"))
@@ -128,10 +129,12 @@ PerformanceEntryVector Performance::getEntriesByName(const String& name, const S
{
PerformanceEntryVector entries;
- if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
- for (PerformanceEntryVector::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
- if ((*resource)->name() == name)
- entries.append(*resource);
+ if (entryType.isNull() || equalIgnoringCase(entryType, "resource")) {
+ for (const auto& resource : m_resourceTimingBuffer) {
+ if (resource->name() == name)
+ entries.append(resource);
+ }
+ }
if (m_userTiming) {
if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
@@ -174,8 +177,8 @@ static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r
const String& securityOrigin = requestingDocument->securityOrigin()->toString();
Vector<String> timingAllowOrigins;
timingAllowOriginString.string().split(' ', timingAllowOrigins);
- for (size_t i = 0; i < timingAllowOrigins.size(); ++i) {
- if (timingAllowOrigins[i] == securityOrigin)
+ for (const String& allowOrigin : timingAllowOrigins) {
+ if (allowOrigin == securityOrigin)
return true;
}
@@ -187,8 +190,8 @@ static bool allowsTimingRedirect(const Vector<ResourceResponse>& redirectChain,
if (!passesTimingAllowCheck(finalResponse, initiatorDocument, emptyAtom))
return false;
- for (size_t i = 0; i < redirectChain.size(); i++) {
- if (!passesTimingAllowCheck(redirectChain[i], initiatorDocument, emptyAtom))
+ for (const ResourceResponse& response : redirectChain) {
+ if (!passesTimingAllowCheck(response, initiatorDocument, emptyAtom))
return false;
}
« no previous file with comments | « Source/core/timing/Performance.h ('k') | Source/core/timing/PerformanceTiming.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698