dom/events/PaintRequest.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #include "mozilla/dom/PaintRequest.h"
michael@0 7
michael@0 8 #include "mozilla/dom/PaintRequestBinding.h"
michael@0 9 #include "mozilla/dom/PaintRequestListBinding.h"
michael@0 10 #include "mozilla/dom/DOMRect.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace dom {
michael@0 14
michael@0 15 /******************************************************************************
michael@0 16 * mozilla::dom::PaintRequest
michael@0 17 *****************************************************************************/
michael@0 18
michael@0 19 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(PaintRequest, mParent)
michael@0 20
michael@0 21 NS_INTERFACE_TABLE_HEAD(PaintRequest)
michael@0 22 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
michael@0 23 NS_INTERFACE_TABLE(PaintRequest, nsIDOMPaintRequest)
michael@0 24 NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(PaintRequest)
michael@0 25 NS_INTERFACE_MAP_END
michael@0 26
michael@0 27 NS_IMPL_CYCLE_COLLECTING_ADDREF(PaintRequest)
michael@0 28 NS_IMPL_CYCLE_COLLECTING_RELEASE(PaintRequest)
michael@0 29
michael@0 30 /* virtual */ JSObject*
michael@0 31 PaintRequest::WrapObject(JSContext* aCx)
michael@0 32 {
michael@0 33 return PaintRequestBinding::Wrap(aCx, this);
michael@0 34 }
michael@0 35
michael@0 36 already_AddRefed<DOMRect>
michael@0 37 PaintRequest::ClientRect()
michael@0 38 {
michael@0 39 nsRefPtr<DOMRect> clientRect = new DOMRect(this);
michael@0 40 clientRect->SetLayoutRect(mRequest.mRect);
michael@0 41 return clientRect.forget();
michael@0 42 }
michael@0 43
michael@0 44 NS_IMETHODIMP
michael@0 45 PaintRequest::GetClientRect(nsIDOMClientRect** aResult)
michael@0 46 {
michael@0 47 nsRefPtr<DOMRect> clientRect = ClientRect();
michael@0 48 clientRect.forget(aResult);
michael@0 49 return NS_OK;
michael@0 50 }
michael@0 51
michael@0 52 NS_IMETHODIMP
michael@0 53 PaintRequest::GetXPCOMReason(nsAString& aResult)
michael@0 54 {
michael@0 55 GetReason(aResult);
michael@0 56 return NS_OK;
michael@0 57 }
michael@0 58
michael@0 59 /******************************************************************************
michael@0 60 * mozilla::dom::PaintRequestList
michael@0 61 *****************************************************************************/
michael@0 62
michael@0 63 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(PaintRequestList, mParent)
michael@0 64
michael@0 65 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PaintRequestList)
michael@0 66 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
michael@0 67 NS_INTERFACE_MAP_ENTRY(nsISupports)
michael@0 68 NS_INTERFACE_MAP_END
michael@0 69
michael@0 70 NS_IMPL_CYCLE_COLLECTING_ADDREF(PaintRequestList)
michael@0 71 NS_IMPL_CYCLE_COLLECTING_RELEASE(PaintRequestList)
michael@0 72
michael@0 73 JSObject*
michael@0 74 PaintRequestList::WrapObject(JSContext* aCx)
michael@0 75 {
michael@0 76 return PaintRequestListBinding::Wrap(aCx, this);
michael@0 77 }
michael@0 78
michael@0 79 } // namespace dom
michael@0 80 } // namespace mozilla

mercurial