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

Side by Side Diff: Source/modules/serviceworkers/RespondWithObserver.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
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/RespondWithObserver.h" 6 #include "modules/serviceworkers/RespondWithObserver.h"
7 7
8 #include "bindings/core/v8/ScriptFunction.h" 8 #include "bindings/core/v8/ScriptFunction.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/modules/v8/V8Response.h" 12 #include "bindings/modules/v8/V8Response.h"
13 #include "core/dom/ExecutionContext.h" 13 #include "core/dom/ExecutionContext.h"
14 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 14 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
15 #include "platform/RuntimeEnabledFeatures.h" 15 #include "platform/RuntimeEnabledFeatures.h"
16 #include "public/platform/WebServiceWorkerResponse.h" 16 #include "public/platform/WebServiceWorkerResponse.h"
17 #include "wtf/Assertions.h" 17 #include "wtf/Assertions.h"
18 #include "wtf/RefPtr.h" 18 #include "wtf/RefPtr.h"
19 #include <v8.h> 19 #include <v8.h>
20 20
21 namespace blink { 21 namespace blink {
22 22
23 class RespondWithObserver::ThenFunction FINAL : public ScriptFunction { 23 class RespondWithObserver::ThenFunction final : public ScriptFunction {
24 public: 24 public:
25 enum ResolveType { 25 enum ResolveType {
26 Fulfilled, 26 Fulfilled,
27 Rejected, 27 Rejected,
28 }; 28 };
29 29
30 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, Res pondWithObserver* observer, ResolveType type) 30 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, Res pondWithObserver* observer, ResolveType type)
31 { 31 {
32 ThenFunction* self = new ThenFunction(scriptState, observer, type); 32 ThenFunction* self = new ThenFunction(scriptState, observer, type);
33 return self->bindToV8Function(); 33 return self->bindToV8Function();
34 } 34 }
35 35
36 virtual void trace(Visitor* visitor) OVERRIDE 36 virtual void trace(Visitor* visitor) override
37 { 37 {
38 visitor->trace(m_observer); 38 visitor->trace(m_observer);
39 ScriptFunction::trace(visitor); 39 ScriptFunction::trace(visitor);
40 } 40 }
41 41
42 private: 42 private:
43 ThenFunction(ScriptState* scriptState, RespondWithObserver* observer, Resolv eType type) 43 ThenFunction(ScriptState* scriptState, RespondWithObserver* observer, Resolv eType type)
44 : ScriptFunction(scriptState) 44 : ScriptFunction(scriptState)
45 , m_observer(observer) 45 , m_observer(observer)
46 , m_resolveType(type) 46 , m_resolveType(type)
47 { 47 {
48 } 48 }
49 49
50 virtual ScriptValue call(ScriptValue value) OVERRIDE 50 virtual ScriptValue call(ScriptValue value) override
51 { 51 {
52 ASSERT(m_observer); 52 ASSERT(m_observer);
53 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected); 53 ASSERT(m_resolveType == Fulfilled || m_resolveType == Rejected);
54 if (m_resolveType == Rejected) 54 if (m_resolveType == Rejected)
55 m_observer->responseWasRejected(); 55 m_observer->responseWasRejected();
56 else 56 else
57 m_observer->responseWasFulfilled(value); 57 m_observer->responseWasFulfilled(value);
58 m_observer = nullptr; 58 m_observer = nullptr;
59 return value; 59 return value;
60 } 60 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType ) 136 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID, WebURLRequest::FetchRequestMode requestMode, WebURLRequest::FrameType frameType )
137 : ContextLifecycleObserver(context) 137 : ContextLifecycleObserver(context)
138 , m_eventID(eventID) 138 , m_eventID(eventID)
139 , m_requestMode(requestMode) 139 , m_requestMode(requestMode)
140 , m_frameType(frameType) 140 , m_frameType(frameType)
141 , m_state(Initial) 141 , m_state(Initial)
142 { 142 {
143 } 143 }
144 144
145 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.h ('k') | Source/modules/serviceworkers/Response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698