OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/Headers.h" | 6 #include "modules/serviceworkers/Headers.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "core/fetch/FetchUtils.h" | 10 #include "core/fetch/FetchUtils.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 append(keys[i], value, exceptionState); | 290 append(keys[i], value, exceptionState); |
291 if (exceptionState.hadException()) | 291 if (exceptionState.hadException()) |
292 return; | 292 return; |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 Headers::Headers() | 296 Headers::Headers() |
297 : m_headerList(FetchHeaderList::create()) | 297 : m_headerList(FetchHeaderList::create()) |
298 , m_guard(NoneGuard) | 298 , m_guard(NoneGuard) |
299 { | 299 { |
300 ScriptWrappable::init(this); | |
301 } | 300 } |
302 | 301 |
303 Headers::Headers(FetchHeaderList* headerList) | 302 Headers::Headers(FetchHeaderList* headerList) |
304 : m_headerList(headerList) | 303 : m_headerList(headerList) |
305 , m_guard(NoneGuard) | 304 , m_guard(NoneGuard) |
306 { | 305 { |
307 ScriptWrappable::init(this); | |
308 } | 306 } |
309 | 307 |
310 void Headers::forEachInternal(PassOwnPtrWillBeRawPtr<HeadersForEachCallback> cal
lback, const ScriptValue* thisArg) | 308 void Headers::forEachInternal(PassOwnPtrWillBeRawPtr<HeadersForEachCallback> cal
lback, const ScriptValue* thisArg) |
311 { | 309 { |
312 TrackExceptionState exceptionState; | 310 TrackExceptionState exceptionState; |
313 for (size_t i = 0; i < m_headerList->size(); ++i) { | 311 for (size_t i = 0; i < m_headerList->size(); ++i) { |
314 if (thisArg) | 312 if (thisArg) |
315 callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_he
aderList->list()[i]->first, this); | 313 callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_he
aderList->list()[i]->first, this); |
316 else | 314 else |
317 callback->handleItem(m_headerList->list()[i]->second, m_headerList->
list()[i]->first, this); | 315 callback->handleItem(m_headerList->list()[i]->second, m_headerList->
list()[i]->first, this); |
318 if (exceptionState.hadException()) | 316 if (exceptionState.hadException()) |
319 break; | 317 break; |
320 } | 318 } |
321 } | 319 } |
322 | 320 |
323 void Headers::trace(Visitor* visitor) | 321 void Headers::trace(Visitor* visitor) |
324 { | 322 { |
325 visitor->trace(m_headerList); | 323 visitor->trace(m_headerList); |
326 } | 324 } |
327 | 325 |
328 } // namespace blink | 326 } // namespace blink |
OLD | NEW |