Flutter Impeller
unique_handle_gles.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_UNIQUE_HANDLE_GLES_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_UNIQUE_HANDLE_GLES_H_
7 
10 
11 namespace impeller {
12 
13 //------------------------------------------------------------------------------
14 /// @brief A unique handle to an OpenGL object. The collection of this
15 /// handle scheduled the destruction of the associated OpenGL object
16 /// in the reactor.
17 ///
19  public:
20  UniqueHandleGLES() = default;
21 
22  UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor, HandleType type);
23 
24  static UniqueHandleGLES MakeUntracked(std::shared_ptr<ReactorGLES> reactor,
25  HandleType type);
26 
27  UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor, HandleGLES handle);
28 
30 
33 
36 
37  const HandleGLES& Get() const;
38 
39  bool IsValid() const;
40 
41  /// Collect the managed handle and replace it with a dead handle.
42  void Reset();
43 
44  /// Release ownership of the handle.
46 
47  private:
48  std::shared_ptr<ReactorGLES> reactor_ = nullptr;
50 
51  void CollectHandle();
52 };
53 
54 } // namespace impeller
55 
56 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_UNIQUE_HANDLE_GLES_H_
Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can b...
Definition: handle_gles.h:42
static HandleGLES DeadHandle()
Creates a dead handle.
Definition: handle_gles.h:49
A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the a...
static UniqueHandleGLES MakeUntracked(std::shared_ptr< ReactorGLES > reactor, HandleType type)
UniqueHandleGLES & operator=(const UniqueHandleGLES &)=delete
const HandleGLES & Get() const
UniqueHandleGLES(const UniqueHandleGLES &)=delete
void Reset()
Collect the managed handle and replace it with a dead handle.
UniqueHandleGLES & operator=(UniqueHandleGLES &&)
HandleGLES Release()
Release ownership of the handle.
std::shared_ptr< ReactorGLES > reactor