Skip to content

Commit

Permalink
Replace skstd::exchange with std::exchange
Browse files Browse the repository at this point in the history
Change-Id: Id8065e4ff7299c12b1469468dab278b771c0382d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286277
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
  • Loading branch information
Adlai-Holler authored and Skia Commit-Bot committed Apr 30, 2020
1 parent 21d1720 commit 5ba50af
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 45 deletions.
25 changes: 0 additions & 25 deletions src/core/SkExchange.h

This file was deleted.

3 changes: 1 addition & 2 deletions src/gpu/GrAHardwareBufferImageGenerator.cpp
Expand Up @@ -20,7 +20,6 @@
#include "include/gpu/GrContext.h"
#include "include/gpu/gl/GrGLTypes.h"
#include "include/private/GrRecordingContext.h"
#include "src/core/SkExchange.h"
#include "src/core/SkMessageBus.h"
#include "src/gpu/GrAHardwareBufferUtils.h"
#include "src/gpu/GrContextPriv.h"
Expand Down Expand Up @@ -126,7 +125,7 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::makeView(GrRecordingContext*
~AutoAHBRelease() { fAhb ? AHardwareBuffer_release(fAhb) : void(); }

AutoAHBRelease& operator=(AutoAHBRelease&& that) {
fAhb = skstd::exchange(that.fAhb, nullptr);
fAhb = std::exchange(that.fAhb, nullptr);
return *this;
}
AutoAHBRelease& operator=(const AutoAHBRelease&) = delete;
Expand Down
3 changes: 1 addition & 2 deletions src/gpu/GrOpsTask.cpp
Expand Up @@ -8,7 +8,6 @@
#include "src/gpu/GrOpsTask.h"

#include "include/private/GrRecordingContext.h"
#include "src/core/SkExchange.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkScopeExit.h"
#include "src/core/SkTraceEvent.h"
Expand Down Expand Up @@ -273,7 +272,7 @@ bool GrOpsTask::OpChain::tryConcat(
SkASSERT(first);
return false;
case GrOp::CombineResult::kMayChain:
fList = DoConcat(std::move(fList), skstd::exchange(*list, List()), caps, arenas,
fList = DoConcat(std::move(fList), std::exchange(*list, List()), caps, arenas,
auditTrail);
// The above exchange cleared out 'list'. The list needs to be empty now for the
// loop to terminate.
Expand Down
9 changes: 4 additions & 5 deletions src/gpu/GrResourceCache.cpp
Expand Up @@ -11,7 +11,6 @@
#include "include/private/GrSingleOwner.h"
#include "include/private/SkTo.h"
#include "include/utils/SkRandom.h"
#include "src/core/SkExchange.h"
#include "src/core/SkMessageBus.h"
#include "src/core/SkOpts.h"
#include "src/core/SkScopeExit.h"
Expand Down Expand Up @@ -78,14 +77,14 @@ inline GrResourceCache::TextureAwaitingUnref::TextureAwaitingUnref(GrTexture* te
: fTexture(texture), fNumUnrefs(1) {}

inline GrResourceCache::TextureAwaitingUnref::TextureAwaitingUnref(TextureAwaitingUnref&& that) {
fTexture = skstd::exchange(that.fTexture, nullptr);
fNumUnrefs = skstd::exchange(that.fNumUnrefs, 0);
fTexture = std::exchange(that.fTexture, nullptr);
fNumUnrefs = std::exchange(that.fNumUnrefs, 0);
}

inline GrResourceCache::TextureAwaitingUnref& GrResourceCache::TextureAwaitingUnref::operator=(
TextureAwaitingUnref&& that) {
fTexture = skstd::exchange(that.fTexture, nullptr);
fNumUnrefs = skstd::exchange(that.fNumUnrefs, 0);
fTexture = std::exchange(that.fTexture, nullptr);
fNumUnrefs = std::exchange(that.fNumUnrefs, 0);
return *this;
}

Expand Down
7 changes: 3 additions & 4 deletions src/gpu/ccpr/GrCCPathCache.h
Expand Up @@ -10,7 +10,6 @@

#include "include/private/SkIDChangeListener.h"
#include "include/private/SkTHash.h"
#include "src/core/SkExchange.h"
#include "src/core/SkTInternalLList.h"
#include "src/gpu/ccpr/GrCCAtlas.h"
#include "src/gpu/ccpr/GrCCPathProcessor.h"
Expand Down Expand Up @@ -89,14 +88,14 @@ class GrCCPathCache {
public:
static OnFlushEntryRef OnFlushRef(GrCCPathCacheEntry*);
OnFlushEntryRef() = default;
OnFlushEntryRef(OnFlushEntryRef&& ref) : fEntry(skstd::exchange(ref.fEntry, nullptr)) {}
OnFlushEntryRef(OnFlushEntryRef&& ref) : fEntry(std::exchange(ref.fEntry, nullptr)) {}
~OnFlushEntryRef();

GrCCPathCacheEntry* get() const { return fEntry; }
GrCCPathCacheEntry* operator->() const { return fEntry; }
GrCCPathCacheEntry& operator*() const { return *fEntry; }
explicit operator bool() const { return fEntry; }
void operator=(OnFlushEntryRef&& ref) { fEntry = skstd::exchange(ref.fEntry, nullptr); }
void operator=(OnFlushEntryRef&& ref) { fEntry = std::exchange(ref.fEntry, nullptr); }

private:
OnFlushEntryRef(GrCCPathCacheEntry* entry) : fEntry(entry) {}
Expand Down Expand Up @@ -359,7 +358,7 @@ inline GrCCPathCache::HashNode::~HashNode() {

inline void GrCCPathCache::HashNode::operator=(HashNode&& node) {
SkASSERT(!fEntry || fEntry->hasBeenEvicted()); // Should have called GrCCPathCache::evict().
fEntry = skstd::exchange(node.fEntry, nullptr);
fEntry = std::exchange(node.fEntry, nullptr);
}

inline void GrCCPathProcessor::Instance::set(
Expand Down
2 changes: 1 addition & 1 deletion src/gpu/ccpr/GrCCPerFlushResources.cpp
Expand Up @@ -559,7 +559,7 @@ bool GrCCPerFlushResources::finalize(GrOnFlushResourceProvider* onFlushRP) {
for (sk_sp<GrTexture>& texture : fRecyclableAtlasTextures) {
if (texture && atlas.currentHeight() == texture->height() &&
atlas.currentWidth() == texture->width()) {
backingTexture = skstd::exchange(texture, nullptr);
backingTexture = std::exchange(texture, nullptr);
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions tests/GrCCPRTest.cpp
Expand Up @@ -12,7 +12,6 @@
#include "include/core/SkRect.h"
#include "include/gpu/mock/GrMockTypes.h"
#include "include/private/GrRecordingContext.h"
#include "src/core/SkExchange.h"
#include "src/core/SkPathPriv.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
Expand Down Expand Up @@ -171,7 +170,7 @@ class CCPRTest {
return;
}

CCPRPathDrawer ccpr(skstd::exchange(mockContext, nullptr), reporter, doStroke);
CCPRPathDrawer ccpr(std::exchange(mockContext, nullptr), reporter, doStroke);
if (!ccpr.valid()) {
return;
}
Expand Down
3 changes: 1 addition & 2 deletions tests/LazyProxyTest.cpp
Expand Up @@ -8,7 +8,6 @@
#include "tests/Test.h"

#include "include/gpu/mock/GrMockTypes.h"
#include "src/core/SkExchange.h"
#include "src/core/SkRectPriv.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
Expand Down Expand Up @@ -261,7 +260,7 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
~TestCallback() { fValue ? (void)(*fValue = -1) : void(); }

TestCallback& operator=(TestCallback&& that) {
fValue = skstd::exchange(that.fValue, nullptr);
fValue = std::exchange(that.fValue, nullptr);
return *this;
}
TestCallback& operator=(const TestCallback& that) = delete;
Expand Down
3 changes: 1 addition & 2 deletions tools/gpu/GpuTimer.h
Expand Up @@ -9,7 +9,6 @@
#define GpuTimer_DEFINED

#include "include/core/SkTypes.h"
#include "src/core/SkExchange.h"

#include <chrono>

Expand Down Expand Up @@ -51,7 +50,7 @@ class GpuTimer {
PlatformTimerQuery SK_WARN_UNUSED_RESULT queueStop() {
SkASSERT(fActiveTimer);
this->onQueueTimerStop(fActiveTimer);
return skstd::exchange(fActiveTimer, kInvalidTimerQuery);
return std::exchange(fActiveTimer, kInvalidTimerQuery);
}

enum class QueryStatus {
Expand Down

0 comments on commit 5ba50af

Please sign in to comment.