Index: Source/modules/crypto/RandomSource.cpp |
diff --git a/Source/modules/crypto/Crypto.cpp b/Source/modules/crypto/RandomSource.cpp |
similarity index 88% |
copy from Source/modules/crypto/Crypto.cpp |
copy to Source/modules/crypto/RandomSource.cpp |
index a2e55daaa82295fd417022c3b1cbe7a6cb09e019..cdab398134a57ede5cd3b7ca1969088d788862ca 100644 |
--- a/Source/modules/crypto/Crypto.cpp |
+++ b/Source/modules/crypto/RandomSource.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2011 Google Inc. All rights reserved. |
+ * Copyright (C) 2013 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -28,7 +28,7 @@ |
#include "config.h" |
-#include "modules/crypto/Crypto.h" |
+#include "modules/crypto/RandomSource.h" |
#include "core/dom/ExceptionCode.h" |
#include "wtf/ArrayBufferView.h" |
@@ -52,12 +52,13 @@ bool isIntegerArray(ArrayBufferView* array) |
} |
-Crypto::Crypto() |
+RandomSource::RandomSource() |
{ |
ScriptWrappable::init(this); |
} |
-void Crypto::getRandomValues(ArrayBufferView* array, ExceptionCode& ec) |
+// Note: This implementation MUST be thread-safe, as it is used by workers. |
+void RandomSource::getRandomValues(ArrayBufferView* array, ExceptionCode& ec) |
{ |
if (!array || !isIntegerArray(array)) { |
ec = TYPE_MISMATCH_ERR; |
@@ -70,11 +71,4 @@ void Crypto::getRandomValues(ArrayBufferView* array, ExceptionCode& ec) |
cryptographicallyRandomValues(array->baseAddress(), array->byteLength()); |
} |
-SubtleCrypto* Crypto::subtle() |
-{ |
- if (!m_subtleCrypto) |
- m_subtleCrypto = SubtleCrypto::create(); |
- return m_subtleCrypto.get(); |
-} |
- |
} |