gfx/layers/d3d10/ReadbackManagerD3D10.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFX_READBACKMANAGERD3D10_H
michael@0 7 #define GFX_READBACKMANAGERD3D10_H
michael@0 8
michael@0 9 #include <windows.h>
michael@0 10 #include <d3d10_1.h>
michael@0 11
michael@0 12 #include "nsTArray.h"
michael@0 13 #include "nsAutoPtr.h"
michael@0 14 #include "gfxPoint.h"
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace layers {
michael@0 18
michael@0 19 DWORD WINAPI StartTaskThread(void *aManager);
michael@0 20
michael@0 21 struct ReadbackTask;
michael@0 22
michael@0 23 class ReadbackManagerD3D10 MOZ_FINAL : public IUnknown
michael@0 24 {
michael@0 25 public:
michael@0 26 ReadbackManagerD3D10();
michael@0 27 ~ReadbackManagerD3D10();
michael@0 28
michael@0 29 /**
michael@0 30 * Tell the readback manager to post a readback task.
michael@0 31 *
michael@0 32 * @param aTexture D3D10_USAGE_STAGING texture that will contain the data that
michael@0 33 * was readback.
michael@0 34 * @param aUpdate ReadbackProcessor::Update object. This is a void pointer
michael@0 35 * since we cannot forward declare a nested class, and do not
michael@0 36 * export ReadbackProcessor.h
michael@0 37 * @param aOrigin Origin of the aTexture surface in the ThebesLayer
michael@0 38 * coordinate system.
michael@0 39 */
michael@0 40 void PostTask(ID3D10Texture2D *aTexture, void *aUpdate, const gfxPoint &aOrigin);
michael@0 41
michael@0 42 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid,
michael@0 43 void **ppvObject);
michael@0 44 virtual ULONG STDMETHODCALLTYPE AddRef(void);
michael@0 45 virtual ULONG STDMETHODCALLTYPE Release(void);
michael@0 46
michael@0 47 private:
michael@0 48 friend DWORD WINAPI StartTaskThread(void *aManager);
michael@0 49
michael@0 50 void ProcessTasks();
michael@0 51
michael@0 52 // The invariant maintained by |mTaskSemaphore| is that the readback thread
michael@0 53 // will awaken from WaitForMultipleObjects() at least once per readback
michael@0 54 // task enqueued by the main thread. Since the readback thread processes
michael@0 55 // exactly one task per wakeup (with one exception), no tasks are lost. The
michael@0 56 // exception is when the readback thread is shut down, which orphans the
michael@0 57 // remaining tasks, on purpose.
michael@0 58 HANDLE mTaskSemaphore;
michael@0 59 // Event signaled when the task thread should shutdown
michael@0 60 HANDLE mShutdownEvent;
michael@0 61 // Handle to the task thread
michael@0 62 HANDLE mTaskThread;
michael@0 63
michael@0 64 // FiFo list of readback tasks that are to be executed. Access is synchronized
michael@0 65 // by mTaskMutex.
michael@0 66 CRITICAL_SECTION mTaskMutex;
michael@0 67 nsTArray<nsAutoPtr<ReadbackTask>> mPendingReadbackTasks;
michael@0 68
michael@0 69 ULONG mRefCnt;
michael@0 70 };
michael@0 71
michael@0 72 }
michael@0 73 }
michael@0 74
michael@0 75 #endif /* GFX_READBACKMANAGERD3D10_H */

mercurial