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}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index b7ff32b..7b0dc09 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -293,7 +293,7 @@
":video_frame_api",
"../rtc_base:checks",
"../rtc_base:rtc_base",
- "../system_wrappers",
+ "../rtc_base/memory:aligned_malloc",
"//third_party/libyuv",
]
}
diff --git a/api/DEPS b/api/DEPS
index ba5d623..d7f00eb 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -24,8 +24,4 @@
"+modules/audio_coding",
"+modules/audio_processing",
],
-
- ".*i420_buffer\.h": [
- "+system_wrappers/include/aligned_malloc.h",
- ],
}
diff --git a/api/video/i420_buffer.h b/api/video/i420_buffer.h
index bdac80b..2bd37bd 100644
--- a/api/video/i420_buffer.h
+++ b/api/video/i420_buffer.h
@@ -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 {
diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn
index 1a3615b..6aee9d0 100644
--- a/common_audio/BUILD.gn
+++ b/common_audio/BUILD.gn
@@ -68,6 +68,8 @@
"../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 @@
"../:typedefs",
"../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved",
+ "../rtc_base/memory:aligned_malloc",
"../system_wrappers",
]
}
@@ -313,7 +316,7 @@
":sinc_resampler",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
- "../system_wrappers",
+ "../rtc_base/memory:aligned_malloc",
]
}
}
@@ -354,7 +357,7 @@
":sinc_resampler",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
- "../system_wrappers",
+ "../rtc_base/memory:aligned_malloc",
]
}
diff --git a/common_audio/fir_filter_neon.cc b/common_audio/fir_filter_neon.cc
index d9f91b7..e27f21b 100644
--- a/common_audio/fir_filter_neon.cc
+++ b/common_audio/fir_filter_neon.cc
@@ -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 {
diff --git a/common_audio/fir_filter_neon.h b/common_audio/fir_filter_neon.h
index 5696df8..1ffefd8 100644
--- a/common_audio/fir_filter_neon.h
+++ b/common_audio/fir_filter_neon.h
@@ -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 {
diff --git a/common_audio/fir_filter_sse.cc b/common_audio/fir_filter_sse.cc
index 3302d56..0da23fc 100644
--- a/common_audio/fir_filter_sse.cc
+++ b/common_audio/fir_filter_sse.cc
@@ -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 {
diff --git a/common_audio/fir_filter_sse.h b/common_audio/fir_filter_sse.h
index 6506024..7707f93 100644
--- a/common_audio/fir_filter_sse.h
+++ b/common_audio/fir_filter_sse.h
@@ -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 {
diff --git a/common_audio/lapped_transform.h b/common_audio/lapped_transform.h
index fe3a8cd..c97cd16 100644
--- a/common_audio/lapped_transform.h
+++ b/common_audio/lapped_transform.h
@@ -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 {
diff --git a/common_audio/real_fourier.h b/common_audio/real_fourier.h
index 4c69c3c..d16149b 100644
--- a/common_audio/real_fourier.h
+++ b/common_audio/real_fourier.h
@@ -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
diff --git a/common_audio/resampler/sinc_resampler.h b/common_audio/resampler/sinc_resampler.h
index d011224..774a9b7 100644
--- a/common_audio/resampler/sinc_resampler.h
+++ b/common_audio/resampler/sinc_resampler.h
@@ -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 {
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 11dacab..eb02ffb 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1228,6 +1228,7 @@
"../system_wrappers:system_wrappers",
"../test:fileutils",
"../test:test_support",
+ "memory:unittests",
]
}
diff --git a/rtc_base/memory/BUILD.gn b/rtc_base/memory/BUILD.gn
new file mode 100644
index 0000000..e24b8ce
--- /dev/null
+++ b/rtc_base/memory/BUILD.gn
@@ -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",
+ ]
+}
diff --git a/system_wrappers/include/aligned_array.h b/rtc_base/memory/aligned_array.h
similarity index 88%
rename from system_wrappers/include/aligned_array.h
rename to rtc_base/memory/aligned_array.h
index 793c785..dcdef12 100644
--- a/system_wrappers/include/aligned_array.h
+++ b/rtc_base/memory/aligned_array.h
@@ -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 @@
} // namespace webrtc
-#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_ALIGNED_ARRAY_
+#endif // RTC_BASE_MEMORY_ALIGNED_ARRAY_H_
diff --git a/system_wrappers/source/aligned_array_unittest.cc b/rtc_base/memory/aligned_array_unittest.cc
similarity index 96%
rename from system_wrappers/source/aligned_array_unittest.cc
rename to rtc_base/memory/aligned_array_unittest.cc
index e5a3c18..81fd468 100644
--- a/system_wrappers/source/aligned_array_unittest.cc
+++ b/rtc_base/memory/aligned_array_unittest.cc
@@ -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>
diff --git a/system_wrappers/source/aligned_malloc.cc b/rtc_base/memory/aligned_malloc.cc
similarity index 97%
rename from system_wrappers/source/aligned_malloc.cc
rename to rtc_base/memory/aligned_malloc.cc
index 43ece9e..4e1e85c 100644
--- a/system_wrappers/source/aligned_malloc.cc
+++ b/rtc_base/memory/aligned_malloc.cc
@@ -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>
diff --git a/system_wrappers/include/aligned_malloc.h b/rtc_base/memory/aligned_malloc.h
similarity index 92%
rename from system_wrappers/include/aligned_malloc.h
rename to rtc_base/memory/aligned_malloc.h
index 33b23d2..42a6daa 100644
--- a/system_wrappers/include/aligned_malloc.h
+++ b/rtc_base/memory/aligned_malloc.h
@@ -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 @@
} // namespace webrtc
-#endif // SYSTEM_WRAPPERS_INCLUDE_ALIGNED_MALLOC_H_
+#endif // RTC_BASE_MEMORY_ALIGNED_MALLOC_H_
diff --git a/system_wrappers/source/aligned_malloc_unittest.cc b/rtc_base/memory/aligned_malloc_unittest.cc
similarity index 97%
rename from system_wrappers/source/aligned_malloc_unittest.cc
rename to rtc_base/memory/aligned_malloc_unittest.cc
index 7afbf6d..742a772 100644
--- a/system_wrappers/source/aligned_malloc_unittest.cc
+++ b/rtc_base/memory/aligned_malloc_unittest.cc
@@ -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>
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index a76e6b3..f004fa4 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -373,7 +373,7 @@
"../../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",
]
diff --git a/sdk/android/src/jni/videoframe.cc b/sdk/android/src/jni/videoframe.cc
index 22867e4..92e4a66 100644
--- a/sdk/android/src/jni/videoframe.cc
+++ b/sdk/android/src/jni/videoframe.cc
@@ -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 {
diff --git a/system_wrappers/BUILD.gn b/system_wrappers/BUILD.gn
index 271cc2c..9d339be 100644
--- a/system_wrappers/BUILD.gn
+++ b/system_wrappers/BUILD.gn
@@ -15,8 +15,6 @@
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 @@
"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 @@
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",