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

Commit e03cebc7 authored by Jayant Chowdhary's avatar Jayant Chowdhary Committed by Android (Google) Code Review
Browse files

Merge "Add some move constructors and assignment operators to CameraMetadata."

parents b1cc886c 8a0be29c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -50,6 +50,15 @@ CameraMetadata::CameraMetadata(const CameraMetadata &other) :
    mBuffer = clone_camera_metadata(other.mBuffer);
}

CameraMetadata::CameraMetadata(CameraMetadata &&other) :mBuffer(NULL),  mLocked(false) {
    acquire(other);
}

CameraMetadata &CameraMetadata::operator=(CameraMetadata &&other) {
    acquire(other);
    return *this;
}

CameraMetadata::CameraMetadata(camera_metadata_t *buffer) :
        mBuffer(NULL), mLocked(false) {
    acquire(buffer);
+6 −0
Original line number Diff line number Diff line
@@ -117,6 +117,12 @@ CaptureResult::CaptureResult() :
        mMetadata(), mResultExtras() {
}

CaptureResult::CaptureResult(CaptureResult &&otherResult) {
    mMetadata = std::move(otherResult.mMetadata);
    mResultExtras = otherResult.mResultExtras;
    mPhysicalMetadatas = std::move(otherResult.mPhysicalMetadatas);
}

CaptureResult::CaptureResult(const CaptureResult &otherResult) {
    mResultExtras = otherResult.mResultExtras;
    mMetadata = otherResult.mMetadata;
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,11 @@ class CameraMetadata: public Parcelable {
     * dataCapacity extra storage */
    CameraMetadata(size_t entryCapacity, size_t dataCapacity = 10);

    /**
     * Move constructor, acquires other's metadata buffer
     */
    CameraMetadata(CameraMetadata &&other);

    ~CameraMetadata();

    /** Takes ownership of passed-in buffer */
@@ -53,6 +58,11 @@ class CameraMetadata: public Parcelable {
    CameraMetadata &operator=(const CameraMetadata &other);
    CameraMetadata &operator=(const camera_metadata_t *buffer);

    /**
     * Move assignment operator, acquires other's metadata buffer
     */
    CameraMetadata &operator=(CameraMetadata &&other);

    /**
     * Get reference to the underlying metadata buffer. Ownership remains with
     * the CameraMetadata object, but non-const CameraMetadata methods will not
+2 −0
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ struct CaptureResult : public virtual LightRefBase<CaptureResult> {

    CaptureResult(const CaptureResult& otherResult);

    CaptureResult(CaptureResult &&captureResult);

    status_t                readFromParcel(android::Parcel* parcel);
    status_t                writeToParcel(android::Parcel* parcel) const;
};
+1 −1
Original line number Diff line number Diff line
@@ -1101,7 +1101,7 @@ class Camera3Device :
    uint32_t               mNextReprocessShutterFrameNumber;
    // the minimal frame number of the next ZSL still capture shutter
    uint32_t               mNextZslStillShutterFrameNumber;
    List<CaptureResult>    mResultQueue;
    std::list<CaptureResult>    mResultQueue;
    std::condition_variable  mResultSignal;
    wp<NotificationListener> mListener;

Loading