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

Side by Side Diff: Source/modules/serviceworkers/Headers.cpp

Issue 630403002: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/modules/serviceworkers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « Source/modules/serviceworkers/Headers.h ('k') | Source/modules/serviceworkers/InstallEvent.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 // 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/dom/Iterator.h" 10 #include "core/dom/Iterator.h"
11 #include "core/fetch/FetchUtils.h" 11 #include "core/fetch/FetchUtils.h"
12 #include "core/xml/XMLHttpRequest.h" 12 #include "core/xml/XMLHttpRequest.h"
13 #include "wtf/NotFound.h" 13 #include "wtf/NotFound.h"
14 #include "wtf/PassRefPtr.h" 14 #include "wtf/PassRefPtr.h"
15 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
16 #include "wtf/text/WTFString.h" 16 #include "wtf/text/WTFString.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 namespace { 20 namespace {
21 21
22 class HeadersIterator FINAL : public Iterator { 22 class HeadersIterator final : public Iterator {
23 public: 23 public:
24 // Only KeyValue is currently used; the other types are to support 24 // Only KeyValue is currently used; the other types are to support
25 // Map-like iteration with entries(), keys() and values(), but this has 25 // Map-like iteration with entries(), keys() and values(), but this has
26 // not yet been added to any spec. 26 // not yet been added to any spec.
27 enum IterationType { KeyValue, Key, Value }; 27 enum IterationType { KeyValue, Key, Value };
28 28
29 HeadersIterator(FetchHeaderList* headers, IterationType type) : m_headers(he aders), m_type(type), m_current(0) { } 29 HeadersIterator(FetchHeaderList* headers, IterationType type) : m_headers(he aders), m_type(type), m_current(0) { }
30 30
31 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception ) OVERRIDE 31 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception ) override
32 { 32 {
33 // FIXME: This simply advances an index and returns the next value if 33 // FIXME: This simply advances an index and returns the next value if
34 // any, so if the iterated object is mutated values may be skipped. 34 // any, so if the iterated object is mutated values may be skipped.
35 v8::Isolate* isolate = scriptState->isolate(); 35 v8::Isolate* isolate = scriptState->isolate();
36 if (m_current >= m_headers->size()) 36 if (m_current >= m_headers->size())
37 return ScriptValue(scriptState, v8DoneIteratorResult(isolate)); 37 return ScriptValue(scriptState, v8DoneIteratorResult(isolate));
38 38
39 const FetchHeaderList::Header& header = m_headers->entry(m_current++); 39 const FetchHeaderList::Header& header = m_headers->entry(m_current++);
40 switch (m_type) { 40 switch (m_type) {
41 case KeyValue: { 41 case KeyValue: {
42 Vector<String> pair; 42 Vector<String> pair;
43 pair.append(header.first); 43 pair.append(header.first);
44 pair.append(header.second); 44 pair.append(header.second);
45 return ScriptValue(scriptState, v8IteratorResult(scriptState, pair)) ; 45 return ScriptValue(scriptState, v8IteratorResult(scriptState, pair)) ;
46 } 46 }
47 case Key: 47 case Key:
48 return ScriptValue(scriptState, v8IteratorResult(scriptState, header .first)); 48 return ScriptValue(scriptState, v8IteratorResult(scriptState, header .first));
49 49
50 case Value: 50 case Value:
51 return ScriptValue(scriptState, v8IteratorResult(scriptState, header .second)); 51 return ScriptValue(scriptState, v8IteratorResult(scriptState, header .second));
52 } 52 }
53 ASSERT_NOT_REACHED(); 53 ASSERT_NOT_REACHED();
54 return ScriptValue(); 54 return ScriptValue();
55 } 55 }
56 56
57 virtual ScriptValue next(ScriptState* scriptState, ScriptValue, ExceptionSta te& exceptionState) OVERRIDE 57 virtual ScriptValue next(ScriptState* scriptState, ScriptValue, ExceptionSta te& exceptionState) override
58 { 58 {
59 return next(scriptState, exceptionState); 59 return next(scriptState, exceptionState);
60 } 60 }
61 61
62 virtual void trace(Visitor* visitor) 62 virtual void trace(Visitor* visitor)
63 { 63 {
64 Iterator::trace(visitor); 64 Iterator::trace(visitor);
65 visitor->trace(m_headers); 65 visitor->trace(m_headers);
66 } 66 }
67 67
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 { 346 {
347 return new HeadersIterator(m_headerList, HeadersIterator::KeyValue); 347 return new HeadersIterator(m_headerList, HeadersIterator::KeyValue);
348 } 348 }
349 349
350 void Headers::trace(Visitor* visitor) 350 void Headers::trace(Visitor* visitor)
351 { 351 {
352 visitor->trace(m_headerList); 352 visitor->trace(m_headerList);
353 } 353 }
354 354
355 } // namespace blink 355 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/Headers.h ('k') | Source/modules/serviceworkers/InstallEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698