Commit a54aa610 authored by bratell's avatar bratell Committed by Commit Bot

Deduplicate CopyBytes in modules/crypto

The two identical functions CopyBytes collided in a jumbo build so
this is primarily to avoid having to exclude one of the files from the
jumbo building.

BUG=

Review-Url: https://codereview.chromium.org/2972023002
Cr-Commit-Position: refs/heads/master@{#485231}
parent eadc611f
......@@ -14,6 +14,7 @@ blink_modules_sources("crypto") {
"CryptoKey.h",
"CryptoResultImpl.cpp",
"CryptoResultImpl.h",
"CryptoUtilities.h",
"DOMWindowCrypto.cpp",
"DOMWindowCrypto.h",
"NormalizeAlgorithm.cpp",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CryptoUtilities_h
#define CryptoUtilities_h
#include "core/dom/DOMArrayPiece.h"
#include "public/platform/WebVector.h"
namespace blink {
inline WebVector<uint8_t> CopyBytes(const DOMArrayPiece& source) {
return WebVector<uint8_t>(static_cast<const uint8_t*>(source.Data()),
source.ByteLength());
}
} // namespace blink
#endif // CryptoUtilities_h
......@@ -39,6 +39,7 @@
#include "bindings/modules/v8/V8CryptoKey.h"
#include "core/dom/DOMArrayPiece.h"
#include "core/dom/DOMTypedArray.h"
#include "modules/crypto/CryptoUtilities.h"
#include "platform/wtf/MathExtras.h"
#include "platform/wtf/PtrUtil.h"
#include "platform/wtf/Vector.h"
......@@ -50,8 +51,6 @@ namespace blink {
namespace {
typedef ArrayBufferOrArrayBufferView BufferSource;
struct AlgorithmNameMapping {
// Must be an upper case ASCII string.
const char* const algorithm_name;
......@@ -264,11 +263,6 @@ class ErrorContext {
Vector<const char*, 10> messages_;
};
static WebVector<uint8_t> CopyBytes(const DOMArrayPiece& source) {
return WebVector<uint8_t>(static_cast<const uint8_t*>(source.Data()),
source.ByteLength());
}
// Defined by the WebCrypto spec as:
//
// typedef (ArrayBuffer or ArrayBufferView) BufferSource;
......
......@@ -39,6 +39,7 @@
#include "modules/crypto/CryptoHistograms.h"
#include "modules/crypto/CryptoKey.h"
#include "modules/crypto/CryptoResultImpl.h"
#include "modules/crypto/CryptoUtilities.h"
#include "modules/crypto/NormalizeAlgorithm.h"
#include "platform/json/JSONValues.h"
#include "public/platform/Platform.h"
......@@ -154,11 +155,6 @@ static bool ParseJsonWebKey(const Dictionary& dict,
return true;
}
static WebVector<uint8_t> CopyBytes(const DOMArrayPiece& source) {
return WebVector<uint8_t>(static_cast<uint8_t*>(source.Data()),
source.ByteLength());
}
SubtleCrypto::SubtleCrypto() {}
ScriptPromise SubtleCrypto::encrypt(ScriptState* script_state,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment