diff options
| author | 2018-11-02 18:34:07 -0700 | |
|---|---|---|
| committer | 2018-11-02 18:43:01 -0700 | |
| commit | 8e8fe529a69761aad6a84fb8025cebd3673d77db (patch) | |
| tree | 13b8f06e4a81d4318abc98cfea8b90bc968400d0 /services/surfaceflinger/Layer.cpp | |
| parent | c39309375b269bce3a68dadd0bc1d5bc29bc57c0 (diff) | |
SF TimeStats: fix a hazard issue
The setAcquireFence and setDesiredTime could happen in between the
splited setLayerName and setPostTime, where setLayerName inserts an
entry but setPostTime actually initializes the structure and waitData
position. This change combine setLayerName and setPostTime again to
eliminate the hazard.
Test: build
Bug: b/118770127
Change-Id: Ia1961cb688bbabf23d88305750e69c9fa41da8dd
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 88c3c8a018..2e564e7d94 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1476,9 +1476,8 @@ void Layer::onDisconnect() { void Layer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps, FrameEventHistoryDelta* outDelta) { if (newTimestamps) { - const int32_t layerID = getSequence(); - mTimeStats.setLayerName(layerID, getName().c_str()); - mTimeStats.setPostTime(layerID, newTimestamps->frameNumber, newTimestamps->postedTime); + mTimeStats.setPostTime(getSequence(), newTimestamps->frameNumber, getName().c_str(), + newTimestamps->postedTime); } Mutex::Autolock lock(mFrameEventHistoryMutex); |