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

Side by Side Diff: Source/platform/CryptoResult.h

Issue 1228373006: Reliably cancel in-progress CryptoResult(Impl) upon shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize stopped crypto result as cancelled Created 5 years, 4 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/crypto/SubtleCrypto.cpp ('k') | Source/platform/exported/WebCryptoResult.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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef CryptoResult_h 31 #ifndef CryptoResult_h
32 #define CryptoResult_h 32 #define CryptoResult_h
33 33
34 #include "public/platform/WebCrypto.h" 34 #include "public/platform/WebCrypto.h"
35 #include "wtf/ThreadSafeRefCounted.h" 35 #include "wtf/ThreadSafeRefCounted.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 // Result cancellation status interface to allow non-Blink webcrypto threads
40 // to query for status.
41 class CryptoResultCancel : public ThreadSafeRefCounted<CryptoResultCancel> {
42 public:
43 virtual ~CryptoResultCancel() { }
44
45 virtual bool cancelled() const = 0;
46 };
47
39 // Receives notification of completion of the crypto operation. 48 // Receives notification of completion of the crypto operation.
40 class CryptoResult : public ThreadSafeRefCounted<CryptoResult> { 49 class CryptoResult : public ThreadSafeRefCountedWillBeGarbageCollectedFinalized< CryptoResult> {
41 public: 50 public:
42 virtual ~CryptoResult() { } 51 virtual ~CryptoResult() { }
43 52
44 virtual void completeWithError(WebCryptoErrorType, const WebString&) = 0; 53 virtual void completeWithError(WebCryptoErrorType, const WebString&) = 0;
45 virtual void completeWithBuffer(const void* bytes, unsigned bytesSize) = 0; 54 virtual void completeWithBuffer(const void* bytes, unsigned bytesSize) = 0;
46 virtual void completeWithJson(const char* utf8Data, unsigned length) = 0; 55 virtual void completeWithJson(const char* utf8Data, unsigned length) = 0;
47 virtual void completeWithBoolean(bool) = 0; 56 virtual void completeWithBoolean(bool) = 0;
48 virtual void completeWithKey(const WebCryptoKey&) = 0; 57 virtual void completeWithKey(const WebCryptoKey&) = 0;
49 virtual void completeWithKeyPair(const WebCryptoKey& publicKey, const WebCry ptoKey& privateKey) = 0; 58 virtual void completeWithKeyPair(const WebCryptoKey& publicKey, const WebCry ptoKey& privateKey) = 0;
50 virtual bool cancelled() const = 0;
51 59
52 WebCryptoResult result() 60 DEFINE_INLINE_VIRTUAL_TRACE() { }
53 {
54 return WebCryptoResult(this);
55 }
56 }; 61 };
57 62
58 } // namespace blink 63 } // namespace blink
59 64
60 #endif 65 #endif // CryptoResult_h
OLDNEW
« no previous file with comments | « Source/modules/crypto/SubtleCrypto.cpp ('k') | Source/platform/exported/WebCryptoResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698