Flutter Impeller
unique_handle_gles.cc
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 
6 
7 #include <utility>
8 
9 namespace impeller {
10 
12  : reactor_(std::move(reactor)) {
13  if (reactor_) {
14  handle_ = reactor_->CreateHandle(type);
15  }
16 }
17 
19  : reactor_(std::move(reactor)), handle_(handle) {}
20 
22  if (!handle_.IsDead() && reactor_) {
23  reactor_->CollectHandle(handle_);
24  }
25 }
26 
28  return handle_;
29 }
30 
32  return !handle_.IsDead();
33 }
34 
36  std::swap(reactor_, other.reactor_);
37  std::swap(handle_, other.handle_);
38 }
39 
40 } // namespace impeller
impeller::UniqueHandleGLES::IsValid
bool IsValid() const
Definition: unique_handle_gles.cc:31
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:86
impeller::HandleType
HandleType
Definition: handle_gles.h:18
impeller::HandleGLES::IsDead
constexpr bool IsDead() const
Determines if the handle is dead.
Definition: handle_gles.h:54
impeller::UniqueHandleGLES::Get
const HandleGLES & Get() const
Definition: unique_handle_gles.cc:27
impeller::UniqueHandleGLES::UniqueHandleGLES
UniqueHandleGLES(ReactorGLES::Ref reactor, HandleType type)
Definition: unique_handle_gles.cc:11
type
GLenum type
Definition: blit_command_gles.cc:127
impeller::HandleGLES
Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can b...
Definition: handle_gles.h:36
impeller::UniqueHandleGLES::~UniqueHandleGLES
~UniqueHandleGLES()
Definition: unique_handle_gles.cc:21
std
Definition: comparable.h:95
unique_handle_gles.h
impeller
Definition: allocation.cc:12
impeller::UniqueHandleGLES
A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the a...
Definition: unique_handle_gles.h:18