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

Unified Diff: Source/modules/serviceworkers/Headers.cpp

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: Created 6 years, 4 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/modules/serviceworkers/Headers.h ('k') | Source/modules/webaudio/AudioNode.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/Headers.cpp
diff --git a/Source/modules/serviceworkers/Headers.cpp b/Source/modules/serviceworkers/Headers.cpp
index 0493a4cd859f4b12aae4263e09e138d5d5cfd2ba..e4e1933ab864a2d4b1842165ff28bcb321242e2b 100644
--- a/Source/modules/serviceworkers/Headers.cpp
+++ b/Source/modules/serviceworkers/Headers.cpp
@@ -210,14 +210,17 @@ void Headers::set(const String& name, const String& value, ExceptionState& excep
m_headerList->set(name, value);
}
-void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue& thisArg)
+void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback, const Optional<ScriptValue>& thisArg)
{
- forEachInternal(callback, &thisArg);
-}
-
-void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback)
-{
- forEachInternal(callback, 0);
+ TrackExceptionState exceptionState;
+ for (size_t i = 0; i < m_headerList->size(); ++i) {
+ if (thisArg.isMissing())
+ callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
+ else
+ callback->handleItem(thisArg.get(), m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
+ if (exceptionState.hadException())
+ break;
+ }
}
void Headers::fillWith(const Headers* object, ExceptionState& exceptionState)
@@ -309,19 +312,6 @@ Headers::Headers(FetchHeaderList* headerList)
ScriptWrappable::init(this);
}
-void Headers::forEachInternal(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue* thisArg)
-{
- TrackExceptionState exceptionState;
- for (size_t i = 0; i < m_headerList->size(); ++i) {
- if (thisArg)
- callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
- else
- callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
- if (exceptionState.hadException())
- break;
- }
-}
-
void Headers::trace(Visitor* visitor)
{
visitor->trace(m_headerList);
« no previous file with comments | « Source/modules/serviceworkers/Headers.h ('k') | Source/modules/webaudio/AudioNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698