gfx/skia/trunk/include/utils/win/SkIStream.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
michael@0 2 /*
michael@0 3 * Copyright 2011 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #ifndef SkIStream_DEFINED
michael@0 11 #define SkIStream_DEFINED
michael@0 12
michael@0 13 #define WIN32_LEAN_AND_MEAN
michael@0 14 #include <windows.h>
michael@0 15 #include <ole2.h>
michael@0 16
michael@0 17 class SkStream;
michael@0 18 class SkWStream;
michael@0 19
michael@0 20 /**
michael@0 21 * A bare IStream implementation which properly reference counts
michael@0 22 * but returns E_NOTIMPL for all ISequentialStream and IStream methods.
michael@0 23 */
michael@0 24 class SkBaseIStream : public IStream {
michael@0 25 private:
michael@0 26 LONG _refcount;
michael@0 27
michael@0 28 protected:
michael@0 29 explicit SkBaseIStream();
michael@0 30 virtual ~SkBaseIStream();
michael@0 31
michael@0 32 public:
michael@0 33 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid
michael@0 34 , void ** ppvObject);
michael@0 35 virtual ULONG STDMETHODCALLTYPE AddRef(void);
michael@0 36 virtual ULONG STDMETHODCALLTYPE Release(void);
michael@0 37
michael@0 38 // ISequentialStream Interface
michael@0 39 public:
michael@0 40 virtual HRESULT STDMETHODCALLTYPE Read(void* pv, ULONG cb, ULONG* pcbRead);
michael@0 41
michael@0 42 virtual HRESULT STDMETHODCALLTYPE Write(void const* pv
michael@0 43 , ULONG cb
michael@0 44 , ULONG* pcbWritten);
michael@0 45
michael@0 46 // IStream Interface
michael@0 47 public:
michael@0 48 virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER);
michael@0 49
michael@0 50 virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream*
michael@0 51 , ULARGE_INTEGER
michael@0 52 , ULARGE_INTEGER*
michael@0 53 , ULARGE_INTEGER*);
michael@0 54
michael@0 55 virtual HRESULT STDMETHODCALLTYPE Commit(DWORD);
michael@0 56
michael@0 57 virtual HRESULT STDMETHODCALLTYPE Revert(void);
michael@0 58
michael@0 59 virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER
michael@0 60 , ULARGE_INTEGER
michael@0 61 , DWORD);
michael@0 62
michael@0 63 virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER
michael@0 64 , ULARGE_INTEGER
michael@0 65 , DWORD);
michael@0 66
michael@0 67 virtual HRESULT STDMETHODCALLTYPE Clone(IStream **);
michael@0 68
michael@0 69 virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER liDistanceToMove
michael@0 70 , DWORD dwOrigin
michael@0 71 , ULARGE_INTEGER* lpNewFilePointer);
michael@0 72
michael@0 73 virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg
michael@0 74 , DWORD grfStatFlag);
michael@0 75 };
michael@0 76
michael@0 77 /**
michael@0 78 * A minimal read-only IStream implementation which wraps an SkIStream.
michael@0 79 */
michael@0 80 class SkIStream : public SkBaseIStream {
michael@0 81 private:
michael@0 82 SkStream *fSkStream;
michael@0 83 bool fUnrefOnRelease;
michael@0 84 ULARGE_INTEGER fLocation;
michael@0 85
michael@0 86 SkIStream(SkStream* stream, bool unrefOnRelease);
michael@0 87 virtual ~SkIStream();
michael@0 88
michael@0 89 public:
michael@0 90 HRESULT static CreateFromSkStream(SkStream* stream
michael@0 91 , bool unrefOnRelease
michael@0 92 , IStream ** ppStream);
michael@0 93
michael@0 94 virtual HRESULT STDMETHODCALLTYPE Read(void* pv, ULONG cb, ULONG* pcbRead);
michael@0 95
michael@0 96 virtual HRESULT STDMETHODCALLTYPE Write(void const* pv
michael@0 97 , ULONG cb
michael@0 98 , ULONG* pcbWritten);
michael@0 99
michael@0 100 virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER liDistanceToMove
michael@0 101 , DWORD dwOrigin
michael@0 102 , ULARGE_INTEGER* lpNewFilePointer);
michael@0 103
michael@0 104 virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg
michael@0 105 , DWORD grfStatFlag);
michael@0 106 };
michael@0 107
michael@0 108 /**
michael@0 109 * A minimal write-only IStream implementation which wraps an SkWIStream.
michael@0 110 */
michael@0 111 class SkWIStream : public SkBaseIStream {
michael@0 112 private:
michael@0 113 SkWStream *fSkWStream;
michael@0 114
michael@0 115 SkWIStream(SkWStream* stream);
michael@0 116 virtual ~SkWIStream();
michael@0 117
michael@0 118 public:
michael@0 119 HRESULT static CreateFromSkWStream(SkWStream* stream, IStream ** ppStream);
michael@0 120
michael@0 121 virtual HRESULT STDMETHODCALLTYPE Write(void const* pv
michael@0 122 , ULONG cb
michael@0 123 , ULONG* pcbWritten);
michael@0 124
michael@0 125 virtual HRESULT STDMETHODCALLTYPE Commit(DWORD);
michael@0 126
michael@0 127 virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg
michael@0 128 , DWORD grfStatFlag);
michael@0 129 };
michael@0 130
michael@0 131 #endif

mercurial