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

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: Separate out cancellation handling (+rebase) 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
Index: Source/platform/exported/WebCryptoResult.cpp
diff --git a/Source/platform/exported/WebCryptoResult.cpp b/Source/platform/exported/WebCryptoResult.cpp
index d5515064a86e9aa829d129b2828f678f1820fadf..b1370804c6c60899a58b50056501e1aee686694e 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 (!m_cancel->cancelled())
eroman 2015/07/31 23:40:30 You could call the wrapper method for these: if
sof 2015/08/01 06:44:31 Done.
+ m_impl->completeWithError(errorType, errorDetails);
reset();
}
void WebCryptoResult::completeWithBuffer(const void* bytes, unsigned bytesSize)
{
- m_impl->completeWithBuffer(bytes, bytesSize);
+ if (!m_cancel->cancelled())
+ m_impl->completeWithBuffer(bytes, bytesSize);
reset();
}
void WebCryptoResult::completeWithJson(const char* utf8Data, unsigned length)
{
- m_impl->completeWithJson(utf8Data, length);
+ if (!m_cancel->cancelled())
+ m_impl->completeWithJson(utf8Data, length);
reset();
}
void WebCryptoResult::completeWithBoolean(bool b)
{
- m_impl->completeWithBoolean(b);
+ if (!m_cancel->cancelled())
+ m_impl->completeWithBoolean(b);
reset();
}
void WebCryptoResult::completeWithKey(const WebCryptoKey& key)
{
ASSERT(!key.isNull());
- m_impl->completeWithKey(key);
+ if (!m_cancel->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 (!m_cancel->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

Powered by Google App Engine
This is Rietveld 408576698