Index: Source/modules/crypto/RsaHashedKeyAlgorithm.cpp |
diff --git a/Source/modules/crypto/Algorithm.cpp b/Source/modules/crypto/RsaHashedKeyAlgorithm.cpp |
similarity index 70% |
copy from Source/modules/crypto/Algorithm.cpp |
copy to Source/modules/crypto/RsaHashedKeyAlgorithm.cpp |
index f3cc089a18e78eb9944fc5dcb88a638aa1a811c3..482d7428015e604b56fa48d790410fec073c4415 100644 |
--- a/Source/modules/crypto/Algorithm.cpp |
+++ b/Source/modules/crypto/RsaHashedKeyAlgorithm.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2013 Google Inc. All rights reserved. |
+ * Copyright (C) 2014 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -29,29 +29,35 @@ |
*/ |
#include "config.h" |
-#include "modules/crypto/Algorithm.h" |
+#include "modules/crypto/RsaHashedKeyAlgorithm.h" |
#include "modules/crypto/NormalizeAlgorithm.h" |
#include "wtf/text/WTFString.h" |
namespace WebCore { |
-DEFINE_GC_INFO(Algorithm); |
+PassRefPtrWillBeRawPtr<RsaHashedKeyAlgorithm> RsaHashedKeyAlgorithm::create(const blink::WebCryptoKeyAlgorithm& algorithm) |
+{ |
+ return adoptRefWillBeNoop(new RsaHashedKeyAlgorithm(algorithm)); |
+} |
-PassRefPtrWillBeRawPtr<Algorithm> Algorithm::create(const blink::WebCryptoAlgorithm& algorithm) |
+KeyAlgorithm* RsaHashedKeyAlgorithm::hash() |
{ |
- return adoptRefWillBeNoop(new Algorithm(algorithm)); |
+ if (!m_hash) |
+ m_hash = KeyAlgorithm::createHash(m_algorithm.rsaHashedParams()->hash()); |
+ return m_hash.get(); |
} |
-Algorithm::Algorithm(const blink::WebCryptoAlgorithm& algorithm) |
- : m_algorithm(algorithm) |
+void RsaHashedKeyAlgorithm::trace(Visitor* visitor) |
{ |
- ScriptWrappable::init(this); |
+ RsaKeyAlgorithm::trace(visitor); |
+ visitor->trace(m_hash); |
} |
-String Algorithm::name() |
+RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm(const blink::WebCryptoKeyAlgorithm& algorithm) |
+ : RsaKeyAlgorithm(algorithm) |
{ |
- return algorithmIdToName(m_algorithm.id()); |
+ ScriptWrappable::init(this); |
} |
} // namespace WebCore |