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

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

Issue 1155573003: CacheStorage: Pass an error object allocated on heap to WebCallbacks::onError (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix unittests Created 5 years, 6 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
« no previous file with comments | « Source/modules/cachestorage/CacheStorage.cpp ('k') | Source/modules/cachestorage/CacheTest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CacheStorageError.h" 6 #include "modules/cachestorage/CacheStorageError.h"
7 7
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/dom/ExceptionCode.h" 9 #include "core/dom/ExceptionCode.h"
10 #include "modules/cachestorage/Cache.h" 10 #include "modules/cachestorage/Cache.h"
11 #include "public/platform/WebServiceWorkerCacheError.h" 11 #include "public/platform/WebServiceWorkerCacheError.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 DOMException* CacheStorageError::take(ScriptPromiseResolver*, WebType* webErrorR aw) 15 DOMException* CacheStorageError::take(ScriptPromiseResolver*, WebType* webErrorR aw)
16 { 16 {
17 return CacheStorageError::createException(*webErrorRaw); 17 return CacheStorageError::createException(*webErrorRaw);
18 } 18 }
19 19
20 void CacheStorageError::dispose(WebType* webErrorRaw) 20 void CacheStorageError::dispose(WebType* webErrorRaw)
21 { 21 {
22 delete webErrorRaw;
22 } 23 }
23 24
24 DOMException* CacheStorageError::createException(WebType webError) 25 DOMException* CacheStorageError::createException(WebType webError)
25 { 26 {
26 switch (webError) { 27 switch (webError) {
27 case WebServiceWorkerCacheErrorNotImplemented: 28 case WebServiceWorkerCacheErrorNotImplemented:
28 return DOMException::create(NotSupportedError, "Method is not implemente d."); 29 return DOMException::create(NotSupportedError, "Method is not implemente d.");
29 case WebServiceWorkerCacheErrorNotFound: 30 case WebServiceWorkerCacheErrorNotFound:
30 return DOMException::create(NotFoundError, "Entry was not found."); 31 return DOMException::create(NotFoundError, "Entry was not found.");
31 case WebServiceWorkerCacheErrorExists: 32 case WebServiceWorkerCacheErrorExists:
32 return DOMException::create(InvalidAccessError, "Entry already exists.") ; 33 return DOMException::create(InvalidAccessError, "Entry already exists.") ;
33 default: 34 default:
34 ASSERT_NOT_REACHED(); 35 ASSERT_NOT_REACHED();
35 return DOMException::create(NotSupportedError, "Unknown error."); 36 return DOMException::create(NotSupportedError, "Unknown error.");
36 } 37 }
37 } 38 }
38 39
39 } // namespace blink 40 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/cachestorage/CacheStorage.cpp ('k') | Source/modules/cachestorage/CacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698