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

Unified Diff: trunk/src/content/child/webcrypto/webcrypto_util.cc

Issue 252213003: Revert 266798 "[webcrypto] Make operations run on a background t..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 | « trunk/src/content/child/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/child/webcrypto/webcrypto_util.cc
===================================================================
--- trunk/src/content/child/webcrypto/webcrypto_util.cc (revision 266902)
+++ trunk/src/content/child/webcrypto/webcrypto_util.cc (working copy)
@@ -22,12 +22,27 @@
return &data[0];
}
-uint8* Uint8VectorStart(std::vector<uint8>* data) {
- if (data->empty())
- return NULL;
- return &(*data)[0];
+void ShrinkBuffer(blink::WebArrayBuffer* buffer, unsigned int new_size) {
+ DCHECK_LE(new_size, buffer->byteLength());
+
+ if (new_size == buffer->byteLength())
+ return;
+
+ blink::WebArrayBuffer new_buffer = blink::WebArrayBuffer::create(new_size, 1);
+ DCHECK(!new_buffer.isNull());
+ memcpy(new_buffer.data(), buffer->data(), new_size);
+ *buffer = new_buffer;
}
+blink::WebArrayBuffer CreateArrayBuffer(const uint8* data,
+ unsigned int data_size) {
+ blink::WebArrayBuffer buffer = blink::WebArrayBuffer::create(data_size, 1);
+ DCHECK(!buffer.isNull());
+ if (data_size) // data_size == 0 might mean the data pointer is invalid
+ memcpy(buffer.data(), data, data_size);
+ return buffer;
+}
+
// This function decodes unpadded 'base64url' encoded data, as described in
// RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. To do this, first
// change the incoming data to 'base64' encoding by applying the appropriate
« no previous file with comments | « trunk/src/content/child/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698