Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / dom / canvas / WebGLContextLossHandler.h
blobbb41007653a7a760a02f6807e2d19cc564298bb1
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WEBGL_CONTEXT_LOSS_HANDLER_H_
7 #define WEBGL_CONTEXT_LOSS_HANDLER_H_
9 #include "mozilla/DebugOnly.h"
10 #include "mozilla/RefPtr.h"
11 #include "mozilla/WeakPtr.h"
12 #include "nsCOMPtr.h"
14 class nsIThread;
15 class nsITimer;
17 namespace mozilla {
18 class WebGLContext;
20 class WebGLContextLossHandler
21 : public RefCounted<WebGLContextLossHandler>
23 WeakPtr<WebGLContext> mWeakWebGL;
24 nsCOMPtr<nsITimer> mTimer;
25 bool mIsTimerRunning;
26 bool mShouldRunTimerAgain;
27 bool mIsDisabled;
28 DebugOnly<nsIThread*> mThread;
30 public:
31 MOZ_DECLARE_REFCOUNTED_TYPENAME(WebGLContextLossHandler)
33 WebGLContextLossHandler(WebGLContext* webgl);
34 ~WebGLContextLossHandler();
36 void RunTimer();
37 void DisableTimer();
39 protected:
40 void StartTimer(unsigned long delayMS);
41 static void StaticTimerCallback(nsITimer*, void* tempRefForTimer);
42 void TimerCallback();
45 } // namespace mozilla
47 #endif