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

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, 3 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void ServiceWorkerGlobalScope::stopFetch() 76 void ServiceWorkerGlobalScope::stopFetch()
77 { 77 {
78 m_fetchManager.clear(); 78 m_fetchManager.clear();
79 } 79 }
80 80
81 String ServiceWorkerGlobalScope::scope(ExecutionContext* context) 81 String ServiceWorkerGlobalScope::scope(ExecutionContext* context)
82 { 82 {
83 return ServiceWorkerGlobalScopeClient::from(context)->scope().string(); 83 return ServiceWorkerGlobalScopeClient::from(context)->scope().string();
84 } 84 }
85 85
86 PassRefPtrWillBeRawPtr<CacheStorage> ServiceWorkerGlobalScope::caches(ExecutionC ontext* context) 86 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context)
87 { 87 {
88 if (!m_caches) 88 if (!m_caches)
89 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con text)->cacheStorage()); 89 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con text)->cacheStorage());
90 return m_caches; 90 return m_caches;
91 } 91 }
92 92
93 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request) 93 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request)
94 { 94 {
95 if (!m_fetchManager) 95 if (!m_fetchManager)
96 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 96 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
97 // "Let |r| be the associated request of the result of invoking the initial 97 // "Let |r| be the associated request of the result of invoking the initial
98 // value of Request as constructor with |input| and |init| as arguments. If 98 // value of Request as constructor with |input| and |init| as arguments. If
99 // this throws an exception, reject |p| with it." 99 // this throws an exception, reject |p| with it."
100 TrackExceptionState exceptionState; 100 TrackExceptionState exceptionState;
101 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, exceptionStat e); 101 Request* r = Request::create(this, request, exceptionState);
102 if (exceptionState.hadException()) { 102 if (exceptionState.hadException()) {
103 // FIXME: We should throw the caught error. 103 // FIXME: We should throw the caught error.
104 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 104 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
105 } 105 }
106 return m_fetchManager->fetch(scriptState, r->request()); 106 return m_fetchManager->fetch(scriptState, r->request());
107 } 107 }
108 108
109 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request, const Dictionary& requestInit) 109 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request* request, const Dictionary& requestInit)
110 { 110 {
111 if (!m_fetchManager) 111 if (!m_fetchManager)
112 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 112 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
113 // "Let |r| be the associated request of the result of invoking the initial 113 // "Let |r| be the associated request of the result of invoking the initial
114 // value of Request as constructor with |input| and |init| as arguments. If 114 // value of Request as constructor with |input| and |init| as arguments. If
115 // this throws an exception, reject |p| with it." 115 // this throws an exception, reject |p| with it."
116 TrackExceptionState exceptionState; 116 TrackExceptionState exceptionState;
117 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, requestInit, exceptionState); 117 Request* r = Request::create(this, request, requestInit, exceptionState);
118 if (exceptionState.hadException()) { 118 if (exceptionState.hadException()) {
119 // FIXME: We should throw the caught error. 119 // FIXME: We should throw the caught error.
120 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 120 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
121 } 121 }
122 return m_fetchManager->fetch(scriptState, r->request()); 122 return m_fetchManager->fetch(scriptState, r->request());
123 } 123 }
124 124
125 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring) 125 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring)
126 { 126 {
127 if (!m_fetchManager) 127 if (!m_fetchManager)
128 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 128 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
129 // "Let |r| be the associated request of the result of invoking the initial 129 // "Let |r| be the associated request of the result of invoking the initial
130 // value of Request as constructor with |input| and |init| as arguments. If 130 // value of Request as constructor with |input| and |init| as arguments. If
131 // this throws an exception, reject |p| with it." 131 // this throws an exception, reject |p| with it."
132 TrackExceptionState exceptionState; 132 TrackExceptionState exceptionState;
133 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, exceptionSt ate); 133 Request* r = Request::create(this, urlstring, exceptionState);
134 if (exceptionState.hadException()) { 134 if (exceptionState.hadException()) {
135 // FIXME: We should throw the caught error. 135 // FIXME: We should throw the caught error.
136 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 136 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
137 } 137 }
138 return m_fetchManager->fetch(scriptState, r->request()); 138 return m_fetchManager->fetch(scriptState, r->request());
139 } 139 }
140 140
141 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring, const Dictionary& requestInit) 141 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St ring& urlstring, const Dictionary& requestInit)
142 { 142 {
143 if (!m_fetchManager) 143 if (!m_fetchManager)
144 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); 144 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate()));
145 // "Let |r| be the associated request of the result of invoking the initial 145 // "Let |r| be the associated request of the result of invoking the initial
146 // value of Request as constructor with |input| and |init| as arguments. If 146 // value of Request as constructor with |input| and |init| as arguments. If
147 // this throws an exception, reject |p| with it." 147 // this throws an exception, reject |p| with it."
148 TrackExceptionState exceptionState; 148 TrackExceptionState exceptionState;
149 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, requestInit , exceptionState); 149 Request* r = Request::create(this, urlstring, requestInit, exceptionState);
150 if (exceptionState.hadException()) { 150 if (exceptionState.hadException()) {
151 // FIXME: We should throw the caught error. 151 // FIXME: We should throw the caught error.
152 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate())); 152 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(exceptionState.message(), scriptState->isolate()));
153 } 153 }
154 return m_fetchManager->fetch(scriptState, r->request()); 154 return m_fetchManager->fetch(scriptState, r->request());
155 } 155 }
156 156
157 PassRefPtrWillBeRawPtr<ServiceWorkerClients> ServiceWorkerGlobalScope::clients() 157 ServiceWorkerClients* ServiceWorkerGlobalScope::clients()
158 { 158 {
159 if (!m_clients) 159 if (!m_clients)
160 m_clients = ServiceWorkerClients::create(); 160 m_clients = ServiceWorkerClients::create();
161 return m_clients; 161 return m_clients;
162 } 162 }
163 163
164 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState) 164 void ServiceWorkerGlobalScope::close(ExceptionState& exceptionState)
165 { 165 {
166 exceptionState.throwDOMException(InvalidAccessError, "Not supported."); 166 exceptionState.throwDOMException(InvalidAccessError, "Not supported.");
167 } 167 }
(...skipping 23 matching lines...) Expand all
191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) 191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack)
192 { 192 {
193 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); 193 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, 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->setScriptId(scriptId); 195 consoleMessage->setScriptId(scriptId);
196 consoleMessage->setCallStack(callStack); 196 consoleMessage->setCallStack(callStack);
197 addMessageToWorkerConsole(consoleMessage.release()); 197 addMessageToWorkerConsole(consoleMessage.release());
198 } 198 }
199 199
200 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698