gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp

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.

     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/. */
     6 #include "MacIOSurfaceTextureClientOGL.h"
     7 #include "mozilla/gfx/MacIOSurface.h"
     9 namespace mozilla {
    10 namespace layers {
    12 MacIOSurfaceTextureClientOGL::MacIOSurfaceTextureClientOGL(TextureFlags aFlags)
    13   : TextureClient(aFlags)
    14   , mIsLocked(false)
    15 {}
    17 MacIOSurfaceTextureClientOGL::~MacIOSurfaceTextureClientOGL()
    18 {}
    20 void
    21 MacIOSurfaceTextureClientOGL::InitWith(MacIOSurface* aSurface)
    22 {
    23   MOZ_ASSERT(IsValid());
    24   MOZ_ASSERT(!IsAllocated());
    25   mSurface = aSurface;
    26 }
    28 bool
    29 MacIOSurfaceTextureClientOGL::Lock(OpenMode aMode)
    30 {
    31   MOZ_ASSERT(!mIsLocked);
    32   mIsLocked = true;
    33   return IsValid() && IsAllocated();
    34 }
    36 void
    37 MacIOSurfaceTextureClientOGL::Unlock()
    38 {
    39   MOZ_ASSERT(mIsLocked);
    40   mIsLocked = false;
    41 }
    43 bool
    44 MacIOSurfaceTextureClientOGL::IsLocked() const
    45 {
    46   return mIsLocked;
    47 }
    49 bool
    50 MacIOSurfaceTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
    51 {
    52   MOZ_ASSERT(IsValid());
    53   if (!IsAllocated()) {
    54     return false;
    55   }
    56   aOutDescriptor = SurfaceDescriptorMacIOSurface(mSurface->GetIOSurfaceID(),
    57                                                  mSurface->GetContentsScaleFactor(),
    58                                                  mSurface->HasAlpha());
    59   return true;
    60 }
    62 gfx::IntSize
    63 MacIOSurfaceTextureClientOGL::GetSize() const
    64 {
    65   return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
    66 }
    68 class MacIOSurfaceTextureClientData : public TextureClientData
    69 {
    70 public:
    71   MacIOSurfaceTextureClientData(MacIOSurface* aSurface)
    72     : mSurface(aSurface)
    73   {}
    75   virtual void DeallocateSharedData(ISurfaceAllocator*) MOZ_OVERRIDE
    76   {
    77     mSurface = nullptr;
    78   }
    80 private:
    81   RefPtr<MacIOSurface> mSurface;
    82 };
    84 TextureClientData*
    85 MacIOSurfaceTextureClientOGL::DropTextureData()
    86 {
    87   TextureClientData* data = new MacIOSurfaceTextureClientData(mSurface);
    88   mSurface = nullptr;
    89   MarkInvalid();
    90   return data;
    91 }
    93 }
    94 }

mercurial