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

Side by Side Diff: Source/modules/cachestorage/Cache.cpp

Issue 1107793002: Oilpan: have DOMException be on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/cachestorage/Cache.h ('k') | Source/modules/cachestorage/CacheStorage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void didCreateBlobHandle(PassRefPtr<BlobDataHandle> handle) override 195 void didCreateBlobHandle(PassRefPtr<BlobDataHandle> handle) override
196 { 196 {
197 WebVector<WebServiceWorkerCache::BatchOperation> batchOperations(size_t( 1)); 197 WebVector<WebServiceWorkerCache::BatchOperation> batchOperations(size_t( 1));
198 batchOperations[0].operationType = WebServiceWorkerCache::OperationTypeP ut; 198 batchOperations[0].operationType = WebServiceWorkerCache::OperationTypeP ut;
199 batchOperations[0].request = m_webRequest; 199 batchOperations[0].request = m_webRequest;
200 batchOperations[0].response = m_webResponse; 200 batchOperations[0].response = m_webResponse;
201 batchOperations[0].response.setBlobDataHandle(handle); 201 batchOperations[0].response.setBlobDataHandle(handle);
202 m_cache->webCache()->dispatchBatch(new CachePutCallbacks(m_resolver.get( )), batchOperations); 202 m_cache->webCache()->dispatchBatch(new CachePutCallbacks(m_resolver.get( )), batchOperations);
203 cleanup(); 203 cleanup();
204 } 204 }
205 void didFail(PassRefPtrWillBeRawPtr<DOMException> exception) override 205 void didFail(DOMException* exception) override
206 { 206 {
207 ScriptState* state = m_resolver->scriptState(); 207 ScriptState* state = m_resolver->scriptState();
208 ScriptState::Scope scope(state); 208 ScriptState::Scope scope(state);
209 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), e xception->toString())); 209 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), e xception->toString()));
210 cleanup(); 210 cleanup();
211 } 211 }
212 212
213 DEFINE_INLINE_VIRTUAL_TRACE() 213 DEFINE_INLINE_VIRTUAL_TRACE()
214 { 214 {
215 visitor->trace(m_resolver); 215 visitor->trace(m_resolver);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Add/AddAll does not support schemes other than \"http\" or \"https\"")); 367 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Add/AddAll does not support schemes other than \"http\" or \"https\""));
368 if (requests[i]->method() != "GET") 368 if (requests[i]->method() != "GET")
369 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Add/AddAll only supports the GET request method .")); 369 return ScriptPromise::reject(scriptState, V8ThrowException::createTy peError(scriptState->isolate(), "Add/AddAll only supports the GET request method ."));
370 requestInfos[i].setRequest(requests[i]); 370 requestInfos[i].setRequest(requests[i]);
371 } 371 }
372 372
373 ScriptPromise fetchPromise = m_scopedFetcher->fetch(scriptState, requestInfo s[0], Dictionary(), exceptionState); 373 ScriptPromise fetchPromise = m_scopedFetcher->fetch(scriptState, requestInfo s[0], Dictionary(), exceptionState);
374 return fetchPromise.then(FetchResolvedForAdd::create(scriptState, this, requ ests[0])); 374 return fetchPromise.then(FetchResolvedForAdd::create(scriptState, this, requ ests[0]));
375 } 375 }
376 376
377 PassRefPtrWillBeRawPtr<DOMException> Cache::domExceptionForCacheError(WebService WorkerCacheError reason) 377 DOMException* Cache::domExceptionForCacheError(WebServiceWorkerCacheError reason )
378 { 378 {
379 switch (reason) { 379 switch (reason) {
380 case WebServiceWorkerCacheErrorNotImplemented: 380 case WebServiceWorkerCacheErrorNotImplemented:
381 return DOMException::create(NotSupportedError, "Method is not implemente d."); 381 return DOMException::create(NotSupportedError, "Method is not implemente d.");
382 case WebServiceWorkerCacheErrorNotFound: 382 case WebServiceWorkerCacheErrorNotFound:
383 return DOMException::create(NotFoundError, "Entry was not found."); 383 return DOMException::create(NotFoundError, "Entry was not found.");
384 case WebServiceWorkerCacheErrorExists: 384 case WebServiceWorkerCacheErrorExists:
385 return DOMException::create(InvalidAccessError, "Entry already exists.") ; 385 return DOMException::create(InvalidAccessError, "Entry already exists.") ;
386 default: 386 default:
387 ASSERT_NOT_REACHED(); 387 ASSERT_NOT_REACHED();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « Source/modules/cachestorage/Cache.h ('k') | Source/modules/cachestorage/CacheStorage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698