Move rw_lock_wrapper.h to rtc_base/synchronization/

This moves it 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
NOPRESUBMIT=true

Change-Id: Ie2879aca5fc1667e4222499d2a8fc2bba9ae2425
Reviewed-on: https://webrtc-review.googlesource.com/21328
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22587}
This commit is contained in:
Karl Wiberg
2018-03-23 14:53:54 +01:00
committed by Commit Bot
parent 5e55fe845e
commit 2b85792b01
22 changed files with 79 additions and 41 deletions

View File

@ -188,6 +188,7 @@ rtc_static_library("call") {
"../rtc_base:rtc_task_queue",
"../rtc_base:safe_minmax",
"../rtc_base:sequenced_task_checker",
"../rtc_base/synchronization:rw_lock_wrapper",
"../system_wrappers",
"../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api",

View File

@ -54,13 +54,13 @@
#include "rtc_base/ptr_util.h"
#include "rtc_base/rate_limiter.h"
#include "rtc_base/sequenced_task_checker.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/cpu_info.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "video/call_stats.h"
#include "video/send_delay_stats.h"
#include "video/stats_counter.h"

View File

@ -1378,6 +1378,7 @@ if (rtc_include_tests) {
"../../api:optional",
"../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:rtc_base_approved",
"../../rtc_base/synchronization:rw_lock_wrapper",
"../../system_wrappers",
"../../test:fileutils",
"../../test:test_support",

View File

@ -18,8 +18,8 @@
#include "modules/audio_coding/test/Channel.h"
#include "modules/audio_coding/test/PCMFile.h"
#include "modules/audio_coding/test/utility.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "system_wrappers/include/event_wrapper.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
namespace webrtc {

View File

@ -20,7 +20,7 @@
#endif
#include "audio_coding_module.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
// TODO(tlegrand): Consider removing usage of gtest.
#include "test/gtest.h"
#include "typedefs.h" // NOLINT(build/include)

View File

@ -16,7 +16,7 @@
#include "modules/audio_coding/include/audio_coding_module.h"
#include "modules/include/module_common_types.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {

View File

@ -363,6 +363,7 @@ rtc_static_library("desktop_capture_generic") {
"../../api:refcountedbase",
"../../rtc_base:checks",
"../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
"../../rtc_base/synchronization:rw_lock_wrapper",
"../../system_wrappers",
"../../system_wrappers:cpu_features_api",
"../../system_wrappers:metrics_api",

View File

@ -16,7 +16,7 @@
#include "modules/desktop_capture/desktop_geometry.h"
#include "modules/desktop_capture/desktop_region.h"
#include "rtc_base/constructormagic.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
namespace webrtc {

View File

@ -37,6 +37,7 @@ rtc_static_library("video_capture_module") {
"../../media:rtc_media_base",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
"../../rtc_base/synchronization:rw_lock_wrapper",
"../../system_wrappers",
"//third_party/libyuv",
]

View File

@ -14,7 +14,7 @@
#include <vector>
#include "modules/video_capture/video_capture.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
namespace webrtc
{

View File

@ -0,0 +1,38 @@
# 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("rw_lock_wrapper") {
public = [
"rw_lock_wrapper.h",
]
sources = [
"rw_lock_wrapper.cc",
]
deps = [
"..:macromagic",
"../..:typedefs",
]
if (is_win) {
sources += [
"rw_lock_win.cc",
"rw_lock_win.h",
]
deps += [ "..:logging" ]
} else {
sources += [
"rw_lock_posix.cc",
"rw_lock_posix.h",
]
}
}

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/source/rw_lock_posix.h"
#include "rtc_base/synchronization/rw_lock_posix.h"
namespace webrtc {

View File

@ -8,14 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
#define SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "typedefs.h" // NOLINT(build/include)
#ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_
#define RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_
#include <pthread.h>
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
class RWLockPosix : public RWLockWrapper {
@ -38,4 +38,4 @@ class RWLockPosix : public RWLockWrapper {
} // namespace webrtc
#endif // SYSTEM_WRAPPERS_SOURCE_RW_LOCK_POSIX_H_
#endif // RTC_BASE_SYNCHRONIZATION_RW_LOCK_POSIX_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/source/rw_lock_win.h"
#include "rtc_base/synchronization/rw_lock_win.h"
#include "rtc_base/logging.h"

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_
#define SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_
#ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
#define RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include <Windows.h>
@ -20,13 +20,12 @@ namespace webrtc {
class RWLockWin : public RWLockWrapper {
public:
static RWLockWin* Create();
~RWLockWin() {}
virtual void AcquireLockExclusive();
virtual void ReleaseLockExclusive();
void AcquireLockExclusive() override;
void ReleaseLockExclusive() override;
virtual void AcquireLockShared();
virtual void ReleaseLockShared();
void AcquireLockShared() override;
void ReleaseLockShared() override;
private:
RWLockWin();
@ -37,4 +36,4 @@ class RWLockWin : public RWLockWrapper {
} // namespace webrtc
#endif // SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_
#endif // RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_

View File

@ -8,14 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include <assert.h>
#if defined(_WIN32)
#include "system_wrappers/source/rw_lock_win.h"
#include "rtc_base/synchronization/rw_lock_win.h"
#else
#include "system_wrappers/source/rw_lock_posix.h"
#include "rtc_base/synchronization/rw_lock_posix.h"
#endif
namespace webrtc {

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_
#define SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_
#ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_WRAPPER_H_
#define RTC_BASE_SYNCHRONIZATION_RW_LOCK_WRAPPER_H_
#include "rtc_base/thread_annotations.h"
@ -35,7 +35,8 @@ class RTC_LOCKABLE RWLockWrapper {
// provides more compact locking syntax.
class RTC_SCOPED_LOCKABLE ReadLockScoped {
public:
ReadLockScoped(RWLockWrapper& rw_lock) RTC_SHARED_LOCK_FUNCTION(rw_lock)
explicit ReadLockScoped(RWLockWrapper& rw_lock)
RTC_SHARED_LOCK_FUNCTION(rw_lock)
: rw_lock_(rw_lock) {
rw_lock_.AcquireLockShared();
}
@ -48,7 +49,8 @@ class RTC_SCOPED_LOCKABLE ReadLockScoped {
class RTC_SCOPED_LOCKABLE WriteLockScoped {
public:
WriteLockScoped(RWLockWrapper& rw_lock) RTC_EXCLUSIVE_LOCK_FUNCTION(rw_lock)
explicit WriteLockScoped(RWLockWrapper& rw_lock)
RTC_EXCLUSIVE_LOCK_FUNCTION(rw_lock)
: rw_lock_(rw_lock) {
rw_lock_.AcquireLockExclusive();
}
@ -61,4 +63,4 @@ class RTC_SCOPED_LOCKABLE WriteLockScoped {
} // namespace webrtc
#endif // SYSTEM_WRAPPERS_INCLUDE_RW_LOCK_WRAPPER_H_
#endif // RTC_BASE_SYNCHRONIZATION_RW_LOCK_WRAPPER_H_

View File

@ -19,6 +19,6 @@ rtc_source_set("timestamp_extrapolator") {
]
deps = [
"../..:typedefs",
"../../system_wrappers",
"../synchronization:rw_lock_wrapper",
]
}

View File

@ -11,7 +11,7 @@
#ifndef RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
#define RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {

View File

@ -20,7 +20,6 @@ rtc_static_library("system_wrappers") {
"include/event_wrapper.h",
"include/ntp_time.h",
"include/rtp_to_ntp_estimator.h",
"include/rw_lock_wrapper.h",
"include/sleep.h",
"source/clock.cc",
"source/cpu_features.cc",
@ -31,11 +30,6 @@ rtc_static_library("system_wrappers") {
"source/event_timer_win.cc",
"source/event_timer_win.h",
"source/rtp_to_ntp_estimator.cc",
"source/rw_lock.cc",
"source/rw_lock_posix.cc",
"source/rw_lock_posix.h",
"source/rw_lock_win.cc",
"source/rw_lock_win.h",
"source/sleep.cc",
]
@ -51,6 +45,7 @@ rtc_static_library("system_wrappers") {
"../api:optional",
"../modules:module_api_public",
"../rtc_base:checks",
"../rtc_base/synchronization:rw_lock_wrapper",
]
if (is_android) {

View File

@ -13,8 +13,8 @@
#include <memory>
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "system_wrappers/include/ntp_time.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {

View File

@ -25,8 +25,8 @@
#endif // defined(WEBRTC_POSIX)
#include "rtc_base/criticalsection.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "rtc_base/timeutils.h"
#include "system_wrappers/include/rw_lock_wrapper.h"
namespace webrtc {