| OLD | NEW |
| 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 "modules/cachestorage/CacheStorage.h" | 5 #include "modules/cachestorage/CacheStorage.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
| 12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
| 13 #include "core/dom/ExecutionContext.h" |
| 13 #include "core/inspector/ConsoleMessage.h" | 14 #include "core/inspector/ConsoleMessage.h" |
| 14 #include "modules/cachestorage/CacheStorageError.h" | 15 #include "modules/cachestorage/CacheStorageError.h" |
| 15 #include "modules/fetch/Request.h" | 16 #include "modules/fetch/Request.h" |
| 16 #include "modules/fetch/Response.h" | 17 #include "modules/fetch/Response.h" |
| 17 #include "platform/wtf/PtrUtil.h" | 18 #include "platform/wtf/PtrUtil.h" |
| 18 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" | 19 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" |
| 19 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" | 20 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 DOMException* CreateNoImplementationException() { | 26 DOMException* CreateNoImplementationException() { |
| 26 return DOMException::Create(kNotSupportedError, | 27 return DOMException::Create(kNotSupportedError, |
| 27 "No CacheStorage implementation provided."); | 28 "No CacheStorage implementation provided."); |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool CommonChecks(ScriptState* script_state, ExceptionState& exception_state) { | 31 bool CommonChecks(ScriptState* script_state, ExceptionState& exception_state) { |
| 31 ExecutionContext* execution_context = script_state->GetExecutionContext(); | 32 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
| 32 // FIXME: May be null due to worker termination: http://crbug.com/413518. | 33 // FIXME: May be null due to worker termination: http://crbug.com/413518. |
| 33 if (!execution_context) | 34 if (!execution_context) |
| 34 return false; | 35 return false; |
| 35 | 36 |
| 36 String error_message; | 37 String error_message; |
| 37 if (!execution_context->IsSecureContext(error_message)) { | 38 if (!execution_context->IsSecureContext(error_message)) { |
| 38 exception_state.ThrowSecurityError(error_message); | 39 exception_state.ThrowSecurityError(error_message); |
| 39 return false; | 40 return false; |
| 40 } | 41 } |
| 41 return true; | 42 return true; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 356 |
| 356 void CacheStorage::Dispose() { | 357 void CacheStorage::Dispose() { |
| 357 web_cache_storage_.reset(); | 358 web_cache_storage_.reset(); |
| 358 } | 359 } |
| 359 | 360 |
| 360 DEFINE_TRACE(CacheStorage) { | 361 DEFINE_TRACE(CacheStorage) { |
| 361 visitor->Trace(scoped_fetcher_); | 362 visitor->Trace(scoped_fetcher_); |
| 362 } | 363 } |
| 363 | 364 |
| 364 } // namespace blink | 365 } // namespace blink |
| OLD | NEW |