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

Side by Side Diff: third_party/WebKit/Source/modules/cachestorage/CacheStorage.cpp

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

Powered by Google App Engine
This is Rietveld 408576698