diff options
author | mtklein <mtklein@chromium.org> | 2015-07-29 11:10:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-29 11:10:46 -0700 |
commit | 22355c4f404becfdc39b962c15533cef9f45615c (patch) | |
tree | 722a2a7652c9725156d82070d24d894413cdae03 /src | |
parent | e43e3bdd6d7a49623496331a17344a76d04caa7e (diff) |
Move headers with no dependencies.
C.f. https://codereview.chromium.org/1261013003/
BUG=skia:4126
Will follow up with two more CLs if this works:
- one moving SkRecords.h
- one moving SkMiniRecorder.h
No public API changes.
TBR=reed@google.com
Committed: https://skia.googlesource.com/skia/+/117842223bd13325b6da26110d80e0590c1a742b
Review URL: https://codereview.chromium.org/1266593002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkFunction.h | 75 | ||||
-rw-r--r-- | src/gpu/SkGpuFenceSync.h | 29 |
2 files changed, 0 insertions, 104 deletions
diff --git a/src/core/SkFunction.h b/src/core/SkFunction.h deleted file mode 100644 index 8e41cba929..0000000000 --- a/src/core/SkFunction.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFunction_DEFINED -#define SkFunction_DEFINED - -// TODO: document, more pervasive move support in constructors, small-Fn optimization - -#include "SkTemplates.h" -#include "SkTypes.h" - -template <typename> class SkFunction; - -template <typename R, typename... Args> -class SkFunction<R(Args...)> { -public: - SkFunction() {} - - template <typename Fn> - SkFunction(const Fn& fn) : fFunction(SkNEW_ARGS(LambdaImpl<Fn>, (fn))) {} - - SkFunction(R (*fn)(Args...)) : fFunction(SkNEW_ARGS(FnPtrImpl, (fn))) {} - - SkFunction(const SkFunction& other) { *this = other; } - SkFunction& operator=(const SkFunction& other) { - if (this != &other) { - fFunction.reset(other.fFunction ? other.fFunction->clone() : nullptr); - } - return *this; - } - - R operator()(Args... args) const { - SkASSERT(fFunction.get()); - return fFunction->call(Forward(args)...); - } - -private: - // ~= std::forward. This moves its argument if possible, falling back to a copy if not. - template <typename T> static T&& Forward(T& v) { return (T&&)v; } - - struct Interface { - virtual ~Interface() {} - virtual R call(Args...) const = 0; - virtual Interface* clone() const = 0; - }; - - template <typename Fn> - class LambdaImpl final : public Interface { - public: - LambdaImpl(const Fn& fn) : fFn(fn) {} - - R call(Args... args) const override { return fFn(Forward(args)...); } - Interface* clone() const override { return SkNEW_ARGS(LambdaImpl<Fn>, (fFn)); } - private: - Fn fFn; - }; - - class FnPtrImpl final : public Interface { - public: - FnPtrImpl(R (*fn)(Args...)) : fFn(fn) {} - - R call(Args... args) const override { return fFn(Forward(args)...); } - Interface* clone() const override { return SkNEW_ARGS(FnPtrImpl, (fFn)); } - private: - R (*fFn)(Args...); - }; - - SkAutoTDelete<Interface> fFunction; -}; - -#endif//SkFunction_DEFINED diff --git a/src/gpu/SkGpuFenceSync.h b/src/gpu/SkGpuFenceSync.h deleted file mode 100644 index b78398fed8..0000000000 --- a/src/gpu/SkGpuFenceSync.h +++ /dev/null @@ -1,29 +0,0 @@ - -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkGpuFenceSync_DEFINED -#define SkGpuFenceSync_DEFINED - -#include "SkTypes.h" - -typedef void* SkPlatformGpuFence; - -/* - * This class provides an interface to interact with fence syncs. A fence sync is an object that the - * client can insert into the GPU command stream, and then at any future time, wait until all - * commands that were issued before the fence have completed. - */ -class SkGpuFenceSync { -public: - virtual SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const = 0; - virtual bool flushAndWaitFence(SkPlatformGpuFence) const = 0; - virtual void deleteFence(SkPlatformGpuFence) const = 0; - - virtual ~SkGpuFenceSync() {} -}; - -#endif |