Move aligned memory utilities to rtc_base/memory/

This moves them from an API directory (system_wrappers/include/) to a
non-API directory, which is exactly what we want for utilities like
this.

BUG=webrtc:8445

Change-Id: I6dc34fe662f5d87b3b5288d33055345bc6bf91db
Reviewed-on: https://webrtc-review.googlesource.com/21164
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22567}
This commit is contained in:
Karl Wiberg 2018-03-22 14:11:52 +01:00 committed by Commit Bot
parent 12130bb135
commit 29e7bee330
21 changed files with 75 additions and 33 deletions

View file

@ -293,7 +293,7 @@ rtc_source_set("video_frame_api_i420") {
":video_frame_api",
"../rtc_base:checks",
"../rtc_base:rtc_base",
"../system_wrappers",
"../rtc_base/memory:aligned_malloc",
"//third_party/libyuv",
]
}

View file

@ -24,8 +24,4 @@ specific_include_rules = {
"+modules/audio_coding",
"+modules/audio_processing",
],
".*i420_buffer\.h": [
"+system_wrappers/include/aligned_malloc.h",
],
}

View file

@ -13,9 +13,9 @@
#include <memory>
#include "api/video/video_rotation.h"
#include "api/video/video_frame_buffer.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "api/video/video_rotation.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {

View file

@ -68,6 +68,8 @@ rtc_static_library("common_audio") {
"../rtc_base:checks",
"../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved",
"../rtc_base/memory:aligned_array",
"../rtc_base/memory:aligned_malloc",
"../system_wrappers",
"../system_wrappers:cpu_features_api",
]
@ -259,6 +261,7 @@ rtc_source_set("sinc_resampler") {
"../:typedefs",
"../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved",
"../rtc_base/memory:aligned_malloc",
"../system_wrappers",
]
}
@ -313,7 +316,7 @@ if (current_cpu == "x86" || current_cpu == "x64") {
":sinc_resampler",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"../rtc_base/memory:aligned_malloc",
]
}
}
@ -354,7 +357,7 @@ if (rtc_build_with_neon) {
":sinc_resampler",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"../rtc_base/memory:aligned_malloc",
]
}

View file

@ -14,7 +14,7 @@
#include <string.h>
#include "rtc_base/checks.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {

View file

@ -14,7 +14,7 @@
#include <memory>
#include "common_audio/fir_filter.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {

View file

@ -15,7 +15,7 @@
#include <xmmintrin.h>
#include "rtc_base/checks.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {

View file

@ -14,7 +14,7 @@
#include <memory>
#include "common_audio/fir_filter.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {

View file

@ -16,7 +16,7 @@
#include "common_audio/blocker.h"
#include "common_audio/real_fourier.h"
#include "system_wrappers/include/aligned_array.h"
#include "rtc_base/memory/aligned_array.h"
namespace webrtc {

View file

@ -14,7 +14,7 @@
#include <complex>
#include <memory>
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
// Uniform interface class for the real DFT and its inverse, for power-of-2
// input lengths. Also contains helper functions for buffer allocation, taking

View file

@ -18,7 +18,7 @@
#include "rtc_base/constructormagic.h"
#include "rtc_base/gtest_prod_util.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {

View file

@ -1228,6 +1228,7 @@ if (rtc_include_tests) {
"../system_wrappers:system_wrappers",
"../test:fileutils",
"../test:test_support",
"memory:unittests",
]
}

47
rtc_base/memory/BUILD.gn Normal file
View file

@ -0,0 +1,47 @@
# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
rtc_source_set("aligned_array") {
sources = [
"aligned_array.h",
]
deps = [
":aligned_malloc",
"..:checks",
]
}
rtc_source_set("aligned_malloc") {
sources = [
"aligned_malloc.cc",
"aligned_malloc.h",
]
deps = [
"../..:typedefs",
]
}
rtc_source_set("unittests") {
testonly = true
sources = [
"aligned_array_unittest.cc",
"aligned_malloc_unittest.cc",
]
deps = [
":aligned_array",
":aligned_malloc",
"../..:typedefs",
"../../test:test_support",
]
}

View file

@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_
#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_
#ifndef RTC_BASE_MEMORY_ALIGNED_ARRAY_H_
#define RTC_BASE_MEMORY_ALIGNED_ARRAY_H_
#include "rtc_base/checks.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {
@ -75,4 +75,4 @@ class AlignedArray {
} // namespace webrtc
#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_
#endif // RTC_BASE_MEMORY_ALIGNED_ARRAY_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/include/aligned_array.h"
#include "rtc_base/memory/aligned_array.h"
#include <stdint.h>

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
#include <memory.h>
#include <stdlib.h>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_
#define SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_
#ifndef RTC_BASE_MEMORY_ALIGNED_MALLOC_H_
#define RTC_BASE_MEMORY_ALIGNED_MALLOC_H_
// The functions declared here
// 1) Allocates block of aligned memory.
@ -54,4 +54,4 @@ struct AlignedFreeDeleter {
} // namespace webrtc
#endif // SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_
#endif // RTC_BASE_MEMORY_ALIGNED_MALLOC_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/include/aligned_malloc.h"
#include "rtc_base/memory/aligned_malloc.h"
#include <memory>

View file

@ -373,7 +373,7 @@ rtc_static_library("video_jni") {
"../../rtc_base:rtc_task_queue",
"../../rtc_base:sequenced_task_checker",
"../../rtc_base:weak_ptr",
"../../system_wrappers",
"../../rtc_base/memory:aligned_malloc",
"../../system_wrappers:field_trial_api",
"//third_party/libyuv",
]

View file

@ -17,13 +17,13 @@
#include "rtc_base/checks.h"
#include "rtc_base/keep_ref_until_done.h"
#include "rtc_base/logging.h"
#include "rtc_base/memory/aligned_malloc.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/timeutils.h"
#include "sdk/android/generated_video_jni/jni/VideoFrame_jni.h"
#include "sdk/android/src/jni/jni_helpers.h"
#include "sdk/android/src/jni/surfacetexturehelper.h"
#include "sdk/android/src/jni/wrapped_native_i420_buffer.h"
#include "system_wrappers/include/aligned_malloc.h"
#include "third_party/libyuv/include/libyuv/scale.h"
namespace webrtc {

View file

@ -15,8 +15,6 @@ import("../webrtc.gni")
rtc_static_library("system_wrappers") {
visibility = [ "*" ]
sources = [
"include/aligned_array.h",
"include/aligned_malloc.h",
"include/clock.h",
"include/cpu_info.h",
"include/event_wrapper.h",
@ -26,7 +24,6 @@ rtc_static_library("system_wrappers") {
"include/rw_lock_wrapper.h",
"include/sleep.h",
"include/timestamp_extrapolator.h",
"source/aligned_malloc.cc",
"source/clock.cc",
"source/cpu_features.cc",
"source/cpu_info.cc",
@ -219,8 +216,6 @@ if (rtc_include_tests) {
rtc_test("system_wrappers_unittests") {
testonly = true
sources = [
"source/aligned_array_unittest.cc",
"source/aligned_malloc_unittest.cc",
"source/clock_unittest.cc",
"source/event_timer_posix_unittest.cc",
"source/metrics_default_unittest.cc",