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

Unified Diff: Source/platform/exported/WebCryptoResult.cpp

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, 5 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
« no previous file with comments | « Source/platform/CryptoResult.h ('k') | public/platform/WebCrypto.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/exported/WebCryptoResult.cpp
diff --git a/Source/platform/exported/WebCryptoResult.cpp b/Source/platform/exported/WebCryptoResult.cpp
index d5515064a86e9aa829d129b2828f678f1820fadf..aafdf861ea2b9ce2bfa5e6487f9e787194b132fd 100644
--- a/Source/platform/exported/WebCryptoResult.cpp
+++ b/Source/platform/exported/WebCryptoResult.cpp
@@ -33,38 +33,42 @@
#include "platform/CryptoResult.h"
#include "platform/heap/Heap.h"
-#include <string.h>
namespace blink {
void WebCryptoResult::completeWithError(WebCryptoErrorType errorType, const WebString& errorDetails)
{
- m_impl->completeWithError(errorType, errorDetails);
+ if (!cancelled())
+ m_impl->completeWithError(errorType, errorDetails);
reset();
}
void WebCryptoResult::completeWithBuffer(const void* bytes, unsigned bytesSize)
{
- m_impl->completeWithBuffer(bytes, bytesSize);
+ if (!cancelled())
+ m_impl->completeWithBuffer(bytes, bytesSize);
reset();
}
void WebCryptoResult::completeWithJson(const char* utf8Data, unsigned length)
{
- m_impl->completeWithJson(utf8Data, length);
+ if (!cancelled())
+ m_impl->completeWithJson(utf8Data, length);
reset();
}
void WebCryptoResult::completeWithBoolean(bool b)
{
- m_impl->completeWithBoolean(b);
+ if (!cancelled())
+ m_impl->completeWithBoolean(b);
reset();
}
void WebCryptoResult::completeWithKey(const WebCryptoKey& key)
{
ASSERT(!key.isNull());
- m_impl->completeWithKey(key);
+ if (!cancelled())
+ m_impl->completeWithKey(key);
reset();
}
@@ -72,29 +76,34 @@ void WebCryptoResult::completeWithKeyPair(const WebCryptoKey& publicKey, const W
{
ASSERT(!publicKey.isNull());
ASSERT(!privateKey.isNull());
- m_impl->completeWithKeyPair(publicKey, privateKey);
+ if (!cancelled())
+ m_impl->completeWithKeyPair(publicKey, privateKey);
reset();
}
bool WebCryptoResult::cancelled() const
{
- return m_impl->cancelled();
+ return m_cancel->cancelled();
}
-WebCryptoResult::WebCryptoResult(const PassRefPtrWillBeRawPtr<CryptoResult>& impl)
+WebCryptoResult::WebCryptoResult(const PassRefPtrWillBeRawPtr<CryptoResult>& impl, const PassRefPtr<CryptoResultCancel>& cancel)
: m_impl(impl)
+ , m_cancel(cancel)
{
ASSERT(m_impl.get());
+ ASSERT(m_cancel.get());
}
void WebCryptoResult::reset()
{
m_impl.reset();
+ m_cancel.reset();
}
void WebCryptoResult::assign(const WebCryptoResult& o)
{
m_impl = o.m_impl;
+ m_cancel = o.m_cancel;
}
} // namespace blink
« no previous file with comments | « Source/platform/CryptoResult.h ('k') | public/platform/WebCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698