| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 DCHECK(fetchEvent); | 205 DCHECK(fetchEvent); |
| 206 fetchEvent->onNavigationPreloadResponse( | 206 fetchEvent->onNavigationPreloadResponse( |
| 207 workerGlobalScope()->scriptController()->getScriptState(), | 207 workerGlobalScope()->scriptController()->getScriptState(), |
| 208 std::move(response), std::move(dataConsumeHandle)); | 208 std::move(response), std::move(dataConsumeHandle)); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError( | 211 void ServiceWorkerGlobalScopeProxy::onNavigationPreloadError( |
| 212 int fetchEventID, | 212 int fetchEventID, |
| 213 std::unique_ptr<WebServiceWorkerError> error) { | 213 std::unique_ptr<WebServiceWorkerError> error) { |
| 214 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); | 214 FetchEvent* fetchEvent = m_pendingPreloadFetchEvents.take(fetchEventID); |
| 215 DCHECK(fetchEvent); | 215 // This method may be called after onNavigationPreloadResponse() was called. |
| 216 if (!fetchEvent) |
| 217 return; |
| 216 fetchEvent->onNavigationPreloadError( | 218 fetchEvent->onNavigationPreloadError( |
| 217 workerGlobalScope()->scriptController()->getScriptState(), | 219 workerGlobalScope()->scriptController()->getScriptState(), |
| 218 std::move(error)); | 220 std::move(error)); |
| 219 } | 221 } |
| 220 | 222 |
| 221 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent( | 223 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent( |
| 222 int fetchEventID, | 224 int fetchEventID, |
| 223 const WebServiceWorkerRequest& webRequest) { | 225 const WebServiceWorkerRequest& webRequest) { |
| 224 if (!OriginTrials::foreignFetchEnabled(workerGlobalScope())) { | 226 if (!OriginTrials::foreignFetchEnabled(workerGlobalScope())) { |
| 225 // If origin trial tokens have expired, or are otherwise no longer valid | 227 // If origin trial tokens have expired, or are otherwise no longer valid |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 return *m_document; | 488 return *m_document; |
| 487 } | 489 } |
| 488 | 490 |
| 489 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() | 491 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() |
| 490 const { | 492 const { |
| 491 DCHECK(m_workerGlobalScope); | 493 DCHECK(m_workerGlobalScope); |
| 492 return m_workerGlobalScope; | 494 return m_workerGlobalScope; |
| 493 } | 495 } |
| 494 | 496 |
| 495 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |