summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Anton Ivanov <aii@google.com> 2025-03-14 14:56:12 -0700
committer Anton Ivanov <aii@google.com> 2025-03-17 15:19:12 -0700
commit9045666047d55134c2e4f0108a88b5799653003e (patch)
treeed3b00a90cc9ba8d5f71802974ef0b5783f0e55c /libs
parenta4e35c689dbab4ad538da39ddb88aecba83d1abb (diff)
Ensure Choreographer is held as sp<> in SurfaceControl.
Test: ChoreographerTests pass Flag: EXEMPT refactor Bug: 393217449 Change-Id: I60d42f383d4b73b60de1a7a1bbeec5170b805ebb
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/SurfaceControl.cpp4
-rw-r--r--libs/gui/include/gui/SurfaceControl.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 1eb9b87c3c..50877f8c56 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -194,7 +194,7 @@ const std::string& SurfaceControl::getName() const {
return mName;
}
-std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() {
+sp<Choreographer> SurfaceControl::getChoreographer() {
if (mChoreographer) {
return mChoreographer;
}
@@ -203,7 +203,7 @@ std::shared_ptr<Choreographer> SurfaceControl::getChoreographer() {
ALOGE("%s: No looper prepared for thread", __func__);
return nullptr;
}
- mChoreographer = std::make_shared<Choreographer>(looper, getHandle());
+ mChoreographer = sp<Choreographer>::make(looper, getHandle());
status_t result = mChoreographer->initialize();
if (result != OK) {
ALOGE("Failed to initialize choreographer");
diff --git a/libs/gui/include/gui/SurfaceControl.h b/libs/gui/include/gui/SurfaceControl.h
index 344b957ba7..91a422d155 100644
--- a/libs/gui/include/gui/SurfaceControl.h
+++ b/libs/gui/include/gui/SurfaceControl.h
@@ -26,6 +26,7 @@
#include <android/gui/ISurfaceComposerClient.h>
+#include <gui/Choreographer.h>
#include <ui/FrameStats.h>
#include <ui/PixelFormat.h>
#include <ui/Region.h>
@@ -36,7 +37,6 @@ namespace android {
// ---------------------------------------------------------------------------
-class Choreographer;
class IGraphicBufferProducer;
class Surface;
class SurfaceComposerClient;
@@ -82,7 +82,7 @@ public:
const std::string& getName() const;
// TODO(b/267195698): Consider renaming.
- std::shared_ptr<Choreographer> getChoreographer();
+ sp<Choreographer> getChoreographer();
sp<IGraphicBufferProducer> getIGraphicBufferProducer();
@@ -134,7 +134,7 @@ private:
PixelFormat mFormat = PIXEL_FORMAT_NONE;
uint32_t mCreateFlags = 0;
uint64_t mFallbackFrameNumber = 100;
- std::shared_ptr<Choreographer> mChoreographer;
+ sp<Choreographer> mChoreographer;
};
}; // namespace android