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

Unified Diff: Source/core/platform/chromium/support/WebCryptoAlgorithmParams.cpp

Issue 18475002: WebCrypto: Add framework for AlgorithmIdentifier normalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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/core/platform/chromium/support/WebCryptoAlgorithmParams.cpp
diff --git a/Source/core/platform/chromium/support/WebDeviceMotionData.cpp b/Source/core/platform/chromium/support/WebCryptoAlgorithmParams.cpp
similarity index 77%
copy from Source/core/platform/chromium/support/WebDeviceMotionData.cpp
copy to Source/core/platform/chromium/support/WebCryptoAlgorithmParams.cpp
index 8d2595dd4035380539b1c2fcf90afedac91411af..bf81597da6611d650206dad7d0d8dd6a030eca11 100644
--- a/Source/core/platform/chromium/support/WebDeviceMotionData.cpp
+++ b/Source/core/platform/chromium/support/WebCryptoAlgorithmParams.cpp
@@ -29,19 +29,34 @@
*/
#include "config.h"
-#include "public/platform/WebDeviceMotionData.h"
+#include "public/platform/WebCryptoAlgorithmParams.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/ThreadSafeRefCounted.h"
#include <string.h>
namespace WebKit {
-WebDeviceMotionData::WebDeviceMotionData()
+WebCryptoAlgorithmParams::Bytes::Bytes(const unsigned char* data, size_t size)
abarth-chromium 2013/07/02 06:46:36 How is this different from WebVector?
eroman 2013/07/02 08:12:27 Perfect! Somehow I didn't see that class. Done.
+ : m_data(0)
+ , m_size(0)
{
- // Make sure to zero out the memory so that there are no uninitialized bits.
- // This object is used in the shared memory buffer and is memory copied by
- // two processes. Valgrind will complain if we copy around memory that is
- // only partially initialized.
- memset(this, 0, sizeof(*this));
+ if (!size)
+ return;
+
+ ASSERT(data);
+ unsigned char* newData = new unsigned char[size];
+ memcpy(newData, data, size);
+
+ m_data = newData;
+ m_size = size;
+}
+
+WebCryptoAlgorithmParams::Bytes::~Bytes()
+{
+ delete m_data;
+ m_data = 0;
}
} // namespace WebKit
+

Powered by Google App Engine
This is Rietveld 408576698