tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gfxPlatformWorker.h (1159B)


      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 GFX_PLATFORM_WORKER_H
      7 #define GFX_PLATFORM_WORKER_H
      8 
      9 #include "mozilla/ThreadLocal.h"
     10 #include "mozilla/RefPtr.h"
     11 
     12 namespace mozilla {
     13 namespace dom {
     14 class WeakWorkerRef;
     15 }  // namespace dom
     16 
     17 namespace gfx {
     18 class DrawTarget;
     19 }  // namespace gfx
     20 }  // namespace mozilla
     21 
     22 /**
     23 * Threadlocal instance of gfxPlatform data that may be used/shared on a DOM
     24 * worker thread.
     25 */
     26 class gfxPlatformWorker final {
     27 public:
     28  static gfxPlatformWorker* Get();
     29  static void Shutdown();
     30 
     31  RefPtr<mozilla::gfx::DrawTarget> ScreenReferenceDrawTarget();
     32 
     33 private:
     34  explicit gfxPlatformWorker(RefPtr<mozilla::dom::WeakWorkerRef>&& aWorkerRef);
     35  ~gfxPlatformWorker();
     36 
     37  static MOZ_THREAD_LOCAL(gfxPlatformWorker*) sInstance;
     38 
     39  RefPtr<mozilla::dom::WeakWorkerRef> mWorkerRef;
     40 
     41  RefPtr<mozilla::gfx::DrawTarget> mScreenReferenceDrawTarget;
     42 };
     43 
     44 #endif  // GFX_PLATFORM_WORKER_H