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 "config.h" | 5 #include "config.h" |
6 #include "modules/cachestorage/Cache.h" | 6 #include "modules/cachestorage/Cache.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
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" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 ScriptPromise rejectAsNotImplemented(ScriptState* scriptState) | 144 ScriptPromise rejectAsNotImplemented(ScriptState* scriptState) |
145 { | 145 { |
146 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea
te(NotSupportedError, "Cache is not implemented")); | 146 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea
te(NotSupportedError, "Cache is not implemented")); |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 class Cache::FetchResolvedForAdd final : public ScriptFunction { | 151 class Cache::FetchResolvedForAdd final : public ScriptFunction { |
152 public: | 152 public: |
153 static v8::Handle<v8::Function> create(ScriptState* scriptState, Cache* cach
e, Request* request) | 153 static v8::Local<v8::Function> create(ScriptState* scriptState, Cache* cache
, Request* request) |
154 { | 154 { |
155 FetchResolvedForAdd* self = new FetchResolvedForAdd(scriptState, cache,
request); | 155 FetchResolvedForAdd* self = new FetchResolvedForAdd(scriptState, cache,
request); |
156 return self->bindToV8Function(); | 156 return self->bindToV8Function(); |
157 } | 157 } |
158 | 158 |
159 ScriptValue call(ScriptValue value) override | 159 ScriptValue call(ScriptValue value) override |
160 { | 160 { |
161 Response* response = V8Response::toImplWithTypeCheck(scriptState()->isol
ate(), value.v8Value()); | 161 Response* response = V8Response::toImplWithTypeCheck(scriptState()->isol
ate(), value.v8Value()); |
162 ScriptPromise putPromise = m_cache->putImpl(scriptState(), m_request, re
sponse); | 162 ScriptPromise putPromise = m_cache->putImpl(scriptState(), m_request, re
sponse); |
163 return ScriptValue(scriptState(), putPromise.v8Value()); | 163 return ScriptValue(scriptState(), putPromise.v8Value()); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ
ueryParams(options)); | 456 m_webCache->dispatchKeys(new CacheWithRequestsCallbacks(resolver), 0, toWebQ
ueryParams(options)); |
457 return promise; | 457 return promise; |
458 } | 458 } |
459 | 459 |
460 WebServiceWorkerCache* Cache::webCache() const | 460 WebServiceWorkerCache* Cache::webCache() const |
461 { | 461 { |
462 return m_webCache.get(); | 462 return m_webCache.get(); |
463 } | 463 } |
464 | 464 |
465 } // namespace blink | 465 } // namespace blink |
OLD | NEW |