WebGLContextLossHandler.h (904B)
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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/. */ 5 6 #ifndef WEBGL_CONTEXT_LOSS_HANDLER_H_ 7 #define WEBGL_CONTEXT_LOSS_HANDLER_H_ 8 9 #include "mozilla/Atomics.h" 10 #include "mozilla/RefPtr.h" 11 #include "mozilla/WeakPtr.h" 12 #include "nsThreadUtils.h" 13 14 namespace mozilla { 15 class WebGLContext; 16 17 class WebGLContextLossHandler final : public SupportsWeakPtr { 18 RefPtr<Runnable> mRunnable; 19 Atomic<bool> mTimerIsScheduled; 20 21 public: 22 explicit WebGLContextLossHandler(WebGLContext* webgl); 23 ~WebGLContextLossHandler(); 24 25 void RunTimer(); 26 // Allow future queueing of context loss timer. 27 void ClearTimer(); 28 }; 29 30 } // namespace mozilla 31 32 #endif // WEBGL_CONTEXT_LOSS_HANDLER_H_