1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_VIZ_COMMON_RESOURCES_SINGLE_RELEASE_CALLBACK_H_ 6 #define COMPONENTS_VIZ_COMMON_RESOURCES_SINGLE_RELEASE_CALLBACK_H_ 7 8 #include <memory> 9 10 #include "base/memory/ptr_util.h" 11 #include "components/viz/common/resources/release_callback.h" 12 #include "components/viz/common/viz_common_export.h" 13 14 namespace viz { 15 16 class VIZ_COMMON_EXPORT SingleReleaseCallback { 17 public: Create(ReleaseCallback cb)18 static std::unique_ptr<SingleReleaseCallback> Create(ReleaseCallback cb) { 19 return base::WrapUnique(new SingleReleaseCallback(std::move(cb))); 20 } 21 22 ~SingleReleaseCallback(); 23 24 void Run(const gpu::SyncToken& sync_token, bool is_lost); 25 26 private: 27 explicit SingleReleaseCallback(ReleaseCallback callback); 28 29 ReleaseCallback callback_; 30 }; 31 32 } // namespace viz 33 34 #endif // COMPONENTS_VIZ_COMMON_RESOURCES_SINGLE_RELEASE_CALLBACK_H_ 35