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

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

Issue 478693005: Oilpan: Ship Oilpan for serviceworkers/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void ServiceWorkerGlobalScope::stopFetch() 81 void ServiceWorkerGlobalScope::stopFetch()
82 { 82 {
83 m_fetchManager.clear(); 83 m_fetchManager.clear();
84 } 84 }
85 85
86 String ServiceWorkerGlobalScope::scope(ExecutionContext* context) 86 String ServiceWorkerGlobalScope::scope(ExecutionContext* context)
87 { 87 {
88 return ServiceWorkerGlobalScopeClient::from(context)->scope().string(); 88 return ServiceWorkerGlobalScopeClient::from(context)->scope().string();
89 } 89 }
90 90
91 PassRefPtrWillBeRawPtr<CacheStorage> ServiceWorkerGlobalScope::caches(ExecutionC ontext* context) 91 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context)
92 { 92 {
93 if (!m_caches) 93 if (!m_caches)
94 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con text)->cacheStorage()); 94 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con text)->cacheStorage());
95 return m_caches; 95 return m_caches;
96 } 96 }
97 97
98 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request) 98 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request)
99 { 99 {
100 if (!m_fetchManager) 100 if (!m_fetchManager)
101 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 101 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
102 // "Let |r| be the associated request of the result of invoking the initial 102 // "Let |r| be the associated request of the result of invoking the initial
103 // value of Request as constructor with |input| and |init| as arguments. If 103 // value of Request as constructor with |input| and |init| as arguments. If
104 // this throws an exception, reject |p| with it." 104 // this throws an exception, reject |p| with it."
105 TrackExceptionState exceptionState; 105 TrackExceptionState exceptionState;
106 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, exceptionStat e); 106 Request* r = Request::create(this, request, exceptionState);
107 if (exceptionState.hadException()) { 107 if (exceptionState.hadException()) {
108 // FIXME: We should throw the caught error. 108 // FIXME: We should throw the caught error.
109 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 109 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
110 } 110 }
111 return m_fetchManager->fetch(scriptState, r->request()); 111 return m_fetchManager->fetch(scriptState, r->request());
112 } 112 }
113 113
114 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request, const Dictionary& requestInit) 114 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request, const Dictionary& requestInit)
115 { 115 {
116 if (!m_fetchManager) 116 if (!m_fetchManager)
117 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 117 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
118 // "Let |r| be the associated request of the result of invoking the initial 118 // "Let |r| be the associated request of the result of invoking the initial
119 // value of Request as constructor with |input| and |init| as arguments. If 119 // value of Request as constructor with |input| and |init| as arguments. If
120 // this throws an exception, reject |p| with it." 120 // this throws an exception, reject |p| with it."
121 TrackExceptionState exceptionState; 121 TrackExceptionState exceptionState;
122 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, requestInit, exceptionState); 122 Request* r = Request::create(this, request, requestInit, exceptionState);
123 if (exceptionState.hadException()) { 123 if (exceptionState.hadException()) {
124 // FIXME: We should throw the caught error. 124 // FIXME: We should throw the caught error.
125 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 125 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
126 } 126 }
127 return m_fetchManager->fetch(scriptState, r->request()); 127 return m_fetchManager->fetch(scriptState, r->request());
128 } 128 }
129 129
130 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring) 130 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring)
131 { 131 {
132 if (!m_fetchManager) 132 if (!m_fetchManager)
133 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 133 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
134 // "Let |r| be the associated request of the result of invoking the initial 134 // "Let |r| be the associated request of the result of invoking the initial
135 // value of Request as constructor with |input| and |init| as arguments. If 135 // value of Request as constructor with |input| and |init| as arguments. If
136 // this throws an exception, reject |p| with it." 136 // this throws an exception, reject |p| with it."
137 TrackExceptionState exceptionState; 137 TrackExceptionState exceptionState;
138 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, exceptionSt ate); 138 Request* r = Request::create(this, urlstring, exceptionState);
139 if (exceptionState.hadException()) { 139 if (exceptionState.hadException()) {
140 // FIXME: We should throw the caught error. 140 // FIXME: We should throw the caught error.
141 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 141 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
142 } 142 }
143 return m_fetchManager->fetch(scriptState, r->request()); 143 return m_fetchManager->fetch(scriptState, r->request());
144 } 144 }
145 145
146 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring, const Dictionary& requestInit) 146 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring, const Dictionary& requestInit)
147 { 147 {
148 if (!m_fetchManager) 148 if (!m_fetchManager)
149 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 149 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
150 // "Let |r| be the associated request of the result of invoking the initial 150 // "Let |r| be the associated request of the result of invoking the initial
151 // value of Request as constructor with |input| and |init| as arguments. If 151 // value of Request as constructor with |input| and |init| as arguments. If
152 // this throws an exception, reject |p| with it." 152 // this throws an exception, reject |p| with it."
153 TrackExceptionState exceptionState; 153 TrackExceptionState exceptionState;
154 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, requestInit , exceptionState); 154 Request* r = Request::create(this, urlstring, requestInit, exceptionState);
155 if (exceptionState.hadException()) { 155 if (exceptionState.hadException()) {
156 // FIXME: We should throw the caught error. 156 // FIXME: We should throw the caught error.
157 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 157 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
158 } 158 }
159 return m_fetchManager->fetch(scriptState, r->request()); 159 return m_fetchManager->fetch(scriptState, r->request());
160 } 160 }
161 161
162 PassRefPtrWillBeRawPtr<ServiceWorkerClients> ServiceWorkerGlobalScope::clients() 162 ServiceWorkerClients* ServiceWorkerGlobalScope::clients()
163 { 163 {
164 if (!m_clients) 164 if (!m_clients)
165 m_clients = ServiceWorkerClients::create(); 165 m_clients = ServiceWorkerClients::create();
166 return m_clients; 166 return m_clients;
167 } 167 }
168 168
169 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const 169 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const
170 { 170 {
171 return EventTargetNames::ServiceWorkerGlobalScope; 171 return EventTargetNames::ServiceWorkerGlobalScope;
172 } 172 }
(...skipping 17 matching lines...) Expand all
190 190
191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack) 191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack> callStack)
192 { 192 {
193 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack); 193 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber , columnNumber, callStack);
194 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 194 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
195 consoleMessage->setCallStack(callStack); 195 consoleMessage->setCallStack(callStack);
196 addMessageToWorkerConsole(consoleMessage.release()); 196 addMessageToWorkerConsole(consoleMessage.release());
197 } 197 }
198 198
199 } // namespace blink 199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698