Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
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 #include "mozilla/RefPtr.h"
8 #ifdef USE_SKIA_GPU
10 #include "GLContext.h"
11 #include "skia/GrGLInterface.h"
12 #include "skia/GrContext.h"
14 namespace mozilla {
15 namespace gl {
17 class SkiaGLGlue : public GenericAtomicRefCounted
18 {
19 public:
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SkiaGLGlue)
21 SkiaGLGlue(GLContext* context);
22 GLContext* GetGLContext() const { return mGLContext.get(); }
23 GrContext* GetGrContext() const { return mGrContext.get(); }
25 protected:
26 virtual ~SkiaGLGlue() {
27 /*
28 * These members have inter-dependencies, but do not keep each other alive, so
29 * destruction order is very important here: mGrContext uses mGrGLInterface, and
30 * through it, uses mGLContext
31 */
32 mGrContext = nullptr;
33 mGrGLInterface = nullptr;
34 mGLContext = nullptr;
35 }
37 private:
38 RefPtr<GLContext> mGLContext;
39 SkRefPtr<GrGLInterface> mGrGLInterface;
40 SkRefPtr<GrContext> mGrContext;
41 };
43 }
44 }
46 #else
48 class GrContext;
50 namespace mozilla {
51 namespace gl {
53 class GLContext;
55 class SkiaGLGlue : public GenericAtomicRefCounted
56 {
57 public:
58 SkiaGLGlue(GLContext* context);
59 GLContext* GetGLContext() const { return nullptr; }
60 GrContext* GetGrContext() const { return nullptr; }
61 };
62 }
63 }
65 #endif