2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-08-22 20:55:00 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef WEBGL_CONTEXT_LOSS_HANDLER_H_
|
|
|
|
#define WEBGL_CONTEXT_LOSS_HANDLER_H_
|
|
|
|
|
2020-01-09 01:19:14 +03:00
|
|
|
#include "mozilla/Atomics.h"
|
2014-08-22 20:55:00 +04:00
|
|
|
#include "mozilla/WeakPtr.h"
|
2020-01-09 01:19:14 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "nsThreadUtils.h"
|
2014-08-22 20:55:00 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class WebGLContext;
|
|
|
|
|
2020-07-23 17:51:46 +03:00
|
|
|
class WebGLContextLossHandler final : public SupportsWeakPtr {
|
2020-01-09 01:19:14 +03:00
|
|
|
RefPtr<Runnable> mRunnable;
|
|
|
|
Atomic<bool> mTimerIsScheduled;
|
2016-06-16 20:01:44 +03:00
|
|
|
|
2014-08-22 20:55:00 +04:00
|
|
|
public:
|
2014-11-14 07:03:50 +03:00
|
|
|
explicit WebGLContextLossHandler(WebGLContext* webgl);
|
2016-06-16 20:01:44 +03:00
|
|
|
~WebGLContextLossHandler();
|
2014-08-22 20:55:00 +04:00
|
|
|
|
|
|
|
void RunTimer();
|
2020-01-09 01:19:14 +03:00
|
|
|
// Allow future queueing of context loss timer.
|
|
|
|
void ClearTimer();
|
2014-08-22 20:55:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-06-16 20:01:44 +03:00
|
|
|
#endif // WEBGL_CONTEXT_LOSS_HANDLER_H_
|