| 3472 | } |
| 3473 | |
| 3474 | void PMTraceConsumer::DequeuePresentEvents(std::vector<std::shared_ptr<PresentEvent>>& outPresentEvents) |
| 3475 | { |
| 3476 | outPresentEvents.clear(); |
| 3477 | { |
| 3478 | std::lock_guard<std::mutex> lock(mPresentEventMutex); |
| 3479 | if (mReadyCount > 0) { |
| 3480 | outPresentEvents.resize(mReadyCount, nullptr); |
| 3481 | for (uint32_t i = 0; i < mReadyCount; ++i) { |
| 3482 | std::swap(outPresentEvents[i], mCompletedPresents[mCompletedIndex]); |
| 3483 | mCompletedIndex = GetRingIndex(mCompletedIndex + 1); |
| 3484 | } |
| 3485 | |
| 3486 | mCompletedCount -= mReadyCount; |
| 3487 | mReadyCount = 0; |
| 3488 | } |
| 3489 | } |
| 3490 | if (!mIsRealtimeSession && !mDisableOfflineBackpressure) { |
| 3491 | mCompletedRingCondition.notify_one(); |
| 3492 | } |
| 3493 | } |
| 3494 | |
| 3495 | void PMTraceConsumer::SetProviderToggleMode(bool enabled) { |
| 3496 | mProviderToggleMode.store(enabled, std::memory_order_release); |
no outgoing calls
no test coverage detected