| OLD | NEW |
| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // promise rejection or an uncaught runtime script error. | 192 // promise rejection or an uncaught runtime script error. |
| 193 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); | 193 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse( | 196 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadResponse( |
| 197 int fetchEventID, | 197 int fetchEventID, |
| 198 std::unique_ptr<WebServiceWorkerResponse> response, | 198 std::unique_ptr<WebServiceWorkerResponse> response, |
| 199 std::unique_ptr<WebDataConsumerHandle> dataConsumeHandle) { | 199 std::unique_ptr<WebDataConsumerHandle> dataConsumeHandle) { |
| 200 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); | 200 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); |
| 201 DCHECK(fetchEvent); | 201 DCHECK(fetchEvent); |
| 202 fetchEvent->onNavigationPreloadResponse(std::move(response), | 202 fetchEvent->onNavigationPreloadResponse( |
| 203 std::move(dataConsumeHandle)); | 203 workerGlobalScope()->scriptController()->getScriptState(), |
| 204 std::move(response), std::move(dataConsumeHandle)); |
| 204 } | 205 } |
| 205 | 206 |
| 206 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError( | 207 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError( |
| 207 int fetchEventID, | 208 int fetchEventID, |
| 208 std::unique_ptr<WebServiceWorkerError> error) { | 209 std::unique_ptr<WebServiceWorkerError> error) { |
| 209 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); | 210 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); |
| 210 DCHECK(fetchEvent); | 211 DCHECK(fetchEvent); |
| 211 fetchEvent->onNavigationPreloadError(std::move(error)); | 212 fetchEvent->onNavigationPreloadError( |
| 213 workerGlobalScope()->scriptController()->getScriptState(), |
| 214 std::move(error)); |
| 212 } | 215 } |
| 213 | 216 |
| 214 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent( | 217 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent( |
| 215 int fetchEventID, | 218 int fetchEventID, |
| 216 const WebServiceWorkerRequest& webRequest) { | 219 const WebServiceWorkerRequest& webRequest) { |
| 217 if (!OriginTrials::foreignFetchEnabled(workerGlobalScope())) { | 220 if (!OriginTrials::foreignFetchEnabled(workerGlobalScope())) { |
| 218 // If origin trial tokens have expired, or are otherwise no longer valid | 221 // If origin trial tokens have expired, or are otherwise no longer valid |
| 219 // no events should be dispatched. | 222 // no events should be dispatched. |
| 220 // TODO(mek): Ideally the browser wouldn't even start the service worker | 223 // TODO(mek): Ideally the browser wouldn't even start the service worker |
| 221 // if its tokens have expired. | 224 // if its tokens have expired. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 return *m_document; | 453 return *m_document; |
| 451 } | 454 } |
| 452 | 455 |
| 453 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() | 456 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() |
| 454 const { | 457 const { |
| 455 DCHECK(m_workerGlobalScope); | 458 DCHECK(m_workerGlobalScope); |
| 456 return m_workerGlobalScope; | 459 return m_workerGlobalScope; |
| 457 } | 460 } |
| 458 | 461 |
| 459 } // namespace blink | 462 } // namespace blink |
| OLD | NEW |