Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3dc90e52 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "FastPath: More clang-tidy optimizations"

parents fad773db 87e740a6
Loading
Loading
Loading
Loading
+0 −9
Original line number Original line Diff line number Diff line
@@ -61,16 +61,7 @@ fastpath_tidy_errors = [
    "-bugprone-narrowing-conversions", // b/182410845
    "-bugprone-narrowing-conversions", // b/182410845


    // TODO(b/275642749) Reenable these warnings
    // TODO(b/275642749) Reenable these warnings
    "-bugprone-assignment-in-if-condition",
    "-bugprone-forward-declaration-namespace",
    "-bugprone-parent-virtual-call",
    "-cert-dcl59-cpp",
    "-cert-err34-c",
    "-google-runtime-int",
    "-misc-non-private-member-variables-in-classes",
    "-misc-non-private-member-variables-in-classes",
    "-modernize-concat-nested-namespaces",
    "-modernize-loop-convert",
    "-modernize-use-default-member-init",
    "-performance-no-int-to-ptr",
    "-performance-no-int-to-ptr",
]
]


+3 −7
Original line number Original line Diff line number Diff line
@@ -30,17 +30,13 @@


namespace android {
namespace android {


/*static*/ const FastCaptureState FastCapture::sInitial;
/*static*/ const FastCaptureState FastCapture::sInitial{};


FastCapture::FastCapture() : FastThread("cycleC_ms", "loadC_us"),
FastCapture::FastCapture() : FastThread("cycleC_ms", "loadC_us")
    mInputSource(nullptr), mInputSourceGen(0), mPipeSink(nullptr), mPipeSinkGen(0),
    mReadBuffer(nullptr), mReadBufferState(-1), mFormat(Format_Invalid), mSampleRate(0),
    // mDummyDumpState
    mTotalNativeFramesRead(0)
{
{
    // base class initialization
    mPrevious = &sInitial;
    mPrevious = &sInitial;
    mCurrent = &sInitial;
    mCurrent = &sInitial;

    mDummyDumpState = &mDummyFastCaptureDumpState;
    mDummyDumpState = &mDummyFastCaptureDumpState;
}
}


+10 −10
Original line number Original line Diff line number Diff line
@@ -48,17 +48,17 @@ private:


    FastCaptureState    mPreIdle;   // copy of state before we went into idle
    FastCaptureState    mPreIdle;   // copy of state before we went into idle
    // FIXME by renaming, could pull up many of these to FastThread
    // FIXME by renaming, could pull up many of these to FastThread
    NBAIO_Source*       mInputSource;
    NBAIO_Source*       mInputSource = nullptr;
    int                 mInputSourceGen;
    int                 mInputSourceGen = 0;
    NBAIO_Sink*         mPipeSink;
    NBAIO_Sink*         mPipeSink = nullptr;
    int                 mPipeSinkGen;
    int                 mPipeSinkGen = 0;
    void*               mReadBuffer;
    void*               mReadBuffer = nullptr;
    ssize_t             mReadBufferState;   // number of initialized frames in readBuffer,
    ssize_t             mReadBufferState = -1;  // number of initialized frames in readBuffer,
                                                // or -1 to clear
                                                // or -1 to clear
    NBAIO_Format        mFormat;
    NBAIO_Format        mFormat = Format_Invalid;
    unsigned            mSampleRate;
    unsigned            mSampleRate = 0;
    FastCaptureDumpState mDummyFastCaptureDumpState;
    FastCaptureDumpState mDummyFastCaptureDumpState;
    uint32_t            mTotalNativeFramesRead; // copied to dumpState->mFramesRead
    uint32_t            mTotalNativeFramesRead = 0; // copied to dumpState->mFramesRead


};  // class FastCapture
};  // class FastCapture


+0 −5
Original line number Original line Diff line number Diff line
@@ -24,11 +24,6 @@


namespace android {
namespace android {


FastCaptureDumpState::FastCaptureDumpState() : FastThreadDumpState(),
    mReadSequence(0), mFramesRead(0), mReadErrors(0), mSampleRate(0), mFrameCount(0)
{
}

void FastCaptureDumpState::dump(int fd) const
void FastCaptureDumpState::dump(int fd) const
{
{
    if (mCommand == FastCaptureState::INITIAL) {
    if (mCommand == FastCaptureState::INITIAL) {
+5 −7
Original line number Original line Diff line number Diff line
@@ -24,16 +24,14 @@
namespace android {
namespace android {


struct FastCaptureDumpState : FastThreadDumpState {
struct FastCaptureDumpState : FastThreadDumpState {
    FastCaptureDumpState();

    void dump(int fd) const;    // should only be called on a stable copy, not the original
    void dump(int fd) const;    // should only be called on a stable copy, not the original


    // FIXME by renaming, could pull up many of these to FastThreadDumpState
    // FIXME by renaming, could pull up many of these to FastThreadDumpState
    uint32_t mReadSequence;     // incremented before and after each read()
    uint32_t mReadSequence = 0;  // incremented before and after each read()
    uint32_t mFramesRead;       // total number of frames read successfully
    uint32_t mFramesRead = 0;    // total number of frames read successfully
    uint32_t mReadErrors;       // total number of read() errors
    uint32_t mReadErrors = 0;    // total number of read() errors
    uint32_t mSampleRate;
    uint32_t mSampleRate = 0;
    size_t   mFrameCount;
    size_t   mFrameCount = 0;
    bool     mSilenced = false; // capture is silenced
    bool     mSilenced = false; // capture is silenced
};
};


Loading