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

Unified Diff: Source/modules/crypto/CrossThreadCryptoResult.cpp

Issue 311733004: Introduce KeepAliveWhilePending to ScriptPromiseResolverWithContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@refactor-webmidi-initialization
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/crypto/CrossThreadCryptoResult.cpp
diff --git a/Source/platform/CryptoResult.h b/Source/modules/crypto/CrossThreadCryptoResult.cpp
similarity index 61%
copy from Source/platform/CryptoResult.h
copy to Source/modules/crypto/CrossThreadCryptoResult.cpp
index af8032bc57997e4bd35febe1d797d841d1682a14..013c619d0d264229910f098c621e755803ec0879 100644
--- a/Source/platform/CryptoResult.h
+++ b/Source/modules/crypto/CrossThreadCryptoResult.cpp
@@ -28,31 +28,40 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CryptoResult_h
-#define CryptoResult_h
+#include "config.h"
+#include "modules/crypto/CrossThreadCryptoResult.h"
+#include "core/dom/DOMException.h"
#include "public/platform/WebCrypto.h"
-#include "wtf/ThreadSafeRefCounted.h"
namespace WebCore {
-// Receives notification of completion of the crypto operation.
-class CryptoResult : public ThreadSafeRefCounted<CryptoResult> {
-public:
- virtual ~CryptoResult() { }
-
- virtual void completeWithError(blink::WebCryptoErrorType, const blink::WebString&) = 0;
- virtual void completeWithBuffer(const blink::WebArrayBuffer&) = 0;
- virtual void completeWithBoolean(bool) = 0;
- virtual void completeWithKey(const blink::WebCryptoKey&) = 0;
- virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) = 0;
-
- blink::WebCryptoResult result()
- {
- return blink::WebCryptoResult(this);
+ExceptionCode webCryptoErrorToExceptionCode(blink::WebCryptoErrorType errorType)
+{
+ switch (errorType) {
+ case blink::WebCryptoErrorTypeNotSupported:
+ return NotSupportedError;
+ case blink::WebCryptoErrorTypeSyntax:
+ return SyntaxError;
+ case blink::WebCryptoErrorTypeInvalidState:
+ return InvalidStateError;
+ case blink::WebCryptoErrorTypeInvalidAccess:
+ return InvalidAccessError;
+ case blink::WebCryptoErrorTypeUnknown:
+ return UnknownError;
+ case blink::WebCryptoErrorTypeData:
+ return DataError;
+ case blink::WebCryptoErrorTypeOperation:
+ return OperationError;
+ case blink::WebCryptoErrorTypeType:
+ // FIXME: This should construct a TypeError instead. For now do
+ // something to facilitate refactor, but this will need to be
+ // revisited.
+ return DataError;
}
-};
-} // namespace WebCore
+ ASSERT_NOT_REACHED();
+ return 0;
+}
-#endif
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698