2014-08-22 20:55:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* 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_
|
|
|
|
|
|
|
|
#include "mozilla/WeakPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
class nsIThread;
|
|
|
|
class nsITimer;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class WebGLContext;
|
|
|
|
|
2016-06-16 20:01:44 +03:00
|
|
|
class WebGLContextLossHandler final : public SupportsWeakPtr<WebGLContextLossHandler>
|
2014-08-22 20:55:00 +04:00
|
|
|
{
|
2016-06-16 20:01:44 +03:00
|
|
|
WebGLContext* const mWebGL;
|
|
|
|
const nsCOMPtr<nsITimer> mTimer; // If we don't hold a ref to the timer, it will think
|
|
|
|
bool mTimerPending; // that it's been discarded, and be canceled 'for our
|
|
|
|
bool mShouldRunTimerAgain; // convenience'.
|
2016-02-26 18:52:06 +03:00
|
|
|
#ifdef DEBUG
|
2017-06-01 23:42:05 +03:00
|
|
|
nsISerialEventTarget* const mEventTarget;
|
2016-02-26 18:52:06 +03:00
|
|
|
#endif
|
2014-08-22 20:55:00 +04:00
|
|
|
|
2016-06-16 20:01:44 +03:00
|
|
|
friend class WatchdogTimerEvent;
|
|
|
|
|
2014-08-22 20:55:00 +04:00
|
|
|
public:
|
2016-06-16 20:01:44 +03:00
|
|
|
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(WebGLContextLossHandler)
|
2014-08-22 20:55:00 +04:00
|
|
|
|
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();
|
|
|
|
|
2016-06-16 20:01:44 +03:00
|
|
|
private:
|
2014-08-22 20:55:00 +04:00
|
|
|
void TimerCallback();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-06-16 20:01:44 +03:00
|
|
|
#endif // WEBGL_CONTEXT_LOSS_HANDLER_H_
|