Back out another line of unwanted changesets.

This commit is contained in:
Blake Kaplan 2010-06-30 18:39:07 -07:00
Родитель 564856e13b
Коммит 7d6f7b6390
63 изменённых файлов: 313 добавлений и 3466 удалений

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Josh Matthews <josh@joshmatthews.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef ChromeTypes_h__
#define ChromeTypes_h__
#ifndef MOZILLA_INTERNAL_API
#include "nsStringAPI.h"
#else
#include "nsString.h"
#endif
#include "nsCOMPtr.h"
#include "nsIURI.h"
struct ChromePackage {
nsCString package;
nsCOMPtr<nsIURI> baseURI;
PRUint32 flags;
};
struct ChromeResource {
nsCString package;
nsCOMPtr<nsIURI> resolvedURI;
};
#endif //ChromeTypes_h__

Просмотреть файл

@ -50,12 +50,6 @@ MODULE_NAME = nsChromeModule
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
EXPORTS_NAMESPACES = mozilla/chrome
EXPORTS_mozilla/chrome = \
ChromeTypes.h \
RegistryMessageUtils.h \
$(NULL)
CPPSRCS = \
nsChromeFactory.cpp \
@ -76,16 +70,8 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += $(TK_LIBS)
endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/ipc \
-I$(topsrcdir)/netwerk/protocol/res/src \
-I$(topsrcdir)/netwerk/base/src \
$(NULL)
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
endif

Просмотреть файл

@ -1,152 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Josh Matthews <josh@joshmatthews.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef RegistryMessageUtils_h__
#define RegistryMessageUtils_h__
#include "IPC/IPCMessageUtils.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#ifndef MOZILLA_INTERNAL_API
#include "nsStringAPI.h"
#else
#include "nsString.h"
#endif
namespace IPC {
inline void WriteURI(Message* aMsg, nsIURI* aURI)
{
nsCString spec;
if (aURI)
aURI->GetSpec(spec);
WriteParam(aMsg, spec);
}
inline bool ReadURI(const Message* aMsg, void** aIter, nsIURI* *aURI)
{
*aURI = nsnull;
nsCString spec;
if (!ReadParam(aMsg, aIter, &spec))
return false;
if (spec.Length()) {
nsresult rv = NS_NewURI(aURI, spec);
NS_ENSURE_SUCCESS(rv, false);
}
return true;
}
template <>
struct ParamTraits<ChromePackage>
{
typedef ChromePackage paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.package);
WriteURI(aMsg, aParam.baseURI);
WriteParam(aMsg, aParam.flags);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
nsCString package;
nsCOMPtr<nsIURI> uri;
PRUint32 flags;
if (ReadParam(aMsg, aIter, &package) &&
ReadURI(aMsg, aIter, getter_AddRefs(uri)) &&
ReadParam(aMsg, aIter, &flags)) {
aResult->package = package;
aResult->baseURI = uri;
aResult->flags = flags;
return true;
}
return false;
}
static void Log(const paramType& aParam, std::wstring* aLog)
{
nsCString spec;
aParam.baseURI->GetSpec(spec);
aLog->append(StringPrintf(L"[%s, %s, %u]", aParam.package.get(),
spec.get(), aParam.flags));
}
};
template <>
struct ParamTraits<ChromeResource>
{
typedef ChromeResource paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.package);
WriteURI(aMsg, aParam.resolvedURI);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
nsCString package;
nsCOMPtr<nsIURI> uri;
if (ReadParam(aMsg, aIter, &package) &&
ReadURI(aMsg, aIter, getter_AddRefs(uri))) {
aResult->package = package;
aResult->resolvedURI = uri;
return true;
}
return false;
}
static void Log(const paramType& aParam, std::wstring* aLog)
{
nsCString spec;
aParam.resolvedURI->GetSpec(spec);
aLog->append(StringPrintf(L"[%s, %s, %u]", aParam.package.get(),
spec.get()));
}
};
}
#endif // RegistryMessageUtils_h__

Просмотреть файл

@ -39,12 +39,6 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_IPC
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/ContentProcessParent.h"
#include "RegistryMessageUtils.h"
#endif
#include "nsChromeRegistry.h"
#include <string.h>
@ -107,7 +101,6 @@
#include "nsIPresShell.h"
#include "nsIProtocolHandler.h"
#include "nsIResProtocolHandler.h"
#include "nsResProtocolHandler.h"
#include "nsIScriptError.h"
#include "nsIServiceManager.h"
#include "nsISimpleEnumerator.h"
@ -460,20 +453,6 @@ getUILangCountry(nsACString& aUILang)
return NS_OK;
}
nsChromeRegistry*
nsChromeRegistry::GetService()
{
if (!nsChromeRegistry::gChromeRegistry)
{
// We don't actually want this ref, we just want the service to
// initialize if it hasn't already.
nsCOMPtr<nsIChromeRegistry> reg(
do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
NS_ENSURE_TRUE(nsChromeRegistry::gChromeRegistry, NULL);
}
return gChromeRegistry;
}
nsresult
nsChromeRegistry::Init()
{
@ -1166,202 +1145,6 @@ RemoveAll(PLDHashTable *table, PLDHashEntryHdr *entry, PRUint32 number, void *ar
return (PLDHashOperator) (PL_DHASH_NEXT | PL_DHASH_REMOVE);
}
PLDHashOperator
nsChromeRegistry::SendAllToChildProcess(PLDHashTable *table, PLDHashEntryHdr *entry, PRUint32 number, void *arg)
{
mozilla::dom::TabParent* tabParent = static_cast<mozilla::dom::TabParent*>(arg);
nsChromeRegistry::PackageEntry* package = static_cast<PackageEntry*>(entry);
nsString packageName(NS_ConvertUTF8toUTF16(package->package).get());
nsString baseURI;
nsCAutoString prePath, path;
if(package->baseURI)
{
package->baseURI->GetPrePath(prePath);
package->baseURI->GetPath(path);
}
CopyUTF8toUTF16(prePath, baseURI);
AppendUTF8toUTF16(path, baseURI);
if(!tabParent->SendregisterChromePackage(packageName, baseURI, package->flags))
{
//XXXjdm error
}
return (PLDHashOperator)PL_DHASH_NEXT;
}
PLDHashOperator
nsChromeRegistry::SendResourceToChildProcess(const nsACString& aKey, nsIURI* aURI, void* aArg)
{
mozilla::dom::TabParent* tabParent = static_cast<mozilla::dom::TabParent*>(aArg);
nsString resolved, packageName(NS_ConvertUTF8toUTF16(aKey).get());
nsCAutoString prePath, path;
aURI->GetPrePath(prePath);
aURI->GetPath(path);
CopyUTF8toUTF16(prePath, resolved);
AppendUTF8toUTF16(path, resolved);
if(!tabParent->SendregisterChromeResource(packageName, resolved))
{
//XXXjdm error
}
return (PLDHashOperator)PL_DHASH_NEXT;
}
void
nsChromeRegistry::SendRegisteredPackages(mozilla::dom::TabParent* aParent)
{
PL_DHashTableEnumerate(&mPackagesHash, SendAllToChildProcess, aParent);
nsCOMPtr<nsIIOService> io (do_GetIOService());
//if (!io) return NS_ERROR_FAILURE;
nsCOMPtr<nsIProtocolHandler> ph;
nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
// NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIResProtocolHandler> irph (do_QueryInterface(ph));
nsResProtocolHandler* rph = static_cast<nsResProtocolHandler*>(irph.get());
rph->EnumerateSubstitutions(SendResourceToChildProcess, aParent);
}
void
nsChromeRegistry::RegisterPackage(const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags)
{
const char *package = NS_ConvertUTF16toUTF8(aPackage).get();
PackageEntry* entry =
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
PL_DHASH_ADD));
entry->flags = aFlags;
NS_NewURI(getter_AddRefs(entry->baseURI), NS_ConvertUTF16toUTF8(aBaseURI));
}
void
nsChromeRegistry::RegisterResource(const nsString& aPackage,
const nsString& aResolvedURI)
{
nsCOMPtr<nsIIOService> io (do_GetIOService());
//if (!io) return NS_ERROR_FAILURE;
nsCOMPtr<nsIProtocolHandler> ph;
nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
// NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIResProtocolHandler> rph (do_QueryInterface(ph));
//if (!rph) return NS_ERROR_FAILURE;
nsCOMPtr<nsIURI> resolved;
NS_NewURI(getter_AddRefs(resolved), NS_ConvertUTF16toUTF8(aResolvedURI));
rv = rph->SetSubstitution(NS_ConvertUTF16toUTF8(aPackage), resolved);
}
#ifdef MOZ_IPC
PLDHashOperator
nsChromeRegistry::CollectPackages(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 number,
void *arg)
{
nsTArray<ChromePackage>* packages =
static_cast<nsTArray<ChromePackage>*>(arg);
nsChromeRegistry::PackageEntry* package = static_cast<PackageEntry*>(entry);
ChromePackage chromePackage = {
package->package,
package->baseURI,
package->flags
};
packages->AppendElement(chromePackage);
return (PLDHashOperator)PL_DHASH_NEXT;
}
PLDHashOperator
nsChromeRegistry::CollectResources(const nsACString& aKey,
nsIURI* aURI,
void* aArg)
{
nsTArray<ChromeResource>* resources =
static_cast<nsTArray<ChromeResource>*>(aArg);
ChromeResource resource = {
nsDependentCString(aKey), aURI
};
resources->AppendElement(resource);
return (PLDHashOperator)PL_DHASH_NEXT;
}
void
nsChromeRegistry::SendRegisteredChrome(
mozilla::dom::ContentProcessParent* aParent)
{
nsTArray<ChromePackage> packages;
nsTArray<ChromeResource> resources;
PL_DHashTableEnumerate(&mPackagesHash, CollectPackages, &packages);
nsCOMPtr<nsIIOService> io (do_GetIOService());
NS_ENSURE_TRUE(io, );
nsCOMPtr<nsIProtocolHandler> ph;
nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
NS_ENSURE_SUCCESS(rv, );
nsCOMPtr<nsIResProtocolHandler> irph (do_QueryInterface(ph));
nsResProtocolHandler* rph = static_cast<nsResProtocolHandler*>(irph.get());
rph->EnumerateSubstitutions(CollectResources, &resources);
bool success = aParent->SendregisterChrome(packages, resources);
NS_ENSURE_TRUE(success, );
}
void
nsChromeRegistry::RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
const nsTArray<ChromeResource>& aResources)
{
for (PRUint32 i = aPackages.Length(); i > 0; ) {
--i;
RegisterPackage(aPackages[i]);
}
for (PRUint32 i = aResources.Length(); i > 0; ) {
--i;
RegisterResource(aResources[i]);
}
}
void
nsChromeRegistry::RegisterPackage(const ChromePackage& aPackage)
{
PackageEntry* entry =
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
&aPackage.package,
PL_DHASH_ADD));
NS_ENSURE_TRUE(entry, );
entry->flags = aPackage.flags;
entry->baseURI = aPackage.baseURI;
}
void
nsChromeRegistry::RegisterResource(const ChromeResource& aResource)
{
nsCOMPtr<nsIIOService> io (do_GetIOService());
NS_ENSURE_TRUE(io, );
nsCOMPtr<nsIProtocolHandler> ph;
nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
NS_ENSURE_SUCCESS(rv, );
nsCOMPtr<nsIResProtocolHandler> rph (do_QueryInterface(ph));
NS_ENSURE_TRUE(rph, );
rv = rph->SetSubstitution(aResource.package, aResource.resolvedURI);
NS_ENSURE_SUCCESS(rv, );
}
#endif // MOZ_IPC
NS_IMETHODIMP
nsChromeRegistry::CheckForNewChrome()
{

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsVoidArray.h"
#include "nsTArray.h"
#include "nsInterfaceHashtable.h"
#include "ChromeTypes.h"
struct PRFileDesc;
class nsIAtom;
@ -68,13 +67,6 @@ class nsIRDFService;
class nsISimpleEnumerator;
class nsIURL;
namespace mozilla {
namespace dom {
class TabParent;
class ContentProcessParent;
}
}
// for component registration
// {47049e42-1d87-482a-984d-56ae185e367a}
#define NS_CHROMEREGISTRY_CID \
@ -109,28 +101,10 @@ public:
nsresult Init();
static nsChromeRegistry* GetService();
static nsChromeRegistry* gChromeRegistry;
static nsresult Canonify(nsIURL* aChromeURL);
void SendRegisteredChrome(mozilla::dom::ContentProcessParent* aChild);
void RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
const nsTArray<ChromeResource>& aResources);
void SendRegisteredPackages(mozilla::dom::TabParent* aChild);
void RegisterPackage(const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags);
void RegisterResource(const nsString& aPackage,
const nsString& aResolvedURI);
static PLDHashOperator SendAllToChildProcess(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 number, void *arg);
static PLDHashOperator SendResourceToChildProcess(const nsACString& aKey,
nsIURI* aURI, void* aArg);
protected:
nsresult GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
@ -141,17 +115,6 @@ protected:
void FlushAllCaches();
private:
#ifdef MOZ_IPC
void RegisterPackage(const ChromePackage& aPackage);
void RegisterResource(const ChromeResource& aResource);
static PLDHashOperator CollectPackages(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 number, void *arg);
static PLDHashOperator CollectResources(const nsACString& aKey,
nsIURI* aURI, void* aArg);
#endif
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
static nsresult RefreshWindow(nsIDOMWindowInternal* aWindow);

Просмотреть файл

@ -5085,17 +5085,16 @@ then
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore)
AC_CHECK_PROGS(HOST_MOC, moc, "")
else
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml"
MOZ_QT_LIBS="-L$QTDIR/qt/lib/ -lQtGui -lQtNetwork -lQtCore"
MOZ_QT_CFLAGS="-DQT_SHARED"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
HOST_MOC="$QTDIR/bin/moc"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/Qt"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtGui"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtCore"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/qt/include/QtNetwork"
HOST_MOC="$QTDIR/qt/bin/moc"
fi
if test -z "$HOST_MOC"; then
AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is

Просмотреть файл

@ -119,8 +119,6 @@
#include "ContentProcessParent.h"
#include "TabParent.h"
#include "nsXULAppAPI.h"
using namespace mozilla;
using namespace mozilla::dom;
#endif
@ -1508,10 +1506,7 @@ nsFrameLoader::TryNewProcess()
return false;
}
ContentProcessParent* parent = ContentProcessParent::GetSingleton();
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
mChildProcess = parent->CreateTab();
mChildProcess = ContentProcessParent::GetSingleton()->CreateTab();
if (mChildProcess) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
mChildProcess->SetOwnerElement(element);
@ -1525,10 +1520,6 @@ nsFrameLoader::TryNewProcess()
nsCOMPtr<nsIBrowserDOMWindow> browserDOMWin;
rootChromeWin->GetBrowserDOMWindow(getter_AddRefs(browserDOMWin));
mChildProcess->SetBrowserDOMWindow(browserDOMWin);
mChildHost = parent;
XRE_SendParentChromeRegistry(mChildProcess);
}
return true;
}

Просмотреть файл

@ -189,7 +189,6 @@ private:
PRPackedBool mRemoteWidgetCreated : 1;
bool mRemoteFrame;
// XXX leaking
nsCOMPtr<nsIObserver> mChildHost;
mozilla::dom::TabParent* mChildProcess;
#ifdef MOZ_WIDGET_GTK2

Просмотреть файл

@ -1,70 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_DocumentRendererShmemChild
#define mozilla_dom_DocumentRendererShmemChild
#include "mozilla/ipc/PDocumentRendererShmemChild.h"
class nsIDOMWindow;
class gfxMatrix;
namespace mozilla {
namespace ipc {
class DocumentRendererShmemChild : public PDocumentRendererShmemChild
{
public:
DocumentRendererShmemChild();
virtual ~DocumentRendererShmemChild();
bool RenderDocument(nsIDOMWindow *window, const PRInt32& x,
const PRInt32& y, const PRInt32& w,
const PRInt32& h, const nsString& aBGColor,
const PRUint32& flags, const PRBool& flush,
const gfxMatrix &aMatrix,
const PRInt32& bufw, const PRInt32& bufh,
Shmem& data);
private:
DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererShmemChild);
};
}
}
#endif

Просмотреть файл

@ -1,67 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_DocumentRendererShmemParent
#define mozilla_dom_DocumentRendererShmemParent
#include "mozilla/ipc/PDocumentRendererShmemParent.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsCOMPtr.h"
namespace mozilla {
namespace ipc {
class DocumentRendererShmemParent : public PDocumentRendererShmemParent
{
public:
DocumentRendererShmemParent();
virtual ~DocumentRendererShmemParent();
void SetCanvas(nsICanvasRenderingContextInternal* aCanvas);
virtual bool Recv__delete__(const PRInt32& x, const PRInt32& y,
const PRInt32& w, const PRInt32& h,
Shmem& data);
private:
nsCOMPtr<nsICanvasRenderingContextInternal> mCanvas;
DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererShmemParent);
};
}
}
#endif

Просмотреть файл

@ -56,8 +56,6 @@ EXPORTS = \
EXPORTS_mozilla/ipc = \
DocumentRendererChild.h \
DocumentRendererParent.h \
DocumentRendererShmemChild.h \
DocumentRendererShmemParent.h \
$(NULL)
XPIDLSRCS = \

Просмотреть файл

@ -44,19 +44,13 @@
#include "nsIDocShell.h"
#include "gfxPattern.h"
// {3c4632ab-8443-4082-a8a310e7cfba4c74}
// {ed741c16-4039-469b-91da-dca742c51a9f}
#define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \
{ 0x3c4632ab, 0x8443, 0x4082, { 0xa8, 0xa3, 0x10, 0xe7, 0xcf, 0xba, 0x4c, 0x74 } }
{ 0xed741c16, 0x4039, 0x469b, { 0x91, 0xda, 0xdc, 0xa7, 0x42, 0xc5, 0x1a, 0x9f } }
class gfxContext;
class gfxASurface;
namespace mozilla {
namespace ipc {
class Shmem;
}
}
class nsICanvasRenderingContextInternal : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASRENDERINGCONTEXTINTERNAL_IID)
@ -96,17 +90,6 @@ public:
// Redraw the dirty rectangle of this canvas.
NS_IMETHOD Redraw(const gfxRect &dirty) = 0;
// If this context can be set to use Mozilla's Shmem segments as its backing
// store, this will set it to that state. Note that if you have drawn
// anything into this canvas before changing the shmem state, it will be
// lost.
NS_IMETHOD SetIsShmem(PRBool isShmem) = 0;
// Swap this back buffer with the front, and copy its contents to the new
// back. x, y, w, and h specify the area of |back| that is dirty.
NS_IMETHOD Swap(mozilla::ipc::Shmem &back,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasRenderingContextInternal,

Просмотреть файл

@ -1,146 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "base/basictypes.h"
#include "gfxImageSurface.h"
#include "gfxPattern.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsCSSParser.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsColor.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "nsLayoutUtils.h"
#include "mozilla/ipc/DocumentRendererShmemChild.h"
using namespace mozilla::ipc;
DocumentRendererShmemChild::DocumentRendererShmemChild()
{}
DocumentRendererShmemChild::~DocumentRendererShmemChild()
{}
static void
FlushLayoutForTree(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
if (!piWin)
return;
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
nsCOMPtr<nsIDOMDocument> domDoc;
aWindow->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIDocShellTreeNode> node =
do_QueryInterface(piWin->GetDocShell());
if (node) {
PRInt32 i = 0, i_end;
node->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
node->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
if (win) {
FlushLayoutForTree(win);
}
}
}
}
bool
DocumentRendererShmemChild::RenderDocument(nsIDOMWindow *window, const PRInt32& x,
const PRInt32& y, const PRInt32& w,
const PRInt32& h, const nsString& aBGColor,
const PRUint32& flags, const PRBool& flush,
const gfxMatrix &aMatrix,
const PRInt32& bufw, const PRInt32& bufh,
Shmem& data)
{
if (flush)
FlushLayoutForTree(window);
nsCOMPtr<nsPresContext> presContext;
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
if (win) {
nsIDocShell* docshell = win->GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
}
}
if (!presContext)
return false;
nscolor bgColor;
nsCSSParser parser;
nsresult rv = parser.ParseColorString(PromiseFlatString(aBGColor),
nsnull, 0, &bgColor);
if (NS_FAILED(rv))
return false;
nsIPresShell* presShell = presContext->PresShell();
nsRect r(x, y, w, h);
// Draw directly into the output array.
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(data.get<PRUint8>(),
gfxIntSize(bufw, bufh),
4 * bufw,
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
ctx->SetMatrix(aMatrix);
presShell->RenderDocument(r, flags, bgColor, ctx);
return true;
}

Просмотреть файл

@ -1,60 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Fennec Electrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ipc/DocumentRendererShmemParent.h"
using namespace mozilla::ipc;
DocumentRendererShmemParent::DocumentRendererShmemParent()
{}
DocumentRendererShmemParent::~DocumentRendererShmemParent()
{}
void
DocumentRendererShmemParent::SetCanvas(nsICanvasRenderingContextInternal* aCanvas)
{
mCanvas = aCanvas;
}
bool
DocumentRendererShmemParent::Recv__delete__(const PRInt32& x, const PRInt32& y,
const PRInt32& w, const PRInt32& h,
Shmem& data)
{
mCanvas->Swap(data, x, y, w, h);
return true;
}

Просмотреть файл

@ -60,8 +60,6 @@ ifdef MOZ_IPC
CPPSRCS += \
DocumentRendererParent.cpp \
DocumentRendererChild.cpp \
DocumentRendererShmemParent.cpp \
DocumentRendererShmemChild.cpp \
$(NULL)
endif

Просмотреть файл

@ -359,6 +359,7 @@ WebGLContext::GetThebesSurface(gfxASurface **surface)
return NS_OK;
}
//
// XPCOM goop
//

Просмотреть файл

@ -243,11 +243,7 @@ public:
nsIInputStream **aStream);
NS_IMETHOD GetThebesSurface(gfxASurface **surface);
NS_IMETHOD SetIsOpaque(PRBool b) { return NS_OK; };
NS_IMETHOD SetIsShmem(PRBool b) { return NS_OK; }
NS_IMETHOD Redraw(const gfxRect&) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD Swap(mozilla::ipc::Shmem &aBack,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{ return NS_ERROR_NOT_IMPLEMENTED; }
protected:
GLES20Wrap *gl;

Просмотреть файл

@ -116,12 +116,9 @@
#include "CanvasUtils.h"
#ifdef MOZ_IPC
# include "mozilla/dom/ContentProcessParent.h"
# include "mozilla/ipc/PDocumentRendererParent.h"
# include "mozilla/ipc/PDocumentRendererShmemParent.h"
# include "mozilla/dom/PIFrameEmbeddingParent.h"
# include "mozilla/ipc/DocumentRendererParent.h"
# include "mozilla/ipc/DocumentRendererShmemParent.h"
// windows.h (included by chromium code) defines this, in its infinite wisdom
# undef DrawText
#endif
@ -174,28 +171,6 @@ static PRBool FloatValidate (double f1, double f2, double f3, double f4, double
#undef VALIDATE
static void
CopyContext(gfxContext* dest, gfxContext* src)
{
dest->Multiply(src->CurrentMatrix());
nsRefPtr<gfxPath> path = src->CopyPath();
dest->NewPath();
dest->AppendPath(path);
nsRefPtr<gfxPattern> pattern = src->GetPattern();
dest->SetPattern(pattern);
dest->SetLineWidth(src->CurrentLineWidth());
dest->SetLineCap(src->CurrentLineCap());
dest->SetLineJoin(src->CurrentLineJoin());
dest->SetMiterLimit(src->CurrentMiterLimit());
dest->SetFillRule(src->CurrentFillRule());
dest->SetAntialiasMode(src->CurrentAntialiasMode());
}
/**
** nsCanvasGradient
**/
@ -364,13 +339,8 @@ public:
nsIInputStream **aStream);
NS_IMETHOD GetThebesSurface(gfxASurface **surface);
NS_IMETHOD SetIsOpaque(PRBool isOpaque);
NS_IMETHOD SetIsShmem(PRBool isShmem);
// this rect is in CSS pixels
NS_IMETHOD Redraw(const gfxRect &r);
// Swap this back buffer with the front, and copy its contents to the new back.
// x, y, w, and h specify the area of |back| that is dirty.
NS_IMETHOD Swap(mozilla::ipc::Shmem &back, PRInt32 x, PRInt32 y,
PRInt32 w, PRInt32 h);
// nsISupports interface
NS_DECL_ISUPPORTS
@ -435,22 +405,6 @@ protected:
PRPackedBool mValid;
PRPackedBool mOpaque;
#ifdef MOZ_IPC
PRPackedBool mShmem;
// We always have a front buffer. We hand the back buffer to the other
// process to render to, and then swap our two buffers when it finishes.
mozilla::ipc::Shmem mFrontBuffer;
mozilla::ipc::Shmem mBackBuffer;
nsRefPtr<gfxASurface> mFrontSurface;
nsRefPtr<gfxASurface> mBackSurface;
// Creates a new mFrontBuffer and mBackBuffer of the correct size.
// Returns false if this wasn't possible, for whatever reason.
bool CreateShmemSegments(PRInt32 width, PRInt32 height,
gfxASurface::gfxImageFormat format);
#endif
// the canvas element informs us when it's going away,
// so these are not nsCOMPtrs
nsICanvasElement* mCanvasElement;
@ -743,7 +697,7 @@ NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult)
}
nsCanvasRenderingContext2D::nsCanvasRenderingContext2D()
: mValid(PR_FALSE), mOpaque(PR_FALSE), mShmem(PR_FALSE), mCanvasElement(nsnull),
: mValid(PR_FALSE), mOpaque(PR_FALSE), mCanvasElement(nsnull),
mSaveCount(0), mIsEntireFrameInvalid(PR_FALSE), mInvalidateCount(0),
mLastStyle(STYLE_MAX), mStyleStack(20)
{
@ -951,29 +905,6 @@ nsCanvasRenderingContext2D::Redraw(const gfxRect& r)
return mCanvasElement->InvalidateFrameSubrect(r);
}
#ifdef MOZ_IPC
bool
nsCanvasRenderingContext2D::CreateShmemSegments(PRInt32 width, PRInt32 height,
gfxASurface::gfxImageFormat format)
{
if (!mozilla::dom::ContentProcessParent::GetSingleton()->
AllocShmem(width * height * 4, &mFrontBuffer))
return false;
if (!mozilla::dom::ContentProcessParent::GetSingleton()->
AllocShmem(width * height * 4, &mBackBuffer))
return false;
mBackSurface = new gfxImageSurface(mBackBuffer.get<unsigned char>(),
gfxIntSize(width, height),
width * 4, format);
mFrontSurface = new gfxImageSurface(mFrontBuffer.get<unsigned char>(),
gfxIntSize(width, height),
width * 4, format);
return true;
}
#endif
NS_IMETHODIMP
nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
{
@ -987,18 +918,13 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
if (mOpaque)
format = gfxASurface::ImageFormatRGB24;
#ifdef MOZ_IPC
if (mShmem)
CreateShmemSegments(width, height, format);
#endif
surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface
(gfxIntSize(width, height), format);
if (surface && surface->CairoStatus() != 0)
if (surface->CairoStatus() != 0) {
surface = NULL;
}
}
return InitializeWithSurface(NULL, surface, width, height);
}
@ -1075,79 +1001,6 @@ nsCanvasRenderingContext2D::SetIsOpaque(PRBool isOpaque)
return NS_OK;
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::SetIsShmem(PRBool isShmem)
{
if (isShmem == mShmem)
return NS_OK;
mShmem = isShmem;
if (mValid) {
/* If we've already been created, let SetDimensions take care of
* recreating our surface
*/
return SetDimensions(mWidth, mHeight);
}
return NS_OK;
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::Swap(mozilla::ipc::Shmem &aBack,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
#ifndef MOZ_IPC
return NS_ERROR_NOT_IMPLEMENTED;
#else
// Our front buffer is always the correct size. If this back buffer doesn't
// match the front buffer's size, it's out of date (we've resized since
// this message was sent) and we should just ignore it.
if (mFrontBuffer.Size<unsigned char>() != aBack.Size<unsigned char>())
return NS_OK;
// Swap back and front.
// mBackBuffer should be null here, since we've previously sent it to the
// child process.
mBackBuffer = mFrontBuffer;
mFrontBuffer = aBack;
// do want mozilla::Swap
nsRefPtr<gfxASurface> tmp = mFrontSurface;
mFrontSurface = mBackSurface;
mBackSurface = tmp;
nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
mThebes->NewPath();
mThebes->PixelSnappedRectangleAndSetPattern(gfxRect(x, y, w, h), pat);
mThebes->Fill();
// get rid of the pattern surface ref
mThebes->SetColor(gfxRGBA(1,1,1,1));
Redraw(gfxRect(x, y, w, h));
// Copy the new contents to the old to keep them in sync.
memcpy(mBackBuffer.get<unsigned char>(), mFrontBuffer.get<unsigned char>(),
mWidth * mHeight * 4);
// Notify listeners that we've finished drawing
nsCOMPtr<nsIContent> content = do_QueryInterface(mCanvasElement);
nsIDocument* ownerDoc = nsnull;
if (content)
ownerDoc = content->GetOwnerDoc();
if (ownerDoc && mCanvasElement) {
nsContentUtils::DispatchTrustedEvent(ownerDoc, mCanvasElement,
NS_LITERAL_STRING("MozAsyncCanvasRender"),
/* aCanBubble = */ PR_TRUE, /* aCancelable = */ PR_TRUE);
}
return NS_OK;
#endif
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter)
{
@ -1683,6 +1536,27 @@ nsCanvasRenderingContext2D::GetShadowColor(nsAString& color)
return NS_OK;
}
static void
CopyContext(gfxContext* dest, gfxContext* src)
{
dest->Multiply(src->CurrentMatrix());
nsRefPtr<gfxPath> path = src->CopyPath();
dest->NewPath();
dest->AppendPath(path);
nsRefPtr<gfxPattern> pattern = src->GetPattern();
dest->SetPattern(pattern);
dest->SetLineWidth(src->CurrentLineWidth());
dest->SetLineCap(src->CurrentLineCap());
dest->SetLineJoin(src->CurrentLineJoin());
dest->SetMiterLimit(src->CurrentMiterLimit());
dest->SetFillRule(src->CurrentFillRule());
dest->SetAntialiasMode(src->CurrentAntialiasMode());
}
static const gfxFloat SIGMA_MAX = 25;
gfxContext*
@ -3587,37 +3461,11 @@ nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float a
w = nsPresContext::CSSPixelsToAppUnits(aW),
h = nsPresContext::CSSPixelsToAppUnits(aH);
if (mShmem) {
if (!mBackBuffer.IsWritable())
return NS_ERROR_FAILURE;
mozilla::ipc::PDocumentRendererShmemParent *pdocrender =
child->SendPDocumentRendererShmemConstructor(x, y, w, h,
nsString(aBGColor),
renderDocFlags, flush,
mThebes->CurrentMatrix(),
mWidth, mHeight,
mBackBuffer);
if (!pdocrender)
return NS_ERROR_FAILURE;
mozilla::ipc::DocumentRendererShmemParent *docrender =
static_cast<mozilla::ipc::DocumentRendererShmemParent *>(pdocrender);
docrender->SetCanvas(this);
} else {
mozilla::ipc::PDocumentRendererParent *pdocrender =
child->SendPDocumentRendererConstructor(x, y, w, h,
nsString(aBGColor),
renderDocFlags, flush);
if (!pdocrender)
return NS_ERROR_FAILURE;
mozilla::ipc::DocumentRendererParent *docrender =
static_cast<mozilla::ipc::DocumentRendererParent *>(pdocrender);
child->SendPDocumentRendererConstructor(x, y, w, h, nsString(aBGColor), renderDocFlags, flush);
mozilla::ipc::DocumentRendererParent *docrender = static_cast<mozilla::ipc::DocumentRendererParent *>(pdocrender);
docrender->SetCanvasContext(this, mThebes);
}
return NS_OK;
#else

Просмотреть файл

@ -126,8 +126,6 @@ protected:
nsresult ToDataURLImpl(const nsAString& aMimeType,
const nsAString& aEncoderOptions,
nsAString& aDataURL);
nsresult GetContextHelper(const nsAString &aContextId,
nsICanvasRenderingContextInternal **aContext);
nsString mCurrentContextId;
nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;
@ -414,12 +412,13 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
return NS_OK;
}
nsresult
nsHTMLCanvasElement::GetContextHelper(const nsAString &aContextId,
nsICanvasRenderingContextInternal **aContext)
NS_IMETHODIMP
nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
nsISupports **aContext)
{
NS_ENSURE_ARG(aContext);
nsresult rv;
if (mCurrentContextId.IsEmpty()) {
nsCString ctxId;
ctxId.Assign(NS_LossyConvertUTF16toASCII(aContextId));
@ -439,79 +438,19 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString &aContextId,
nsCString ctxString("@mozilla.org/content/canvas-rendering-context;1?id=");
ctxString.Append(ctxId);
nsresult rv;
nsCOMPtr<nsICanvasRenderingContextInternal> ctx =
do_CreateInstance(nsPromiseFlatCString(ctxString).get(), &rv);
if (rv == NS_ERROR_OUT_OF_MEMORY) {
*aContext = nsnull;
mCurrentContext = do_CreateInstance(nsPromiseFlatCString(ctxString).get(), &rv);
if (rv == NS_ERROR_OUT_OF_MEMORY)
return NS_ERROR_OUT_OF_MEMORY;
}
if (NS_FAILED(rv)) {
*aContext = nsnull;
if (NS_FAILED(rv))
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_ERROR_INVALID_ARG;
}
rv = ctx->SetCanvasElement(this);
if (NS_FAILED(rv)) {
*aContext = nsnull;
return rv;
}
*aContext = ctx.forget().get();
return rv;
}
NS_IMETHODIMP
nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
nsISupports **aContext)
{
nsresult rv;
if (mCurrentContextId.IsEmpty()) {
rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
if (NS_FAILED(rv))
return rv;
rv = UpdateContext();
rv = mCurrentContext->SetCanvasElement(this);
if (NS_FAILED(rv)) {
mCurrentContext = nsnull;
return rv;
}
mCurrentContextId.Assign(aContextId);
} else if (!mCurrentContextId.Equals(aContextId)) {
//XXX eventually allow for more than one active context on a given canvas
return NS_ERROR_INVALID_ARG;
}
NS_ADDREF (*aContext = mCurrentContext);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLCanvasElement::MozGetShmemContext(const nsAString& aContextId,
nsISupports **aContext)
{
if(!nsContentUtils::IsCallerTrustedForRead()) {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_ERROR_DOM_SECURITY_ERR;
}
// We only support 2d shmem contexts for now.
if (!aContextId.Equals(NS_LITERAL_STRING("2d")))
return NS_ERROR_INVALID_ARG;
nsresult rv;
if (mCurrentContextId.IsEmpty()) {
rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
if (NS_FAILED(rv))
return rv;
mCurrentContext->SetIsShmem(PR_TRUE);
rv = UpdateContext();
if (NS_FAILED(rv)) {
mCurrentContext = nsnull;

Просмотреть файл

@ -47,7 +47,7 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(5ef1c2ee-4b3a-4015-8e38-c27ddb306c39)]
[scriptable, uuid(b5f8239b-2abf-4896-b772-71e1e374a661)]
interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
{
attribute long width;
@ -70,9 +70,5 @@ interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
// the options string that it supports. Separate multiple options with
// semicolons.
[noscript] DOMString toDataURLAs(in DOMString mimeType, in DOMString encoderOptions);
// A Mozilla-only extension to get a canvas context backed by double-buffered
// shared memory. Only privileged callers can call this.
nsISupports MozGetShmemContext(in DOMString contextId);
};

Просмотреть файл

@ -41,20 +41,14 @@
#include "mozilla/ipc/TestShellChild.h"
#include "mozilla/net/NeckoChild.h"
#include "History.h"
#include "nsXULAppAPI.h"
#include "nsDocShellCID.h"
#include "nsNetUtil.h"
#include "base/message_loop.h"
#include "base/task.h"
#include "nsChromeRegistry.h"
using namespace mozilla::ipc;
using namespace mozilla::net;
using namespace mozilla::places;
namespace mozilla {
namespace dom {
@ -134,15 +128,6 @@ ContentProcessChild::DeallocPNecko(PNeckoChild* necko)
return true;
}
bool
ContentProcessChild::RecvregisterChrome(const nsTArray<ChromePackage>& packages,
const nsTArray<ChromeResource>& resources)
{
nsChromeRegistry* chromeRegistry = nsChromeRegistry::GetService();
chromeRegistry->RegisterRemoteChrome(packages, resources);
return true;
}
void
ContentProcessChild::Quit()
{
@ -163,24 +148,5 @@ ContentProcessChild::ActorDestroy(ActorDestroyReason why)
XRE_ShutdownChildProcess();
}
bool
ContentProcessChild::RecvNotifyVisited(const nsCString& aURISpec,
const bool& mIsVisited)
{
nsresult rv;
// reconstruct our IPDL-passed nsIURI
nsCOMPtr<nsIURI> newURI;
rv = NS_NewURI(getter_AddRefs(newURI), aURISpec);
// Our failure mode is to consider the link unvisited.
if (NS_SUCCEEDED(rv)) {
History *hs = History::GetSingleton();
if (hs) {
hs->NotifyVisited(newURI, mIsVisited);
}
}
return true;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -43,7 +43,6 @@
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/chrome/ChromeTypes.h"
namespace mozilla {
namespace dom {
@ -72,14 +71,6 @@ public:
virtual PNeckoChild* AllocPNecko();
virtual bool DeallocPNecko(PNeckoChild*);
virtual bool RecvDummy(Shmem& foo) { return true; }
virtual bool RecvregisterChrome(const nsTArray<ChromePackage>& packages,
const nsTArray<ChromeResource>& resources);
virtual bool
RecvNotifyVisited(const nsCString& aURISpec, const bool& mIsVisited);
private:
NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why);

Просмотреть файл

@ -41,22 +41,22 @@
#include "TabParent.h"
#include "mozilla/ipc/TestShellParent.h"
#include "mozilla/net/NeckoParent.h"
#include "mozilla/IHistory.h"
#include "nsIObserverService.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsDocShellCID.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"
#include "nsChromeRegistry.h"
using namespace mozilla::ipc;
using namespace mozilla::net;
using mozilla::MonitorAutoEnter;
namespace {
PRBool gSingletonDied = PR_FALSE;
}
namespace mozilla {
namespace dom {
@ -65,10 +65,7 @@ ContentProcessParent* ContentProcessParent::gSingleton;
ContentProcessParent*
ContentProcessParent::GetSingleton()
{
if (gSingleton && !gSingleton->IsAlive())
gSingleton = nsnull;
if (!gSingleton) {
if (!gSingleton && !gSingletonDied) {
nsRefPtr<ContentProcessParent> parent = new ContentProcessParent();
if (parent) {
nsCOMPtr<nsIObserverService> obs =
@ -105,8 +102,6 @@ ContentProcessParent::ActorDestroy(ActorDestroyReason why)
threadInt->SetObserver(mOldObserver);
if (mRunToCompletionDepth)
mRunToCompletionDepth = 0;
mIsAlive = false;
}
TabParent*
@ -130,32 +125,21 @@ ContentProcessParent::DestroyTestShell(TestShellParent* aTestShell)
ContentProcessParent::ContentProcessParent()
: mMonitor("ContentProcessParent::mMonitor")
, mRunToCompletionDepth(0)
, mIsAlive(true)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
mSubprocess->AsyncLaunch();
Open(mSubprocess->GetChannel(), mSubprocess->GetChildProcessHandle());
nsChromeRegistry* chromeRegistry = nsChromeRegistry::GetService();
chromeRegistry->SendRegisteredChrome(this);
}
ContentProcessParent::~ContentProcessParent()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
//If the previous content process has died, a new one could have
//been started since.
if (gSingleton == this)
NS_ASSERTION(gSingleton == this, "More than one singleton?!");
gSingletonDied = PR_TRUE;
gSingleton = nsnull;
}
bool
ContentProcessParent::IsAlive()
{
return mIsAlive;
}
NS_IMPL_THREADSAFE_ISUPPORTS2(ContentProcessParent,
nsIObserver,
nsIThreadObserver)
@ -236,23 +220,6 @@ ContentProcessParent::RequestRunToCompletion()
return !!mRunToCompletionDepth;
}
bool
ContentProcessParent::RecvStartVisitedQuery(const nsCString& aURISpec, nsresult* rv)
{
// reconstruct our IPDL-passed nsIURI
nsCOMPtr<nsIURI> newURI;
*rv = NS_NewURI(getter_AddRefs(newURI), aURISpec);
if (NS_SUCCEEDED(*rv)) {
nsCOMPtr<IHistory> history = do_GetService(NS_IHISTORY_CONTRACTID);
if (history) {
*rv = history->RegisterVisitedCallback(newURI, nsnull);
}
} else {
*rv = NS_ERROR_UNEXPECTED;
}
return true;
}
/* void onDispatchedEvent (in nsIThreadInternal thread); */
NS_IMETHODIMP
ContentProcessParent::OnDispatchedEvent(nsIThreadInternal *thread)

Просмотреть файл

@ -85,8 +85,6 @@ public:
bool RequestRunToCompletion();
bool IsAlive();
protected:
virtual void ActorDestroy(ActorDestroyReason why);
@ -110,8 +108,6 @@ private:
virtual PNeckoParent* AllocPNecko();
virtual bool DeallocPNecko(PNeckoParent* necko);
virtual bool RecvStartVisitedQuery(const nsCString& aURISpec, nsresult* rv);
mozilla::Monitor mMonitor;
GeckoChildProcessHost* mSubprocess;
@ -119,7 +115,6 @@ private:
int mRunToCompletionDepth;
nsCOMPtr<nsIThreadObserver> mOldObserver;
bool mIsAlive;
};
} // namespace dom

Просмотреть файл

@ -59,7 +59,6 @@ EXPORTS_mozilla/dom = \
ContentProcessChild.h \
ContentProcessParent.h \
ContentProcessThread.h \
TabParent.h \
$(NULL)
CPPSRCS = \
@ -76,10 +75,8 @@ include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(srcdir)/../../toolkit/components/places/src \
-I$(srcdir)/../../content/base/src \
-I$(srcdir)/../../content/events/src \
-I$(topsrcdir)/chrome/src \
$(NULL)
DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'

Просмотреть файл

@ -41,11 +41,6 @@ include protocol "PTestShell.ipdl";
include protocol "PNecko.ipdl";
include "mozilla/TabTypes.h";
include "mozilla/chrome/ChromeTypes.h";
include "mozilla/chrome/RegistryMessageUtils.h";
using ChromePackage;
using ChromeResource;
namespace mozilla {
namespace dom {
@ -61,16 +56,8 @@ child:
PTestShell();
registerChrome(ChromePackage[] packages, ChromeResource[] resources);
// A dummy message to make sure PContentProcess contains methods to create
// Shmem segments.
async Dummy(Shmem foo);
async NotifyVisited(nsCString aURISpec, bool mIsVisited);
parent:
PNecko();
sync StartVisitedQuery(nsCString aURISpec) returns (nsresult rv);
};
}

Просмотреть файл

@ -45,7 +45,6 @@ protocol PDocumentRenderer
manager PIFrameEmbedding;
parent:
// Returns the width and height, in pixels, of the returned ARGB32 data.
__delete__(PRUint32 w, PRUint32 h, nsCString data);
};

Просмотреть файл

@ -1,54 +0,0 @@
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Fenntrolysis.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
include protocol "PIFrameEmbedding.ipdl";
namespace mozilla {
namespace ipc {
protocol PDocumentRendererShmem
{
manager PIFrameEmbedding;
parent:
// Returns the offset, width and height, in pixels, of the area in the
// buffer that was drawn.
__delete__(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, Shmem data);
};
} // namespace ipc
} // namespace mozilla

Просмотреть файл

@ -39,14 +39,12 @@
include protocol "PContentProcess.ipdl";
include protocol "PDocumentRenderer.ipdl";
include protocol "PDocumentRendererShmem.ipdl";
include "mozilla/TabTypes.h";
include "TabMessageUtils.h";
using MagicWindowHandle;
using RemoteDOMEvent;
using gfxMatrix;
namespace mozilla {
namespace dom {
@ -55,7 +53,6 @@ rpc protocol PIFrameEmbedding
{
manager PContentProcess;
manages PDocumentRenderer;
manages PDocumentRendererShmem;
child:
__delete__();
@ -118,15 +115,6 @@ child:
sendAsyncMessageToChild(nsString aMessage, nsString aJSON);
PDocumentRenderer(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush);
// @param matrix the transformation matrix the context we're going to draw into should have.
// @param bufw the width of @buf, in pixels
// @param bufh the height of @buf, in pixels
PDocumentRendererShmem(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush,
gfxMatrix matrix, PRInt32 bufw, PRInt32 bufh, Shmem buf);
registerChromePackage(nsString aPackage, nsString aBaseURI, PRUint32 aFlags);
registerChromeResource(nsString aPackage, nsString aResolvedURI);
};
}

Просмотреть файл

@ -47,7 +47,6 @@
#include "nsThreadUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/ipc/DocumentRendererChild.h"
#include "mozilla/ipc/DocumentRendererShmemChild.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindowUtils.h"
@ -55,7 +54,6 @@
#include "nsIWebBrowserFocus.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsXULAppAPI.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIJSRuntimeService.h"
@ -68,8 +66,6 @@
#include "nsScriptLoader.h"
#include "nsPIWindowRoot.h"
#include "nsIScriptContext.h"
#include "nsXULAppAPI.h"
#include "nsPresContext.h"
#ifdef MOZ_WIDGET_QT
#include <QX11EmbedWidget>
@ -504,89 +500,6 @@ TabChild::RecvPDocumentRendererConstructor(
return PDocumentRendererChild::Send__delete__(__a, width, height, data);
}
mozilla::ipc::PDocumentRendererShmemChild*
TabChild::AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRInt32& bufw,
const PRInt32& bufh,
Shmem& buf)
{
return new mozilla::ipc::DocumentRendererShmemChild();
}
bool
TabChild::DeallocPDocumentRendererShmem(PDocumentRendererShmemChild* actor)
{
delete actor;
return true;
}
bool
TabChild::RecvPDocumentRendererShmemConstructor(
mozilla::ipc::PDocumentRendererShmemChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRInt32& aBufW,
const PRInt32& aBufH,
Shmem& aBuf)
{
mozilla::ipc::DocumentRendererShmemChild *render =
static_cast<mozilla::ipc::DocumentRendererShmemChild *>(__a);
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
if (!browser)
return true; // silently ignore
nsCOMPtr<nsIDOMWindow> window;
if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
!window)
{
return true; // silently ignore
}
render->RenderDocument(window, aX, aY, aW, aH, bgcolor, flags, flush,
aMatrix, aBufW, aBufH, aBuf);
gfxRect dirtyArea(0, 0, nsPresContext::AppUnitsToIntCSSPixels(aW),
nsPresContext::AppUnitsToIntCSSPixels(aH));
dirtyArea = aMatrix.Transform(dirtyArea);
return PDocumentRendererShmemChild::Send__delete__(__a, dirtyArea.X(), dirtyArea.Y(),
dirtyArea.Width(), dirtyArea.Height(),
aBuf);
}
bool
TabChild::RecvregisterChromePackage(const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags)
{
XRE_RegisterChromePackage(aPackage, aBaseURI, aFlags);
return true;
}
bool
TabChild::RecvregisterChromeResource(const nsString& aPackage,
const nsString& aResolvedURI)
{
XRE_RegisterChromeResource(aPackage, aResolvedURI);
return true;
}
bool
TabChild::RecvactivateFrameEvent(const nsString& aType, const bool& capture)
{

Просмотреть файл

@ -66,8 +66,6 @@
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptContext.h"
class gfxMatrix;
namespace mozilla {
namespace dom {
@ -196,45 +194,11 @@ public:
const PRUint32& flags,
const bool& flush);
virtual mozilla::ipc::PDocumentRendererShmemChild* AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRInt32& bufw,
const PRInt32& bufh,
Shmem& buf);
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemChild* actor);
virtual bool RecvPDocumentRendererShmemConstructor(
mozilla::ipc::PDocumentRendererShmemChild *__a,
const PRInt32& aX,
const PRInt32& aY,
const PRInt32& aW,
const PRInt32& aH,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRInt32& aBufW,
const PRInt32& aBufH,
Shmem& aBuf);
nsIWebNavigation* WebNavigation() { return mWebNav; }
JSContext* GetJSContext() { return mCx; }
nsIPrincipal* GetPrincipal() { return mPrincipal; }
virtual bool RecvregisterChromePackage(const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags);
virtual bool RecvregisterChromeResource(const nsString& aPackage,
const nsString& aResolvedURI);
private:
bool InitTabChildGlobal();

Просмотреть файл

@ -39,7 +39,6 @@
#include "TabParent.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/ipc/DocumentRendererShmemParent.h"
#include "nsIURI.h"
#include "nsFocusManager.h"
@ -53,7 +52,6 @@
#include "nsFrameLoader.h"
using mozilla::ipc::DocumentRendererParent;
using mozilla::ipc::DocumentRendererShmemParent;
namespace mozilla {
namespace dom {
@ -157,22 +155,6 @@ TabParent::DeallocPDocumentRenderer(PDocumentRendererParent* actor)
return true;
}
mozilla::ipc::PDocumentRendererShmemParent*
TabParent::AllocPDocumentRendererShmem(const PRInt32& x,
const PRInt32& y, const PRInt32& w, const PRInt32& h, const nsString& bgcolor,
const PRUint32& flags, const bool& flush, const gfxMatrix& aMatrix,
const PRInt32& bufw, const PRInt32& bufh, Shmem &buf)
{
return new DocumentRendererShmemParent();
}
bool
TabParent::DeallocPDocumentRendererShmem(PDocumentRendererShmemParent* actor)
{
delete actor;
return true;
}
void
TabParent::SendMouseEvent(const nsAString& aType, float aX, float aY,
PRInt32 aButton, PRInt32 aClickCount,

Просмотреть файл

@ -48,7 +48,6 @@
class nsIURI;
class nsIDOMElement;
class gfxMatrix;
namespace mozilla {
namespace dom {
@ -91,21 +90,6 @@ public:
const PRUint32& flags,
const bool& flush);
virtual bool DeallocPDocumentRenderer(PDocumentRendererParent* actor);
virtual mozilla::ipc::PDocumentRendererShmemParent* AllocPDocumentRendererShmem(
const PRInt32& x,
const PRInt32& y,
const PRInt32& w,
const PRInt32& h,
const nsString& bgcolor,
const PRUint32& flags,
const bool& flush,
const gfxMatrix& aMatrix,
const PRInt32& bufw,
const PRInt32& bufh,
Shmem &buf);
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemParent* actor);
protected:
nsIDOMElement* mFrameElement;
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;

Просмотреть файл

@ -38,5 +38,4 @@ IPDLSRCS = \
PContentProcess.ipdl \
PIFrameEmbedding.ipdl \
PDocumentRenderer.ipdl \
PDocumentRendererShmem.ipdl \
$(NULL)

Просмотреть файл

@ -48,7 +48,7 @@
* completely implemented. So while this format value is currently
* deprecated, it may eventually acquire complete support in the future.
*/
//#define CAIRO_FORMAT_RGB16_565 4
#define CAIRO_FORMAT_RGB16_565 4
#define CAIRO_FONT_TYPE_ATSUI CAIRO_FONT_TYPE_QUARTZ

Просмотреть файл

@ -49,10 +49,8 @@ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
return CAIRO_FORMAT_A8;
case PIXMAN_a1:
return CAIRO_FORMAT_A1;
case PIXMAN_r5g6b5:
return CAIRO_FORMAT_RGB16_565;
case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
case PIXMAN_b8g8r8: case PIXMAN_b5g6r5:
case PIXMAN_b8g8r8: case PIXMAN_r5g6b5: case PIXMAN_b5g6r5:
case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
case PIXMAN_a4b4g4r4: case PIXMAN_x4b4g4r4: case PIXMAN_r3g3b2:
@ -308,9 +306,6 @@ _cairo_format_to_pixman_format_code (cairo_format_t format)
case CAIRO_FORMAT_RGB24:
ret = PIXMAN_x8r8g8b8;
break;
case CAIRO_FORMAT_RGB16_565:
ret = PIXMAN_r5g6b5;
break;
case CAIRO_FORMAT_ARGB32:
default:
ret = PIXMAN_a8r8g8b8;
@ -656,8 +651,6 @@ cairo_format_t
_cairo_format_from_content (cairo_content_t content)
{
switch (content) {
case CAIRO_CONTENT_COLOR16:
return CAIRO_FORMAT_RGB16_565;
case CAIRO_CONTENT_COLOR:
return CAIRO_FORMAT_RGB24;
case CAIRO_CONTENT_ALPHA:
@ -678,8 +671,6 @@ _cairo_content_from_format (cairo_format_t format)
return CAIRO_CONTENT_COLOR_ALPHA;
case CAIRO_FORMAT_RGB24:
return CAIRO_CONTENT_COLOR;
case CAIRO_FORMAT_RGB16_565:
return CAIRO_CONTENT_COLOR16;
case CAIRO_FORMAT_A8:
case CAIRO_FORMAT_A1:
return CAIRO_CONTENT_ALPHA;
@ -697,8 +688,6 @@ _cairo_format_bits_per_pixel (cairo_format_t format)
return 32;
case CAIRO_FORMAT_RGB24:
return 32;
case CAIRO_FORMAT_RGB16_565:
return 16;
case CAIRO_FORMAT_A8:
return 8;
case CAIRO_FORMAT_A1:

Просмотреть файл

@ -312,8 +312,7 @@ typedef enum _cairo_status {
typedef enum _cairo_content {
CAIRO_CONTENT_COLOR = 0x1000,
CAIRO_CONTENT_ALPHA = 0x2000,
CAIRO_CONTENT_COLOR_ALPHA = 0x3000,
CAIRO_CONTENT_COLOR16 = 0x4000
CAIRO_CONTENT_COLOR_ALPHA = 0x3000
} cairo_content_t;
/**
@ -2067,8 +2066,11 @@ typedef enum _cairo_format {
CAIRO_FORMAT_ARGB32,
CAIRO_FORMAT_RGB24,
CAIRO_FORMAT_A8,
CAIRO_FORMAT_A1,
CAIRO_FORMAT_RGB16_565
CAIRO_FORMAT_A1
/* The value of 4 is reserved by a deprecated enum value.
* The next format added must have an explicit value of 5.
CAIRO_FORMAT_RGB16_565 = 4,
*/
} cairo_format_t;
cairo_public cairo_surface_t *

Просмотреть файл

@ -2151,7 +2151,7 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface) cairo_pure;
* in cairo-xlib-surface.c--again see -Wswitch-enum).
*/
#define CAIRO_FORMAT_INVALID ((unsigned int) -1)
#define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_RGB16_565)
#define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_A1)
/* pixman-required stride alignment in bytes. */
#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
@ -2161,7 +2161,6 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface) cairo_pure;
#define CAIRO_CONTENT_VALID(content) ((content) && \
(((content) & ~(CAIRO_CONTENT_COLOR | \
CAIRO_CONTENT_ALPHA | \
CAIRO_CONTENT_COLOR16 | \
CAIRO_CONTENT_COLOR_ALPHA))\
== 0))

Просмотреть файл

@ -110,7 +110,6 @@ CSRCS = \
pixman-cpu.c \
pixman-edge.c \
pixman-edge-accessors.c \
pixman-fast-path-scale.c \
pixman-fast-path.c \
pixman-general.c \
pixman-gradient-walker.c \

Просмотреть файл

@ -534,212 +534,6 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_image_t * ima,
*buffer++ = 0;
}
static void
bits_image_fetch_bilinear_no_repeat_0565 (pixman_image_t * ima,
int offset,
int line,
int width,
uint32_t * buffer,
const uint32_t * mask,
uint32_t mask_bits)
{
bits_image_t *bits = &ima->bits;
pixman_fixed_t x_top, x_bottom, x;
pixman_fixed_t ux_top, ux_bottom, ux;
pixman_vector_t v;
uint32_t top_mask, bottom_mask;
uint16_t *top_row;
uint16_t *bottom_row;
uint32_t *end;
uint16_t zero[2] = { 0, 0 };
int y, y1, y2;
int disty;
int mask_inc;
int w;
/* reference point is the center of the pixel */
v.vector[0] = pixman_int_to_fixed (offset) + pixman_fixed_1 / 2;
v.vector[1] = pixman_int_to_fixed (line) + pixman_fixed_1 / 2;
v.vector[2] = pixman_fixed_1;
if (!pixman_transform_point_3d (bits->common.transform, &v))
return;
ux = ux_top = ux_bottom = bits->common.transform->matrix[0][0];
x = x_top = x_bottom = v.vector[0] - pixman_fixed_1/2;
y = v.vector[1] - pixman_fixed_1/2;
disty = (y >> 8) & 0xff;
/* Load the pointers to the first and second lines from the source
* image that bilinear code must read.
*
* The main trick in this code is about the check if any line are
* outside of the image;
*
* When I realize that a line (any one) is outside, I change
* the pointer to a dummy area with zeros. Once I change this, I
* must be sure the pointer will not change, so I set the
* variables to each pointer increments inside the loop.
*/
y1 = pixman_fixed_to_int (y);
y2 = y1 + 1;
if (y1 < 0 || y1 >= bits->height)
{
top_row = zero;
x_top = 0;
ux_top = 0;
}
else
{
top_row = bits->bits + y1 * bits->rowstride;
x_top = x;
ux_top = ux;
}
if (y2 < 0 || y2 >= bits->height)
{
bottom_row = zero;
x_bottom = 0;
ux_bottom = 0;
}
else
{
bottom_row = bits->bits + y2 * bits->rowstride;
x_bottom = x;
ux_bottom = ux;
}
/* Instead of checking whether the operation uses the mast in
* each loop iteration, verify this only once and prepare the
* variables to make the code smaller inside the loop.
*/
if (!mask)
{
mask_inc = 0;
mask_bits = 1;
mask = &mask_bits;
}
else
{
/* If have a mask, prepare the variables to check it */
mask_inc = 1;
}
/* If both are zero, then the whole thing is zero */
if (top_row == zero && bottom_row == zero)
{
memset (buffer, 0, width * sizeof (uint32_t));
return;
}
else
{
if (top_row == zero)
{
top_mask = 0;
bottom_mask = 0xff000000;
}
else if (bottom_row == zero)
{
top_mask = 0xff000000;
bottom_mask = 0;
}
else
{
top_mask = 0xff000000;
bottom_mask = 0xff000000;
}
}
end = buffer + width;
/* Zero fill to the left of the image */
while (buffer < end && x < pixman_fixed_minus_1)
{
*buffer++ = 0;
x += ux;
x_top += ux_top;
x_bottom += ux_bottom;
mask += mask_inc;
}
/* Left edge
*/
while (buffer < end && x < 0)
{
uint32_t tr, br;
int32_t distx;
tr = CONVERT_0565_TO_0888 (top_row[pixman_fixed_to_int (x_top) + 1]) | top_mask;
br = CONVERT_0565_TO_0888 (bottom_row[pixman_fixed_to_int (x_bottom) + 1]) | bottom_mask;
distx = (x >> 8) & 0xff;
*buffer++ = bilinear_interpolation (0, tr, 0, br, distx, disty);
x += ux;
x_top += ux_top;
x_bottom += ux_bottom;
mask += mask_inc;
}
/* Main part */
w = pixman_int_to_fixed (bits->width - 1);
while (buffer < end && x < w)
{
if (*mask)
{
uint32_t tl, tr, bl, br;
int32_t distx;
tl = CONVERT_0565_TO_0888 (top_row [pixman_fixed_to_int (x_top)]) | top_mask;
tr = CONVERT_0565_TO_0888 (top_row [pixman_fixed_to_int (x_top) + 1]) | top_mask;
bl = CONVERT_0565_TO_0888 (bottom_row [pixman_fixed_to_int (x_bottom)]) | bottom_mask;
br = CONVERT_0565_TO_0888 (bottom_row [pixman_fixed_to_int (x_bottom) + 1]) | bottom_mask;
distx = (x >> 8) & 0xff;
*buffer = bilinear_interpolation (tl, tr, bl, br, distx, disty);
}
buffer++;
x += ux;
x_top += ux_top;
x_bottom += ux_bottom;
mask += mask_inc;
}
/* Right Edge */
w = pixman_int_to_fixed (bits->width);
while (buffer < end && x < w)
{
if (*mask)
{
uint32_t tl, bl;
int32_t distx;
tl = CONVERT_0565_TO_0888 (top_row [pixman_fixed_to_int (x_top)]) | top_mask;
bl = CONVERT_0565_TO_0888 (bottom_row [pixman_fixed_to_int (x_bottom)]) | bottom_mask;
distx = (x >> 8) & 0xff;
*buffer = bilinear_interpolation (tl, 0, bl, 0, distx, disty);
}
buffer++;
x += ux;
x_top += ux_top;
x_bottom += ux_bottom;
mask += mask_inc;
}
/* Zero fill to the left of the image */
while (buffer < end)
*buffer++ = 0;
}
static force_inline uint32_t
bits_image_fetch_pixel_convolution (bits_image_t *image,
pixman_fixed_t x,
@ -1171,27 +965,15 @@ bits_image_property_changed (pixman_image_t *image)
(bits->common.filter == PIXMAN_FILTER_BILINEAR ||
bits->common.filter == PIXMAN_FILTER_GOOD ||
bits->common.filter == PIXMAN_FILTER_BEST) &&
bits->common.repeat == PIXMAN_REPEAT_NONE)
bits->common.repeat == PIXMAN_REPEAT_NONE &&
(bits->format == PIXMAN_a8r8g8b8 ||
bits->format == PIXMAN_x8r8g8b8))
{
image->common.get_scanline_64 =
_pixman_image_get_scanline_generic_64;
if (bits->format == PIXMAN_a8r8g8b8 || bits->format == PIXMAN_x8r8g8b8)
{
image->common.get_scanline_32 =
bits_image_fetch_bilinear_no_repeat_8888;
}
else if (bits->format == PIXMAN_r5g6b5)
{
image->common.get_scanline_32 =
bits_image_fetch_bilinear_no_repeat_0565;
}
else
{
image->common.get_scanline_32 =
bits_image_fetch_transformed;
}
}
else
{
image->common.get_scanline_64 =

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1529,39 +1529,6 @@ fast_path_composite (pixman_implementation_t *imp,
int32_t width,
int32_t height)
{
/*
* In some cases, single pass fast path composite operation
* can be also run for the cases when source image has
* transform and repeat set. For now, only NEAREST transform
* is supported and destination image should have trivial
* clipping only (one clipping box at most). Additionally,
* transform should only perform scaling (but no rotation).
*/
if (src->type == BITS &&
src->common.transform &&
!mask &&
!src->common.alpha_map && !dest->common.alpha_map &&
src->common.filter == PIXMAN_FILTER_NEAREST &&
!src->bits.read_func && !src->bits.write_func &&
!dest->bits.read_func && !dest->bits.write_func)
{
if (src->common.transform->matrix[0][1] == 0 &&
src->common.transform->matrix[1][0] == 0 &&
src->common.transform->matrix[2][0] == 0 &&
src->common.transform->matrix[2][1] == 0 &&
src->common.transform->matrix[2][2] == pixman_fixed_1 &&
(!dest->common.have_clip_region ||
dest->common.clip_region.data == NULL))
{
if (_pixman_run_fast_path_scale (op, src, mask, dest, src_x, src_y,
mask_x, mask_y, dest_x, dest_y,
width, height))
{
return;
}
}
}
if (src->type == BITS
&& src->common.transform
&& !mask

Просмотреть файл

@ -618,20 +618,6 @@ _pixman_walk_composite_region (pixman_implementation_t *imp,
int32_t height,
pixman_composite_func_t composite_rect);
pixman_bool_t
_pixman_run_fast_path_scale (pixman_op_t op,
pixman_image_t * src_image,
pixman_image_t * mask_image,
pixman_image_t * dst_image,
int32_t src_x,
int32_t src_y,
int32_t mask_x,
int32_t mask_y,
int32_t dest_x,
int32_t dest_y,
int32_t width,
int32_t height);
void
pixman_expand (uint64_t * dst,
const uint32_t * src,

Просмотреть файл

@ -67,7 +67,6 @@ public:
ImageFormatRGB24, ///< xRGB data in native endianness
ImageFormatA8, ///< Only an alpha channel
ImageFormatA1, ///< Packed transparency information (one byte refers to 8 pixels)
ImageFormatRGB16, ///< xRGB data in native endianness, using premultiplied alpha
ImageFormatUnknown
} gfxImageFormat;
@ -94,8 +93,7 @@ public:
typedef enum {
CONTENT_COLOR = 0x1000,
CONTENT_ALPHA = 0x2000,
CONTENT_COLOR_ALPHA = 0x3000,
CONTENT_COLOR16 = 0x4000
CONTENT_COLOR_ALPHA = 0x3000
} gfxContentType;
/* Wrap the given cairo surface and return a gfxASurface for it */

Просмотреть файл

@ -389,8 +389,6 @@ gfxASurface::ContentFromFormat(gfxImageFormat format)
return CONTENT_COLOR_ALPHA;
case ImageFormatRGB24:
return CONTENT_COLOR;
case ImageFormatRGB16:
return CONTENT_COLOR16;
case ImageFormatA8:
case ImageFormatA1:
return CONTENT_ALPHA;

Просмотреть файл

@ -122,8 +122,6 @@ gfxImageSurface::ComputeStride() const
stride = mSize.width * 4;
else if (mFormat == ImageFormatRGB24)
stride = mSize.width * 4;
else if (mFormat == ImageFormatRGB16)
stride = mSize.width * 2;
else if (mFormat == ImageFormatA8)
stride = mSize.width;
else if (mFormat == ImageFormatA1) {

Просмотреть файл

@ -195,8 +195,6 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
}
if (mRenderMode == RENDER_SHARED_IMAGE) {
if (imageFormat == gfxASurface::ImageFormatRGB24 && QX11Info().depth() == 16)
imageFormat = gfxASurface::ImageFormatRGB16;
newSurface = new gfxImageSurface(size, imageFormat);
return newSurface.forget();
}
@ -210,8 +208,6 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
case gfxASurface::ImageFormatRGB24:
xrenderFormatID = PictStandardRGB24;
break;
case gfxASurface::ImageFormatRGB16:
break;
case gfxASurface::ImageFormatA8:
xrenderFormatID = PictStandardA8;
break;
@ -225,11 +221,8 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
// XXX we really need a different interface here, something that passes
// in more context, including the display and/or target surface type that
// we should try to match
XRenderPictFormat* xrenderFormat = nsnull;
if ((xrenderFormatID == PictStandardRGB24 && QX11Info().depth() == 16) || xrenderFormatID == -1)
xrenderFormat = XRenderFindVisualFormat(QX11Info().display(), (Visual*)QX11Info().visual());
else
xrenderFormat = XRenderFindStandardFormat(QX11Info().display(), xrenderFormatID);
XRenderPictFormat* xrenderFormat =
XRenderFindStandardFormat(QX11Info().display(), xrenderFormatID);
newSurface = new gfxXlibSurface((Display*)QX11Info().display(),
xrenderFormat,

Просмотреть файл

@ -78,9 +78,6 @@ gfxSharedImageSurface::getASurface(void)
if (mDepth == 32)
imageFormat = gfxASurface::ImageFormatARGB32;
if (mDepth == 16)
imageFormat = gfxASurface::ImageFormatRGB16;
gfxASurface* result = new gfxImageSurface(mData, mSize, mStride, imageFormat);
NS_IF_ADDREF(result);
return result;
@ -191,8 +188,6 @@ gfxSharedImageSurface::ComputeFormat()
mFormat = ImageFormatARGB32;
if (mDepth == 24)
mFormat = ImageFormatRGB24;
if (mDepth == 16)
mFormat = ImageFormatRGB16;
else {
NS_WARNING("Unknown depth specified to gfxSharedImageSurface!");
mFormat = ImageFormatUnknown;
@ -210,8 +205,6 @@ gfxSharedImageSurface::ComputeDepth()
mDepth = 32;
else if (mFormat == ImageFormatRGB24)
mDepth = 24;
else if (mFormat == ImageFormatRGB16)
mDepth = 16;
else {
NS_WARNING("Unknown format specified to gfxSharedImageSurface!");
return false;

Просмотреть файл

@ -44,7 +44,6 @@
#include "prtypes.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "gfxMatrix.h"
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -282,46 +281,6 @@ struct ParamTraits<float>
}
};
template<>
struct ParamTraits<gfxMatrix>
{
typedef gfxMatrix paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.xx);
WriteParam(aMsg, aParam.xy);
WriteParam(aMsg, aParam.yx);
WriteParam(aMsg, aParam.yy);
WriteParam(aMsg, aParam.x0);
WriteParam(aMsg, aParam.y0);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
if (!ReadParam(aMsg, aIter, &aResult->xx))
return false;
if (!ReadParam(aMsg, aIter, &aResult->xy))
return false;
if (!ReadParam(aMsg, aIter, &aResult->yx))
return false;
if (!ReadParam(aMsg, aIter, &aResult->yy))
return false;
if (!ReadParam(aMsg, aIter, &aResult->x0))
return false;
if (!ReadParam(aMsg, aIter, &aResult->y0))
return false;
return true;
}
static void Log(const paramType& aParam, std::wstring* aLog)
{
aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam.xx, aParam.xy, aParam.yx, aParam.yy,
aParam.x0, aParam.y0));
}
};
} /* namespace IPC */
#endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */

Просмотреть файл

@ -89,10 +89,6 @@ public:
virtual ListenerT* Lookup(int32) = 0;
virtual void Unregister(int32) = 0;
virtual void RemoveManagee(int32, ListenerT*) = 0;
virtual Shmem::SharedMemory* CreateSharedMemory(size_t, int32*) = 0;
virtual Shmem::SharedMemory* LookupSharedMemory(int32) = 0;
// XXX odd duck, acknowledged
virtual ProcessHandle OtherProcess() const = 0;
};

Просмотреть файл

@ -145,22 +145,6 @@ public:
return *this;
}
// Returns whether this Shmem is writable by you, and thus whether you can
// transfer writability to another actor.
bool
IsWritable() const
{
return mSegment != NULL;
}
// Returns whether this Shmem is readable by you, and thus whether you can
// transfer readability to another actor.
bool
IsReadable() const
{
return mSegment != NULL;
}
// Return a pointer to the user-visible data segment.
template<typename T>
T*

Просмотреть файл

@ -208,8 +208,8 @@ def _shmemType(ptr=0):
def _rawShmemType(ptr=0):
return Type('Shmem::SharedMemory', ptr=ptr)
def _shmemIdType(ptr=0):
return Type('Shmem::id_t', ptr=ptr)
def _shmemIdType():
return Type('Shmem::id_t')
def _shmemHandleType():
return Type('Shmem::SharedMemoryHandle')
@ -250,7 +250,7 @@ def _shmemCreatedMsgVar():
return ExprVar('mozilla::ipc::__internal__ipdl__ShmemCreated')
def _lookupShmem(idexpr):
return ExprCall(ExprVar('LookupSharedMemory'), args=[ idexpr ])
return ExprCall(ExprVar('LookupShmem'), args=[ idexpr ])
def _makeForwardDecl(ptype, side):
clsname = _actorName(ptype.qname.baseid, side)
@ -1341,12 +1341,6 @@ class Protocol(ipdl.ast.Protocol):
def removeManageeMethod(self):
return ExprVar('RemoveManagee')
def createSharedMemory(self):
return ExprVar('CreateSharedMemory')
def lookupSharedMemory(self):
return ExprVar('LookupSharedMemory')
def otherProcessMethod(self):
return ExprVar('OtherProcess')
@ -1448,26 +1442,42 @@ class Protocol(ipdl.ast.Protocol):
# shmem stuff
def shmemMapVar(self):
assert self.decl.type.isToplevel()
assert self.usesShmem()
return ExprVar('mShmemMap')
def lastShmemIdVar(self):
assert self.decl.type.isToplevel()
assert self.usesShmem()
return ExprVar('mLastShmemId')
def shmemIdInit(self, side):
assert self.decl.type.isToplevel()
assert self.usesShmem()
# use the same scheme for shmem IDs as actor IDs
if side is 'parent': return _FREED_ACTOR_ID
elif side is 'child': return _NULL_ACTOR_ID
else: assert 0
def nextShmemIdExpr(self, side):
assert self.decl.type.isToplevel()
assert self.usesShmem()
if side is 'parent': op = '++'
elif side is 'child': op = '--'
return ExprPrefixUnop(self.lastShmemIdVar(), op)
def lookupShmemVar(self):
assert self.usesShmem()
return ExprVar('LookupShmem')
def registerShmemVar(self):
assert self.usesShmem()
return ExprVar('RegisterShmem')
def registerShmemIdVar(self):
assert self.usesShmem()
return ExprVar('RegisterShmemId')
def unregisterShmemVar(self):
assert self.usesShmem()
return ExprVar('UnregisterShmem')
def usesShmem(self):
for md in self.messageDecls:
for param in md.inParams:
@ -2672,7 +2682,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ctor.memberinits = [
ExprMemberInit(p.idVar(), [ ExprLiteral.ZERO ]) ]
if p.decl.type.isToplevel():
if p.usesShmem():
ctor.memberinits.append(
ExprMemberInit(p.lastShmemIdVar(),
[ p.shmemIdInit(self.side) ]))
@ -2775,6 +2785,13 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
for md in p.messageDecls:
self.visitMessageDecl(md)
# "hidden" message that passes shmem mappings from one process
# to the other
if p.usesShmem():
self.asyncSwitch.addcase(
CaseLabel('SHMEM_CREATED_MESSAGE_TYPE'),
self.genShmemCreatedHandler())
# add default cases
default = StmtBlock()
default.addstmt(StmtReturn(_Result.NotKnown))
@ -2907,15 +2924,15 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
_runtimeAbort("`OnError' called on non-toplevel actor"))
self.cls.addstmts([ onerror, Whitespace.NL ])
# User-facing shmem methods
self.cls.addstmts(self.makeShmemIface())
# FIXME/bug 535053: only manager protocols and non-manager
# protocols with union types need Lookup(). we'll give it to
# all for the time being (simpler)
if 1 or ptype.isManager():
self.cls.addstmts(self.implementManagerIface())
if p.usesShmem():
self.cls.addstmts(self.makeShmemIface())
if ptype.isToplevel() and self.side is 'parent':
## bool GetMinidump(nsIFile** dump)
self.cls.addstmt(Label.PROTECTED)
@ -3107,7 +3124,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
StmtDecl(Decl(p.managerInterfaceType(ptr=1),
p.managerVar().name))
])
if p.decl.type.isToplevel():
if p.usesShmem():
self.cls.addstmts([
StmtDecl(Decl(Type('IDMap', T=_rawShmemType()),
p.shmemMapVar().name)),
@ -3125,7 +3142,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
p = self.protocol
routedvar = ExprVar('aRouted')
idvar = ExprVar('aId')
sizevar = ExprVar('aSize')
listenertype = Type('ChannelListener', ptr=1)
register = MethodDefn(MethodDecl(
@ -3146,19 +3162,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
p.unregisterMethod().name,
params=[ Decl(_actorIdType(), idvar.name) ],
virtual=1))
createshmem = MethodDefn(MethodDecl(
p.createSharedMemory().name,
ret=_rawShmemType(ptr=1),
params=[ Decl(Type.SIZE, sizevar.name),
Decl(_shmemIdType(ptr=1), idvar.name) ],
virtual=1))
lookupshmem = MethodDefn(MethodDecl(
p.lookupSharedMemory().name,
ret=_rawShmemType(ptr=1),
params=[ Decl(_shmemIdType(), idvar.name) ],
virtual=1))
otherprocess = MethodDefn(MethodDecl(
p.otherProcessMethod().name,
ret=Type('ProcessHandle'),
@ -3187,74 +3190,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
unregister.addstmt(StmtReturn(
ExprCall(ExprSelect(p.actorMapVar(), '.', 'Remove'),
[ idvar ])))
# SharedMemory* CreateSharedMemory(size, id_t*):
# nsAutoPtr<shmem_t> shmem(Shmem::Alloc(size));
# if (!shmem)
# return false
# shmemhandle_t handle;
# if (!shmem->ShareToProcess(subprocess, &handle))
# return false;
# Shmem::id_t id = [nextshmemid];
# mShmemMap.Add(rawshmem, id);
# Message* msg = new __internal__ipdl__ShmemCreated(
# mRoutingId, handle, id, size);
# if (!Send(msg))
# return false;
# return shmem.forget();
rawvar = ExprVar('rawshmem')
handlevar = ExprVar('handle')
createshmem.addstmt(StmtDecl(
Decl(_autoptr(_rawShmemType()), rawvar.name),
initargs=[ _shmemAlloc(sizevar) ]))
failif = StmtIf(ExprNot(rawvar))
failif.addifstmt(StmtReturn(ExprLiteral.FALSE))
createshmem.addstmt(failif)
createshmem.addstmt(StmtDecl(
Decl(_shmemHandleType(), handlevar.name)))
failif = StmtIf(ExprNot(ExprCall(
ExprSelect(rawvar, '->', 'ShareToProcess'),
args=[ ExprCall(p.otherProcessMethod()),
ExprAddrOf(handlevar) ])))
failif.addifstmt(StmtReturn(ExprLiteral.FALSE))
createshmem.addstmt(failif)
createshmem.addstmts([
StmtExpr(ExprAssn(
ExprDeref(idvar),
p.nextShmemIdExpr(self.side))),
StmtDecl(ExprCall(
ExprSelect(p.shmemMapVar(), '.', 'AddWithID'),
args=[ rawvar, ExprDeref(idvar) ]))
])
msgvar = ExprVar('msg')
createshmem.addstmts([
StmtDecl(
Decl(Type('Message', ptr=1), msgvar.name),
ExprNew(Type(_shmemCreatedMsgVar().name),
args=[ p.routingId(), handlevar,
ExprDeref(idvar), sizevar ])),
# TODO handle failed sends
StmtExpr(ExprCall(
ExprSelect(p.channelVar(), p.channelSel(), 'Send'),
args=[ msgvar ])),
StmtReturn(_autoptrForget(rawvar))
])
lookupshmem.addstmt(StmtReturn(ExprCall(
ExprSelect(p.shmemMapVar(), '.', 'Lookup'),
args=[ idvar ])))
# "private" message that passes shmem mappings from one process
# to the other
if p.usesShmem():
self.asyncSwitch.addcase(
CaseLabel('SHMEM_CREATED_MESSAGE_TYPE'),
self.genShmemCreatedHandler())
otherprocess.addstmt(StmtReturn(p.otherProcessVar()))
else:
# delegate registration to manager
@ -3270,12 +3205,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
unregister.addstmt(StmtReturn(ExprCall(
ExprSelect(p.managerVar(), '->', p.unregisterMethod().name),
[ idvar ])))
createshmem.addstmt(StmtReturn(ExprCall(
ExprSelect(p.managerVar(), '->', p.createSharedMemory().name),
[ sizevar, idvar ])))
lookupshmem.addstmt(StmtReturn(ExprCall(
ExprSelect(p.managerVar(), '->', p.lookupSharedMemory().name),
[ idvar ])))
otherprocess.addstmt(StmtReturn(ExprCall(
ExprSelect(p.managerVar(), '->',
p.otherProcessMethod().name))))
@ -3324,55 +3253,137 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
lookup,
unregister,
removemanagee,
createshmem,
lookupshmem,
otherprocess,
Whitespace.NL ]
def makeShmemIface(self):
p = self.protocol
idvar = ExprVar('aId')
sizevar = ExprVar('aSize')
memvar = ExprVar('aMem')
rawvar = ExprVar('rawmem')
# bool AllocShmem(size_t size, Shmem* outmem):
# id_t id;
# nsAutoPtr<SharedMemory> mem(CreateSharedMemory(&id));
# if (!mem)
# nsAutoPtr<shmem_t> shmem(Shmem::Alloc(size));
# if (!shmem)
# return false
# shmemhandle_t handle;
# if (!shmem->ShareToProcess(subprocess, &handle))
# return false;
# *outmem = Shmem(shmem, id)
# Shmem::id_t id = RegisterShmem(shmem);
# Message* msg = new __internal__ipdl__ShmemCreated(
# mRoutingId, handle, id, size);
# if (!Send(msg))
# return false;
# *aMem = Shmem(shmem, id);
# return true;
sizevar = ExprVar('aSize')
memvar = ExprVar('aMem')
allocShmem = MethodDefn(MethodDecl(
'AllocShmem',
params=[ Decl(Type.SIZE, sizevar.name),
Decl(_shmemType(ptr=1), memvar.name) ],
ret=Type.BOOL))
ifallocfails = StmtIf(ExprNot(rawvar))
ifallocfails.addifstmt(StmtReturn(ExprLiteral.FALSE))
rawvar = ExprVar('rawmem')
allocShmem.addstmt(StmtDecl(
Decl(_autoptr(_rawShmemType()), rawvar.name),
initargs=[ _shmemAlloc(sizevar) ]))
failif = StmtIf(ExprNot(rawvar))
failif.addifstmt(StmtReturn(ExprLiteral.FALSE))
allocShmem.addstmt(failif)
handlevar = ExprVar('handle')
allocShmem.addstmt(StmtDecl(
Decl(_shmemHandleType(), handlevar.name)))
failif = StmtIf(ExprNot(ExprCall(
ExprSelect(rawvar, '->', 'ShareToProcess'),
args=[ ExprCall(p.otherProcessMethod()),
ExprAddrOf(handlevar) ])))
failif.addifstmt(StmtReturn(ExprLiteral.FALSE))
allocShmem.addstmt(failif)
allocShmem.addstmt(StmtDecl(
Decl(_shmemIdType(), idvar.name),
ExprCall(p.registerShmemVar(), args=[ rawvar ])))
msgvar = ExprVar('msg')
allocShmem.addstmt(StmtDecl(
Decl(Type('Message', ptr=1), msgvar.name),
ExprNew(Type(_shmemCreatedMsgVar().name),
args=[ p.routingId(), handlevar, idvar, sizevar ])))
failif = StmtIf(ExprNot(ExprCall(
ExprSelect(p.channelVar(), p.channelSel(), 'Send'),
args=[ msgvar ])))
failif.addifstmts([
StmtExpr(ExprCall(p.unregisterShmemVar(), args=[ idvar ])),
StmtReturn(ExprLiteral.FALSE)
])
allocShmem.addstmt(failif)
allocShmem.addstmts([
StmtDecl(Decl(_shmemIdType(), idvar.name)),
StmtDecl(Decl(_autoptr(_rawShmemType()), rawvar.name),
initargs=[ ExprCall(p.createSharedMemory(),
args=[ sizevar,
ExprAddrOf(idvar) ]) ]),
ifallocfails,
Whitespace.NL,
StmtExpr(ExprAssn(
ExprDeref(memvar), _shmemCtor(_autoptrForget(rawvar), idvar))),
StmtReturn(ExprLiteral.TRUE)
])
return [ Whitespace('// Methods for managing shmem\n', indent=1),
# TODO: DeallocShmem(). not needed until actors outlast their
# shmem mappings.
# This code is pretty similar to |implementManagerIface()|
lookupShmem = MethodDefn(MethodDecl(
p.lookupShmemVar().name,
params=[ Decl(_shmemIdType(), idvar.name) ],
ret=_rawShmemType(ptr=1)))
lookupShmem.addstmt(StmtReturn(ExprCall(
ExprSelect(p.shmemMapVar(), '.', 'Lookup'),
args=[ idvar ])))
mapvar = ExprVar('aMap')
tmpvar = ExprVar('tmp')
registerShmem = MethodDefn(MethodDecl(
p.registerShmemVar().name,
params=[ Decl(_rawShmemType(ptr=1), mapvar.name) ],
ret=_shmemIdType()))
registerShmem.addstmts([
StmtDecl(Decl(_shmemIdType(), tmpvar.name),
p.nextShmemIdExpr(self.side)),
StmtExpr(ExprCall(ExprSelect(p.shmemMapVar(), '.', 'AddWithID'),
[ mapvar, tmpvar ])),
StmtReturn(tmpvar)
])
registerShmemById = MethodDefn(MethodDecl(
p.registerShmemIdVar().name,
params=[ Decl(_rawShmemType(ptr=1), mapvar.name),
Decl(_shmemIdType(), idvar.name) ],
ret=_shmemIdType()))
registerShmemById.addstmts([
StmtExpr(ExprCall(ExprSelect(p.shmemMapVar(), '.', 'AddWithID'),
[ mapvar, idvar ])),
StmtReturn(idvar)
])
unregisterShmem = MethodDefn(MethodDecl(
p.unregisterShmemVar().name,
params=[ Decl(_shmemIdType(), idvar.name) ]))
unregisterShmem.addstmts([
StmtExpr(ExprCall(ExprSelect(p.shmemMapVar(), '.', 'Remove'),
args=[ idvar ]))
])
return [
Whitespace('// Methods for managing shmem\n', indent=1),
allocShmem,
Whitespace.NL ]
Whitespace.NL,
Label.PRIVATE,
lookupShmem,
registerShmem,
registerShmemById,
unregisterShmem,
Whitespace.NL
]
def genShmemCreatedHandler(self):
p = self.protocol
assert p.decl.type.isToplevel()
case = StmtBlock()
handlevar = ExprVar('handle')
@ -3403,8 +3414,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
case.addstmts([
failif,
StmtExpr(ExprCall(
ExprSelect(p.shmemMapVar(), '.', 'AddWithID'),
StmtExpr(ExprCall(self.protocol.registerShmemIdVar(),
args=[ _autoptrForget(rawvar), idvar ])),
Whitespace.NL,
StmtReturn(_Result.Processed)

Просмотреть файл

@ -208,13 +208,6 @@ nsResProtocolHandler::Init()
return rv;
}
void
nsResProtocolHandler::EnumerateSubstitutions(SubstitutionTable::EnumReadFunction enumFunc,
void* userArg)
{
mSubstitutions.EnumerateRead(enumFunc, userArg);
}
//----------------------------------------------------------------------------
// nsResProtocolHandler::nsISupports
//----------------------------------------------------------------------------

Просмотреть файл

@ -59,8 +59,6 @@ public:
class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
{
private:
typedef nsInterfaceHashtable<nsCStringHashKey,nsIURI> SubstitutionTable;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROTOCOLHANDLER
@ -71,12 +69,9 @@ public:
nsresult Init();
void EnumerateSubstitutions(SubstitutionTable::EnumReadFunction enumFunc,
void* userArg);
private:
nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution);
SubstitutionTable mSubstitutions;
nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions;
nsCOMPtr<nsIIOService> mIOService;
friend class nsResURL;

Просмотреть файл

@ -37,11 +37,6 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_IPC
#include "mozilla/dom/ContentProcessChild.h"
#include "mozilla/dom/ContentProcessParent.h"
#endif
#include "History.h"
#include "nsNavHistory.h"
@ -114,7 +109,27 @@ public:
NS_IMETHOD HandleCompletion(PRUint16 aReason)
{
History::GetService()->NotifyVisited(mURI, mIsVisited);
if (mIsVisited) {
History::GetService()->NotifyVisited(mURI);
}
// Notify any observers about that we have resolved the visited state of
// this URI.
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
if (observerService) {
nsAutoString status;
if (mIsVisited) {
status.AssignLiteral(URI_VISITED);
}
else {
status.AssignLiteral(URI_NOT_VISITED);
}
(void)observerService->NotifyObservers(mURI,
URI_VISITED_RESOLUTION_TOPIC,
status.get());
}
return NS_OK;
}
private:
@ -157,23 +172,10 @@ History::~History()
}
void
History::NotifyVisited(nsIURI* aURI, bool aIsVisited)
History::NotifyVisited(nsIURI* aURI)
{
NS_ASSERTION(aURI, "Ruh-roh! A NULL URI was passed to us!");
#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Default) {
mozilla::dom::ContentProcessParent * cpp =
mozilla::dom::ContentProcessParent::GetSingleton();
NS_ASSERTION(cpp, "Content Protocol is NULL!");
nsCString aURISpec;
aURI->GetSpec(aURISpec);
cpp->SendNotifyVisited(aURISpec, aIsVisited);
}
#endif
if (aIsVisited) {
// If the hash table has not been initialized, then we have nothing to notify
// about.
if (!mObservers.IsInitialized()) {
@ -199,25 +201,6 @@ History::NotifyVisited(nsIURI* aURI, bool aIsVisited)
// All the registered nodes can now be removed for this URI.
mObservers.RemoveEntry(aURI);
}
// Notify any observers about that we have resolved the visited state of
// this URI.
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
if (observerService) {
nsAutoString status;
if (aIsVisited) {
status.AssignLiteral(URI_VISITED);
}
else {
status.AssignLiteral(URI_NOT_VISITED);
}
(void)observerService->NotifyObservers(aURI,
URI_VISITED_RESOLUTION_TOPIC,
status.get());
}
}
/* static */
@ -255,15 +238,6 @@ NS_IMETHODIMP
History::RegisterVisitedCallback(nsIURI* aURI,
Link* aLink)
{
nsresult rv;
#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Default) {
rv = VisitedQuery::Start(aURI);
return rv;
}
#endif
NS_ASSERTION(aURI, "Must pass a non-null URI!");
NS_ASSERTION(aLink, "Must pass a non-null Link object!");
@ -287,19 +261,7 @@ History::RegisterVisitedCallback(nsIURI* aURI,
// We are the first Link node to ask about this URI, or there are no pending
// Links wanting to know about this URI. Therefore, we should query the
// database now.
#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mozilla::dom::ContentProcessChild * cpc =
mozilla::dom::ContentProcessChild::GetSingleton();
NS_ASSERTION(cpc, "Content Protocol is NULL!");
nsCString aURISpec;
aURI->GetSpec(aURISpec);
cpc->SendStartVisitedQuery(aURISpec, &rv);
}
#else
rv = VisitedQuery::Start(aURI);
#endif
nsresult rv = VisitedQuery::Start(aURI);
if (NS_FAILED(rv)) {
// Remove our array from the hashtable so we don't keep it around.
mObservers.RemoveEntry(aURI);

Просмотреть файл

@ -67,7 +67,7 @@ public:
* @param aURI
* The URI to notify about.
*/
void NotifyVisited(nsIURI *aURI, bool mIsVisited = true);
void NotifyVisited(nsIURI *aURI);
/**
* Obtains a pointer to this service.

Просмотреть файл

@ -50,11 +50,6 @@ EXPORT_LIBRARY = 1
MODULE_NAME = nsPlacesModule
IS_COMPONENT = 1
EXPORTS_NAMESPACES = mozilla/places
EXPORTS_mozilla/places = \
History.h \
$(NULL)
CPPSRCS = \
nsAnnoProtocolHandler.cpp \
@ -98,6 +93,4 @@ EXTRA_JS_MODULES = \
EXTRA_PP_JS_MODULES = utils.js
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -185,7 +185,6 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(topsrcdir)/dom/ipc \
-I$(topsrcdir)/toolkit/crashreporter \
-I$(topsrcdir)/chrome/src \
$(NULL)
ifdef BUILD_STATIC_LIBS

Просмотреть файл

@ -55,8 +55,6 @@
#include "nsIToolkitChromeRegistry.h"
#include "nsIToolkitProfile.h"
#include "nsChromeRegistry.h"
#if defined(OS_LINUX)
# define XP_LINUX
#endif
@ -92,7 +90,6 @@
#include "mozilla/dom/ContentProcessThread.h"
#include "mozilla/dom/ContentProcessParent.h"
#include "mozilla/dom/ContentProcessChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/ipc/TestShellParent.h"
#include "mozilla/ipc/XPCShellEnvironment.h"
@ -235,56 +232,6 @@ XRE_TermEmbedding()
delete gDirServiceProvider;
}
static nsresult
GetChromeRegistry(nsChromeRegistry* *aResult)
{
if(!nsChromeRegistry::gChromeRegistry)
{
// We don't actually want this ref, we just want the service to
// initialize if it hasn't already.
nsCOMPtr<nsIChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
NS_ENSURE_TRUE(nsChromeRegistry::gChromeRegistry, NS_ERROR_FAILURE);
}
*aResult = nsChromeRegistry::gChromeRegistry;
return NS_OK;
}
nsresult
XRE_SendParentChromeRegistry(mozilla::dom::TabParent* aParent)
{
nsChromeRegistry* chromeRegistry = nsnull;
nsresult rv = GetChromeRegistry(&chromeRegistry);
NS_ENSURE_SUCCESS(rv, rv);
chromeRegistry->SendRegisteredPackages(aParent);
return NS_OK;
}
nsresult
XRE_RegisterChromePackage(const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags)
{
nsChromeRegistry* chromeRegistry = nsnull;
nsresult rv = GetChromeRegistry(&chromeRegistry);
NS_ENSURE_SUCCESS(rv, rv);
chromeRegistry->RegisterPackage(aPackage, aBaseURI, aFlags);
return NS_OK;
}
nsresult
XRE_RegisterChromeResource(const nsString& aPackage,
const nsString& aResolvedURI)
{
nsChromeRegistry* chromeRegistry = nsnull;
nsresult rv = GetChromeRegistry(&chromeRegistry);
NS_ENSURE_SUCCESS(rv, rv);
chromeRegistry->RegisterResource(aPackage, aResolvedURI);
return NS_OK;
}
const char*
XRE_ChildProcessTypeToString(GeckoProcessType aProcessType)
{

Просмотреть файл

@ -105,8 +105,6 @@ _qimage_from_gfximage_format (gfxASurface::gfxImageFormat aFormat)
return QImage::Format_ARGB32_Premultiplied;
case gfxASurface::ImageFormatRGB24:
return QImage::Format_RGB32;
case gfxASurface::ImageFormatRGB16:
return QImage::Format_RGB16;
case gfxASurface::ImageFormatA8:
return QImage::Format_Indexed8;
case gfxASurface::ImageFormatA1:

Просмотреть файл

@ -186,10 +186,6 @@ nsWindow::nsWindow()
mSizeState = nsSizeMode_Normal;
mPluginType = PluginType_NONE;
mQCursor = Qt::ArrowCursor;
mNeedsResize = PR_FALSE;
mNeedsMove = PR_FALSE;
mListenForResizes = PR_FALSE;
mNeedsShow = PR_FALSE;
if (!gGlobalsInitialized) {
gGlobalsInitialized = PR_TRUE;
@ -215,8 +211,6 @@ _depth_to_gfximage_format(PRInt32 aDepth)
return gfxASurface::ImageFormatARGB32;
case 24:
return gfxASurface::ImageFormatRGB24;
case 16:
return gfxASurface::ImageFormatRGB16;
default:
return gfxASurface::ImageFormatUnknown;
}
@ -449,7 +443,7 @@ nsWindow::SetModal(PRBool aModal)
NS_IMETHODIMP
nsWindow::IsVisible(PRBool & aState)
{
aState = mIsShown;
aState = mWidget ? mWidget->isVisible() : PR_FALSE;
return NS_OK;
}
@ -670,8 +664,6 @@ nsWindow::Invalidate(const nsIntRect &aRect,
if (!mWidget)
return NS_OK;
mDirtyScrollArea = mDirtyScrollArea.united(QRect(aRect.x, aRect.y, aRect.width, aRect.height));
mWidget->update(aRect.x, aRect.y, aRect.width, aRect.height);
// QGraphicsItems cannot trigger a repaint themselves, so we start it on the view
@ -1122,8 +1114,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption)
gBufferImage->Width(),
gBufferImage->Height(),
gBufferImage->Stride(),
gBufferImage->Format() == gfxASurface::ImageFormatRGB16 ?
QImage::Format_RGB16 : QImage::Format_RGB32);
QImage::Format_RGB32);
aPainter->drawImage(QPoint(rect.x, rect.y), img,
QRect(0, 0, rect.width, rect.height));
}
@ -1834,9 +1825,10 @@ nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
aWidth, aHeight));
mNeedsResize = PR_FALSE;
mWidget->resize( aWidth, aHeight);
if (aRepaint)
mWidget->update();
}
void
@ -1847,10 +1839,10 @@ nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
LOG(("nsWindow::NativeResize [%p] %d %d %d %d\n", (void *)this,
aX, aY, aWidth, aHeight));
mNeedsResize = PR_FALSE;
mNeedsMove = PR_FALSE;
mWidget->setGeometry(aX, aY, aWidth, aHeight);
if (aRepaint)
mWidget->update();
}
void
@ -2298,16 +2290,9 @@ nsWindow::Show(PRBool aState)
if (!mWidget)
return NS_OK;
if (aState) {
if (mNeedsMove) {
NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height,
PR_FALSE);
} else if (mNeedsResize) {
NativeResize(mBounds.width, mBounds.height, PR_FALSE);
}
}
NativeShow(aState);
mWidget->setVisible(aState);
if (mWindowType == eWindowType_popup && aState)
Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, PR_FALSE);
return NS_OK;
}
@ -2321,33 +2306,16 @@ nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
if (!mWidget)
return NS_OK;
if (mIsShown) {
if (mIsTopLevel || mNeedsShow)
NativeResize(mBounds.x, mBounds.y,
mBounds.width, mBounds.height, aRepaint);
else
NativeResize(mBounds.width, mBounds.height, aRepaint);
mWidget->resize(aWidth, aHeight);
// Does it need to be shown because it was previously insane?
if (mNeedsShow)
NativeShow(PR_TRUE);
}
else if (mListenForResizes) {
// For widgets that we listen for resizes for (widgets created
// with native parents) we apparently _always_ have to resize. I
// dunno why, but apparently we're lame like that.
NativeResize(aWidth, aHeight, aRepaint);
}
else {
mNeedsResize = PR_TRUE;
if (mIsTopLevel) {
QWidget *widget = GetViewWidget();
if (widget)
widget->resize(aWidth, aHeight);
}
// synthesize a resize event if this isn't a toplevel
if (mIsTopLevel || mListenForResizes) {
nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
nsEventStatus status;
DispatchResizeEvent(rect, status);
}
if (aRepaint)
mWidget->update();
return NS_OK;
}
@ -2366,34 +2334,17 @@ nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
if (!mWidget)
return NS_OK;
// Has this widget been set to visible?
if (mIsShown) {
// Are the bounds sane?
// Yep? Resize the window
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
// Does it need to be shown because it was previously insane?
if (mNeedsShow)
NativeShow(PR_TRUE);
}
// If the widget hasn't been shown, mark the widget as needing to be
// resized before it is shown
else if (mListenForResizes) {
// For widgets that we listen for resizes for (widgets created
// with native parents) we apparently _always_ have to resize. I
// dunno why, but apparently we're lame like that.
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
}
else {
mNeedsResize = PR_TRUE;
mNeedsMove = PR_TRUE;
mWidget->setGeometry(aX, aY, aWidth, aHeight);
if (mIsTopLevel) {
QWidget *widget = GetViewWidget();
if (widget)
widget->resize(aWidth, aHeight);
}
if (mIsTopLevel || mListenForResizes) {
// synthesize a resize event
nsIntRect rect(aX, aY, aWidth, aHeight);
nsEventStatus status;
DispatchResizeEvent(rect, status);
}
if (aRepaint)
mWidget->update();
return NS_OK;
}

Просмотреть файл

@ -364,11 +364,6 @@ private:
}
PRInt32 mQCursor;
PRPackedBool mNeedsResize;
PRPackedBool mNeedsMove;
PRPackedBool mListenForResizes;
PRPackedBool mNeedsShow;
// Remember dirty area caused by ::Scroll
QRegion mDirtyScrollArea;

Просмотреть файл

@ -413,26 +413,6 @@ XRE_API(nsresult,
XRE_ParseAppData, (nsILocalFile* aINIFile,
nsXREAppData *aAppData))
namespace mozilla {
namespace dom {
class TabParent;
}
}
class nsString;
XRE_API(nsresult,
XRE_SendParentChromeRegistry, (mozilla::dom::TabParent* aParent))
XRE_API(nsresult,
XRE_RegisterChromePackage, (const nsString& aPackage,
const nsString& aBaseURI,
const PRUint32& aFlags))
XRE_API(nsresult,
XRE_RegisterChromeResource, (const nsString& aPackage,
const nsString& aResolvedURI))
/**
* Free a nsXREAppData structure that was allocated with XRE_CreateAppData.
*/