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#include "flutter/flow/gl_context_switch.h"
6
7namespace flutter {
8
9SwitchableGLContext::SwitchableGLContext() = default;
10
11SwitchableGLContext::~SwitchableGLContext() = default;
12
13GLContextResult::GLContextResult() = default;
14
15GLContextResult::~GLContextResult() = default;
16
17GLContextResult::GLContextResult(bool static_result) : result_(static_result){};
18
19bool GLContextResult::GetResult() {
20 return result_;
21};
22
23GLContextDefaultResult::GLContextDefaultResult(bool static_result)
24 : GLContextResult(static_result){};
25
26GLContextDefaultResult::~GLContextDefaultResult() = default;
27
28GLContextSwitch::GLContextSwitch(std::unique_ptr<SwitchableGLContext> context)
29 : context_(std::move(context)) {
30 FML_CHECK(context_ != nullptr);
31 result_ = context_->SetCurrent();
32};
33
34GLContextSwitch::~GLContextSwitch() {
35 context_->RemoveCurrent();
36};
37
38} // namespace flutter
39