Bug 1235576 - Fix the indentation in dom/ipc, r=smaug

This commit is contained in:
Andrea Marchesini 2016-01-05 09:59:30 +00:00
Родитель 084b138ad2
Коммит 9b34c64d31
24 изменённых файлов: 7207 добавлений и 6720 удалений

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

@ -14,13 +14,14 @@ class CPOWManager;
} /* namespace jsipc */ } /* namespace jsipc */
namespace dom { namespace dom {
class CPOWManagerGetter class CPOWManagerGetter
{ {
public: public:
virtual mozilla::jsipc::CPOWManager* GetCPOWManager() = 0; virtual mozilla::jsipc::CPOWManager* GetCPOWManager() = 0;
}; };
} /* namespace dom */
} /* namespace dom */
} /* namespace mozilla */ } /* namespace mozilla */
#endif /* mozilla_dom_CPOWManagerGetter_h */ #endif /* mozilla_dom_CPOWManagerGetter_h */

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

@ -27,7 +27,7 @@ public:
virtual void ActorDestroy(ActorDestroyReason aWhy) override; virtual void ActorDestroy(ActorDestroyReason aWhy) override;
void DeferredDestroy(); void DeferredDestroy();
virtual bool IsContentBridgeParent() override { return true; } virtual bool IsContentBridgeParent() const override { return true; }
void NotifyTabDestroyed(); void NotifyTabDestroyed();
static ContentBridgeParent* static ContentBridgeParent*
@ -48,15 +48,15 @@ public:
jsipc::CPOWManager* GetCPOWManager() override; jsipc::CPOWManager* GetCPOWManager() override;
virtual ContentParentId ChildID() override virtual ContentParentId ChildID() const override
{ {
return mChildID; return mChildID;
} }
virtual bool IsForApp() override virtual bool IsForApp() const override
{ {
return mIsForApp; return mIsForApp;
} }
virtual bool IsForBrowser() override virtual bool IsForBrowser() const override
{ {
return mIsForBrowser; return mIsForBrowser;
} }
@ -68,27 +68,32 @@ protected:
{ {
mChildID = aId; mChildID = aId;
} }
void SetIsForApp(bool aIsForApp) void SetIsForApp(bool aIsForApp)
{ {
mIsForApp = aIsForApp; mIsForApp = aIsForApp;
} }
void SetIsForBrowser(bool aIsForBrowser) void SetIsForBrowser(bool aIsForBrowser)
{ {
mIsForBrowser = aIsForBrowser; mIsForBrowser = aIsForBrowser;
} }
protected: protected:
virtual bool RecvSyncMessage(const nsString& aMsg, virtual bool
const ClonedMessageData& aData, RecvSyncMessage(const nsString& aMsg,
InfallibleTArray<jsipc::CpowEntry>&& aCpows, const ClonedMessageData& aData,
const IPC::Principal& aPrincipal, InfallibleTArray<jsipc::CpowEntry>&& aCpows,
nsTArray<StructuredCloneData>* aRetvals) override; const IPC::Principal& aPrincipal,
nsTArray<StructuredCloneData>* aRetvals) override;
virtual bool RecvAsyncMessage(const nsString& aMsg, virtual bool RecvAsyncMessage(const nsString& aMsg,
const ClonedMessageData& aData, const ClonedMessageData& aData,
InfallibleTArray<jsipc::CpowEntry>&& aCpows, InfallibleTArray<jsipc::CpowEntry>&& aCpows,
const IPC::Principal& aPrincipal) override; const IPC::Principal& aPrincipal) override;
virtual jsipc::PJavaScriptParent* AllocPJavaScriptParent() override; virtual jsipc::PJavaScriptParent* AllocPJavaScriptParent() override;
virtual bool virtual bool
DeallocPJavaScriptParent(jsipc::PJavaScriptParent*) override; DeallocPJavaScriptParent(jsipc::PJavaScriptParent*) override;
@ -99,6 +104,7 @@ protected:
const ContentParentId& aCpID, const ContentParentId& aCpID,
const bool& aIsForApp, const bool& aIsForApp,
const bool& aIsForBrowser) override; const bool& aIsForBrowser) override;
virtual bool DeallocPBrowserParent(PBrowserParent*) override; virtual bool DeallocPBrowserParent(PBrowserParent*) override;
virtual PBlobParent* virtual PBlobParent*

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

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

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

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

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

@ -20,26 +20,26 @@ namespace dom {
*/ */
class ContentProcess : public mozilla::ipc::ProcessChild class ContentProcess : public mozilla::ipc::ProcessChild
{ {
typedef mozilla::ipc::ProcessChild ProcessChild; typedef mozilla::ipc::ProcessChild ProcessChild;
public: public:
explicit ContentProcess(ProcessId aParentPid) explicit ContentProcess(ProcessId aParentPid)
: ProcessChild(aParentPid) : ProcessChild(aParentPid)
{ } { }
~ContentProcess() ~ContentProcess()
{ } { }
virtual bool Init() override; virtual bool Init() override;
virtual void CleanUp() override; virtual void CleanUp() override;
void SetAppDir(const nsACString& aPath); void SetAppDir(const nsACString& aPath);
private: private:
ContentChild mContent; ContentChild mContent;
mozilla::ipc::ScopedXREEmbed mXREEmbed; mozilla::ipc::ScopedXREEmbed mXREEmbed;
DISALLOW_EVIL_CONSTRUCTORS(ContentProcess); DISALLOW_EVIL_CONSTRUCTORS(ContentProcess);
}; };
} // namespace dom } // namespace dom

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

@ -74,8 +74,9 @@ public:
/** /**
* Allocate a tab id for the given content process's id. * Allocate a tab id for the given content process's id.
* Used when a content process wants to create a new tab. aOpenerTabId and * Used when a content process wants to create a new tab. aOpenerTabId and
* aContext are saved in RemoteFrameInfo, which is a part of ContentProcessInfo. * aContext are saved in RemoteFrameInfo, which is a part of
* We can use the tab id and process id to locate the TabContext for future use. * ContentProcessInfo. We can use the tab id and process id to locate the
* TabContext for future use.
*/ */
TabId AllocateTabId(const TabId& aOpenerTabId, TabId AllocateTabId(const TabId& aOpenerTabId,
const IPCTabContext& aContext, const IPCTabContext& aContext,
@ -162,4 +163,4 @@ private:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif #endif // mozilla_dom_ContentProcessManager_h

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

@ -11,18 +11,19 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class CrashReporterChild :
public PCrashReporterChild
{
public:
CrashReporterChild() {
MOZ_COUNT_CTOR(CrashReporterChild);
}
~CrashReporterChild() {
MOZ_COUNT_DTOR(CrashReporterChild);
}
static PCrashReporterChild* GetCrashReporter(); class CrashReporterChild :
public PCrashReporterChild
{
public:
CrashReporterChild() {
MOZ_COUNT_CTOR(CrashReporterChild);
}
~CrashReporterChild() {
MOZ_COUNT_DTOR(CrashReporterChild);
}
static PCrashReporterChild* GetCrashReporter();
}; };
} // namespace dom } // namespace dom

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

@ -26,7 +26,7 @@ CrashReporterParent::AnnotateCrashReport(const nsCString& key,
const nsCString& data) const nsCString& data)
{ {
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
mNotes.Put(key, data); mNotes.Put(key, data);
#endif #endif
} }
@ -39,8 +39,8 @@ CrashReporterParent::ActorDestroy(ActorDestroyReason aWhy)
bool bool
CrashReporterParent::RecvAppendAppNotes(const nsCString& data) CrashReporterParent::RecvAppendAppNotes(const nsCString& data)
{ {
mAppNotes.Append(data); mAppNotes.Append(data);
return true; return true;
} }
mozilla::ipc::IProtocol* mozilla::ipc::IProtocol*
@ -48,186 +48,188 @@ CrashReporterParent::CloneProtocol(Channel* aChannel,
mozilla::ipc::ProtocolCloneContext* aCtx) mozilla::ipc::ProtocolCloneContext* aCtx)
{ {
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
ContentParent* contentParent = aCtx->GetContentParent(); ContentParent* contentParent = aCtx->GetContentParent();
CrashReporter::ThreadId childThreadId = contentParent->Pid(); CrashReporter::ThreadId childThreadId = contentParent->Pid();
GeckoProcessType childProcessType = GeckoProcessType childProcessType =
contentParent->Process()->GetProcessType(); contentParent->Process()->GetProcessType();
nsAutoPtr<PCrashReporterParent> actor( nsAutoPtr<PCrashReporterParent> actor(
contentParent->AllocPCrashReporterParent(childThreadId, contentParent->AllocPCrashReporterParent(childThreadId,
childProcessType) childProcessType)
); );
if (!actor || if (!actor ||
!contentParent->RecvPCrashReporterConstructor(actor, !contentParent->RecvPCrashReporterConstructor(actor,
childThreadId, childThreadId,
childThreadId)) { childThreadId)) {
return nullptr;
}
return actor.forget();
#else
MOZ_CRASH("Not Implemented");
return nullptr; return nullptr;
}
return actor.forget();
#else
MOZ_CRASH("Not Implemented");
return nullptr;
#endif #endif
} }
CrashReporterParent::CrashReporterParent() CrashReporterParent::CrashReporterParent()
: :
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
mNotes(4), mNotes(4),
#endif #endif
mStartTime(::time(nullptr)) mStartTime(::time(nullptr))
, mInitialized(false) , mInitialized(false)
{ {
MOZ_COUNT_CTOR(CrashReporterParent); MOZ_COUNT_CTOR(CrashReporterParent);
} }
CrashReporterParent::~CrashReporterParent() CrashReporterParent::~CrashReporterParent()
{ {
MOZ_COUNT_DTOR(CrashReporterParent); MOZ_COUNT_DTOR(CrashReporterParent);
} }
void void
CrashReporterParent::SetChildData(const NativeThreadId& tid, CrashReporterParent::SetChildData(const NativeThreadId& tid,
const uint32_t& processType) const uint32_t& processType)
{ {
mInitialized = true; mInitialized = true;
mMainThread = tid; mMainThread = tid;
mProcessType = processType; mProcessType = processType;
} }
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
bool bool
CrashReporterParent::GenerateCrashReportForMinidump(nsIFile* minidump, CrashReporterParent::GenerateCrashReportForMinidump(nsIFile* minidump,
const AnnotationTable* processNotes) const AnnotationTable* processNotes)
{ {
if (!CrashReporter::GetIDFromMinidump(minidump, mChildDumpID)) if (!CrashReporter::GetIDFromMinidump(minidump, mChildDumpID)) {
return false; return false;
bool result = GenerateChildData(processNotes); }
FinalizeChildData();
return result; bool result = GenerateChildData(processNotes);
FinalizeChildData();
return result;
} }
bool bool
CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes) CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
{ {
MOZ_ASSERT(mInitialized); MOZ_ASSERT(mInitialized);
if (mChildDumpID.IsEmpty()) { if (mChildDumpID.IsEmpty()) {
NS_WARNING("problem with GenerateChildData: no child dump id yet!"); NS_WARNING("problem with GenerateChildData: no child dump id yet!");
return false; return false;
} }
nsAutoCString type; nsAutoCString type;
switch (mProcessType) { switch (mProcessType) {
case GeckoProcessType_Content: case GeckoProcessType_Content:
type = NS_LITERAL_CSTRING("content"); type = NS_LITERAL_CSTRING("content");
break; break;
case GeckoProcessType_Plugin: case GeckoProcessType_Plugin:
case GeckoProcessType_GMPlugin: case GeckoProcessType_GMPlugin:
type = NS_LITERAL_CSTRING("plugin"); type = NS_LITERAL_CSTRING("plugin");
break; break;
default: default:
NS_ERROR("unknown process type"); NS_ERROR("unknown process type");
break; break;
} }
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type); mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
char startTime[32]; char startTime[32];
snprintf_literal(startTime, "%lld", static_cast<long long>(mStartTime)); snprintf_literal(startTime, "%lld", static_cast<long long>(mStartTime));
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime)); mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
if (!mAppNotes.IsEmpty()) { if (!mAppNotes.IsEmpty()) {
mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes); mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);
} }
// Append these notes to the end of the extra file based on the current // Append these notes to the end of the extra file based on the current
// dump id we obtained from CreatePairedMinidumps. // dump id we obtained from CreatePairedMinidumps.
bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes); bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
if (ret && processNotes) { if (ret && processNotes) {
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes); ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
} }
if (!ret) { if (!ret) {
NS_WARNING("problem appending child data to .extra"); NS_WARNING("problem appending child data to .extra");
} }
return ret; return ret;
} }
void void
CrashReporterParent::FinalizeChildData() CrashReporterParent::FinalizeChildData()
{ {
MOZ_ASSERT(mInitialized); MOZ_ASSERT(mInitialized);
if (NS_IsMainThread()) { if (NS_IsMainThread()) {
// Inline, this is the main thread. Get this done. // Inline, this is the main thread. Get this done.
NotifyCrashService(); NotifyCrashService();
return; return;
}
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
class NotifyOnMainThread : public nsRunnable
{
public:
explicit NotifyOnMainThread(CrashReporterParent* aCR)
: mCR(aCR)
{ }
NS_IMETHOD Run() {
mCR->NotifyCrashService();
return NS_OK;
} }
private:
nsCOMPtr<nsIThread> mainThread = do_GetMainThread(); CrashReporterParent* mCR;
class NotifyOnMainThread : public nsRunnable };
{ SyncRunnable::DispatchToThread(mainThread, new NotifyOnMainThread(this));
public:
explicit NotifyOnMainThread(CrashReporterParent* aCR)
: mCR(aCR)
{ }
NS_IMETHOD Run() {
mCR->NotifyCrashService();
return NS_OK;
}
private:
CrashReporterParent* mCR;
};
SyncRunnable::DispatchToThread(mainThread, new NotifyOnMainThread(this));
} }
void void
CrashReporterParent::NotifyCrashService() CrashReporterParent::NotifyCrashService()
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mChildDumpID.IsEmpty()); MOZ_ASSERT(!mChildDumpID.IsEmpty());
nsCOMPtr<nsICrashService> crashService = nsCOMPtr<nsICrashService> crashService =
do_GetService("@mozilla.org/crashservice;1"); do_GetService("@mozilla.org/crashservice;1");
if (!crashService) { if (!crashService) {
return; return;
}
int32_t processType;
int32_t crashType = nsICrashService::CRASH_TYPE_CRASH;
nsCString telemetryKey;
switch (mProcessType) {
case GeckoProcessType_Content:
processType = nsICrashService::PROCESS_TYPE_CONTENT;
telemetryKey.AssignLiteral("content");
break;
case GeckoProcessType_Plugin: {
processType = nsICrashService::PROCESS_TYPE_PLUGIN;
telemetryKey.AssignLiteral("plugin");
nsAutoCString val;
if (mNotes.Get(NS_LITERAL_CSTRING("PluginHang"), &val) &&
val.Equals(NS_LITERAL_CSTRING("1"))) {
crashType = nsICrashService::CRASH_TYPE_HANG;
telemetryKey.AssignLiteral("pluginhang");
}
break;
} }
case GeckoProcessType_GMPlugin:
processType = nsICrashService::PROCESS_TYPE_GMPLUGIN;
telemetryKey.AssignLiteral("gmplugin");
break;
default:
NS_ERROR("unknown process type");
return;
}
int32_t processType; crashService->AddCrash(processType, crashType, mChildDumpID);
int32_t crashType = nsICrashService::CRASH_TYPE_CRASH; Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1);
mNotes.Clear();
nsCString telemetryKey;
switch (mProcessType) {
case GeckoProcessType_Content:
processType = nsICrashService::PROCESS_TYPE_CONTENT;
telemetryKey.AssignLiteral("content");
break;
case GeckoProcessType_Plugin: {
processType = nsICrashService::PROCESS_TYPE_PLUGIN;
telemetryKey.AssignLiteral("plugin");
nsAutoCString val;
if (mNotes.Get(NS_LITERAL_CSTRING("PluginHang"), &val) &&
val.Equals(NS_LITERAL_CSTRING("1"))) {
crashType = nsICrashService::CRASH_TYPE_HANG;
telemetryKey.AssignLiteral("pluginhang");
}
break;
}
case GeckoProcessType_GMPlugin:
processType = nsICrashService::PROCESS_TYPE_GMPLUGIN;
telemetryKey.AssignLiteral("gmplugin");
break;
default:
NS_ERROR("unknown process type");
return;
}
crashService->AddCrash(processType, crashType, mChildDumpID);
Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1);
mNotes.Clear();
} }
#endif #endif

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

@ -18,8 +18,7 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class CrashReporterParent : class CrashReporterParent : public PCrashReporterParent
public PCrashReporterParent
{ {
#ifdef MOZ_CRASHREPORTER #ifdef MOZ_CRASHREPORTER
typedef CrashReporter::AnnotationTable AnnotationTable; typedef CrashReporter::AnnotationTable AnnotationTable;
@ -137,7 +136,7 @@ public:
* Returns the ID of the child minidump. * Returns the ID of the child minidump.
* GeneratePairedMinidump or GenerateCrashReport must be called first. * GeneratePairedMinidump or GenerateCrashReport must be called first.
*/ */
const nsString& ChildDumpID() { const nsString& ChildDumpID() const {
return mChildDumpID; return mChildDumpID;
} }
@ -147,18 +146,20 @@ public:
* the notes will get dropped. * the notes will get dropped.
*/ */
void void
AnnotateCrashReport(const nsCString& key, const nsCString& data); AnnotateCrashReport(const nsCString& aKey, const nsCString& aData);
protected: protected:
virtual void ActorDestroy(ActorDestroyReason aWhy) override; virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual bool virtual bool RecvAnnotateCrashReport(const nsCString& aKey,
RecvAnnotateCrashReport(const nsCString& key, const nsCString& data) override { const nsCString& aData) override
AnnotateCrashReport(key, data); {
AnnotateCrashReport(aKey, aData);
return true; return true;
} }
virtual bool
RecvAppendAppNotes(const nsCString& data) override; virtual bool RecvAppendAppNotes(const nsCString& aData) override;
virtual mozilla::ipc::IProtocol* virtual mozilla::ipc::IProtocol*
CloneProtocol(Channel* aChannel, CloneProtocol(Channel* aChannel,
mozilla::ipc::ProtocolCloneContext *aCtx) override; mozilla::ipc::ProtocolCloneContext *aCtx) override;
@ -217,7 +218,8 @@ CrashReporterParent::GenerateMinidumpAndPair(Toplevel* aTopLevel,
#ifdef XP_MACOSX #ifdef XP_MACOSX
childHandle = aTopLevel->Process()->GetChildTask(); childHandle = aTopLevel->Process()->GetChildTask();
#else #else
if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(), &childHandle.rwget())) { if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(),
&childHandle.rwget())) {
NS_WARNING("Failed to open child process handle."); NS_WARNING("Failed to open child process handle.");
return false; return false;
} }

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

@ -68,7 +68,8 @@ class FilePickerParent : public PFilePickerParent
nsCOMPtr<nsIEventTarget> mEventTarget; nsCOMPtr<nsIEventTarget> mEventTarget;
public: public:
FileSizeAndDateRunnable(FilePickerParent *aFPParent, nsTArray<RefPtr<BlobImpl>>& aBlobs); FileSizeAndDateRunnable(FilePickerParent *aFPParent,
nsTArray<RefPtr<BlobImpl>>& aBlobs);
bool Dispatch(); bool Dispatch();
NS_IMETHOD Run(); NS_IMETHOD Run();
void Destroy(); void Destroy();
@ -86,4 +87,4 @@ class FilePickerParent : public PFilePickerParent
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif #endif // mozilla_dom_FilePickerParent_h

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

@ -22,7 +22,6 @@ class TabParent;
template<typename T> template<typename T>
class IdType class IdType
{ {
friend struct IPC::ParamTraits<IdType<T>>; friend struct IPC::ParamTraits<IdType<T>>;
public: public:
@ -71,4 +70,4 @@ struct ParamTraits<mozilla::dom::IdType<T>>
} // namespace IPC } // namespace IPC
#endif #endif // mozilla_dom_IdType_h

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

@ -30,5 +30,4 @@ private:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif #endif // mozilla_dom_NuwaChild_h

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

@ -70,4 +70,4 @@ private:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif #endif // mozilla_dom_NuwaParent_h

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

@ -13,12 +13,19 @@
namespace IPC { namespace IPC {
class Principal { class Principal
{
friend struct ParamTraits<Principal>; friend struct ParamTraits<Principal>;
public: public:
Principal() : mPrincipal(nullptr) {} Principal()
explicit Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {} : mPrincipal(nullptr)
{}
explicit Principal(nsIPrincipal* aPrincipal)
: mPrincipal(aPrincipal)
{}
operator nsIPrincipal*() const { return mPrincipal.get(); } operator nsIPrincipal*() const { return mPrincipal.get(); }
private: private:

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

@ -1210,7 +1210,7 @@ TabChild::SetProcessNameToAppName()
} }
bool bool
TabChild::IsRootContentDocument() TabChild::IsRootContentDocument() const
{ {
// A TabChild is a "root content document" if it's // A TabChild is a "root content document" if it's
// //

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

@ -162,56 +162,56 @@ protected:
TabChild* mTabChild; TabChild* mTabChild;
}; };
// This is base clase which helps to share Viewport and touch related functionality // This is base clase which helps to share Viewport and touch related
// between b2g/android FF/embedlite clients implementation. // functionality between b2g/android FF/embedlite clients implementation.
// It make sense to place in this class all helper functions, and functionality which could be shared between // It make sense to place in this class all helper functions, and functionality
// Cross-process/Cross-thread implmentations. // which could be shared between Cross-process/Cross-thread implmentations.
class TabChildBase : public nsISupports, class TabChildBase : public nsISupports,
public nsMessageManagerScriptExecutor, public nsMessageManagerScriptExecutor,
public ipc::MessageManagerCallback public ipc::MessageManagerCallback
{ {
protected: protected:
typedef mozilla::widget::PuppetWidget PuppetWidget; typedef mozilla::widget::PuppetWidget PuppetWidget;
public: public:
TabChildBase(); TabChildBase();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TabChildBase) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TabChildBase)
virtual nsIWebNavigation* WebNavigation() const = 0; virtual nsIWebNavigation* WebNavigation() const = 0;
virtual PuppetWidget* WebWidget() = 0; virtual PuppetWidget* WebWidget() = 0;
nsIPrincipal* GetPrincipal() { return mPrincipal; } nsIPrincipal* GetPrincipal() { return mPrincipal; }
virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId, virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId,
const mozilla::layers::FrameMetrics::ViewID& aViewId, const mozilla::layers::FrameMetrics::ViewID& aViewId,
const Maybe<mozilla::layers::ZoomConstraints>& aConstraints) = 0; const Maybe<mozilla::layers::ZoomConstraints>& aConstraints) = 0;
virtual ScreenIntSize GetInnerSize() = 0; virtual ScreenIntSize GetInnerSize() = 0;
// Get the Document for the top-level window in this tab. // Get the Document for the top-level window in this tab.
already_AddRefed<nsIDocument> GetDocument() const; already_AddRefed<nsIDocument> GetDocument() const;
protected: protected:
virtual ~TabChildBase(); virtual ~TabChildBase();
// Get the pres-shell of the document for the top-level window in this tab. // Get the pres-shell of the document for the top-level window in this tab.
already_AddRefed<nsIPresShell> GetPresShell() const; already_AddRefed<nsIPresShell> GetPresShell() const;
// Wraps up a JSON object as a structured clone and sends it to the browser // Wraps up a JSON object as a structured clone and sends it to the browser
// chrome script. // chrome script.
// //
// XXX/bug 780335: Do the work the browser chrome script does in C++ instead // XXX/bug 780335: Do the work the browser chrome script does in C++ instead
// so we don't need things like this. // so we don't need things like this.
void DispatchMessageManagerMessage(const nsAString& aMessageName, void DispatchMessageManagerMessage(const nsAString& aMessageName,
const nsAString& aJSONData); const nsAString& aJSONData);
void ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics); void ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
bool UpdateFrameHandler(const mozilla::layers::FrameMetrics& aFrameMetrics); bool UpdateFrameHandler(const mozilla::layers::FrameMetrics& aFrameMetrics);
protected: protected:
RefPtr<TabChildGlobal> mTabChildGlobal; RefPtr<TabChildGlobal> mTabChildGlobal;
nsCOMPtr<nsIWebBrowserChrome3> mWebBrowserChrome; nsCOMPtr<nsIWebBrowserChrome3> mWebBrowserChrome;
}; };
class TabChild final : public TabChildBase, class TabChild final : public TabChildBase,
@ -227,415 +227,499 @@ class TabChild final : public TabChildBase,
public TabContext, public TabContext,
public nsITooltipListener public nsITooltipListener
{ {
typedef mozilla::dom::ClonedMessageData ClonedMessageData; typedef mozilla::dom::ClonedMessageData ClonedMessageData;
typedef mozilla::layout::RenderFrameChild RenderFrameChild; typedef mozilla::layout::RenderFrameChild RenderFrameChild;
typedef mozilla::layers::APZEventState APZEventState; typedef mozilla::layers::APZEventState APZEventState;
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback; typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
public: public:
/** /**
* Find TabChild of aTabId in the same content process of the * Find TabChild of aTabId in the same content process of the
* caller. * caller.
*/ */
static already_AddRefed<TabChild> FindTabChild(const TabId& aTabId); static already_AddRefed<TabChild> FindTabChild(const TabId& aTabId);
public: public:
/** /**
* Create a new TabChild object. * Create a new TabChild object.
*/ */
TabChild(nsIContentChild* aManager, TabChild(nsIContentChild* aManager,
const TabId& aTabId, const TabId& aTabId,
const TabContext& aContext, const TabContext& aContext,
uint32_t aChromeFlags); uint32_t aChromeFlags);
nsresult Init(); nsresult Init();
/** /**
* This is expected to be called off the critical path to content * This is expected to be called off the critical path to content
* startup. This is an opportunity to load things that are slow * startup. This is an opportunity to load things that are slow
* on the critical path. * on the critical path.
*/ */
static void PreloadSlowThings(); static void PreloadSlowThings();
/** Return a TabChild with the given attributes. */ /** Return a TabChild with the given attributes. */
static already_AddRefed<TabChild> static already_AddRefed<TabChild>
Create(nsIContentChild* aManager, const TabId& aTabId, const TabContext& aContext, uint32_t aChromeFlags); Create(nsIContentChild* aManager, const TabId& aTabId,
const TabContext& aContext, uint32_t aChromeFlags);
bool IsRootContentDocument(); bool IsRootContentDocument() const;
// Let managees query if it is safe to send messages.
bool IsDestroyed() { return mDestroyed; }
const TabId GetTabId() const {
MOZ_ASSERT(mUniqueId != 0);
return mUniqueId;
}
NS_DECL_ISUPPORTS_INHERITED // Let managees query if it is safe to send messages.
NS_DECL_NSIWEBBROWSERCHROME bool IsDestroyed() const{ return mDestroyed; }
NS_DECL_NSIWEBBROWSERCHROME2
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWINDOWPROVIDER
NS_DECL_NSITABCHILD
NS_DECL_NSIOBSERVER
NS_DECL_NSITOOLTIPLISTENER
/** const TabId GetTabId() const
* MessageManagerCallback methods that we override. {
*/ MOZ_ASSERT(mUniqueId != 0);
virtual bool DoSendBlockingMessage(JSContext* aCx, return mUniqueId;
const nsAString& aMessage, }
StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
nsIPrincipal* aPrincipal,
nsTArray<StructuredCloneData>* aRetVal,
bool aIsSync) override;
virtual nsresult DoSendAsyncMessage(JSContext* aCx,
const nsAString& aMessage,
StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
nsIPrincipal* aPrincipal) override;
virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId,
const ViewID& aViewId,
const Maybe<ZoomConstraints>& aConstraints) override;
virtual bool RecvLoadURL(const nsCString& aURI,
const BrowserConfiguration& aConfiguration,
const ShowInfo& aInfo) override;
virtual bool RecvOpenURI(const URIParams& aURI,
const uint32_t& aFlags) override;
virtual bool RecvCacheFileDescriptor(const nsString& aPath,
const FileDescriptor& aFileDescriptor)
override;
virtual bool RecvShow(const ScreenIntSize& aSize,
const ShowInfo& aInfo,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const CSSRect& rect,
const CSSSize& size,
const nsSizeMode& sizeMode,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
const CSSPoint& aDestination) override;
virtual bool RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
const uint32_t& aScrollGeneration) override;
virtual bool RecvHandleDoubleTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) override;
virtual bool RecvHandleSingleTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) override;
virtual bool RecvHandleLongTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg) override;
virtual bool RecvNotifyFlushComplete() override;
virtual bool RecvActivate() override;
virtual bool RecvDeactivate() override;
virtual bool RecvMouseEvent(const nsString& aType,
const float& aX,
const float& aY,
const int32_t& aButton,
const int32_t& aClickCount,
const int32_t& aModifiers,
const bool& aIgnoreRootScrollFrame) override;
virtual bool RecvRealMouseMoveEvent(const mozilla::WidgetMouseEvent& event,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvSynthMouseMoveEvent(const mozilla::WidgetMouseEvent& event,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvRealMouseButtonEvent(const mozilla::WidgetMouseEvent& event,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvRealDragEvent(const WidgetDragEvent& aEvent,
const uint32_t& aDragAction,
const uint32_t& aDropEffect) override;
virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event,
const MaybeNativeKeyBinding& aBindings) override;
virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvKeyEvent(const nsString& aType,
const int32_t& aKeyCode,
const int32_t& aCharCode,
const int32_t& aModifiers,
const bool& aPreventDefault) override;
virtual bool RecvMouseScrollTestEvent(const FrameMetrics::ViewID& aScrollId,
const nsString& aEvent) override;
virtual bool RecvNativeSynthesisResponse(const uint64_t& aObserverId,
const nsCString& aResponse) override;
virtual bool RecvPluginEvent(const WidgetPluginEvent& aEvent) override;
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event) override;
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event) override;
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture) override;
virtual bool RecvLoadRemoteScript(const nsString& aURL,
const bool& aRunInGlobalScope) override;
virtual bool RecvAsyncMessage(const nsString& aMessage,
const ClonedMessageData& aData,
InfallibleTArray<CpowEntry>&& aCpows,
const IPC::Principal& aPrincipal) override;
virtual bool RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline) override; NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROME2
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWINDOWPROVIDER
NS_DECL_NSITABCHILD
NS_DECL_NSIOBSERVER
NS_DECL_NSITOOLTIPLISTENER
virtual bool RecvSwappedWithOtherRemoteLoader() override; /**
* MessageManagerCallback methods that we override.
*/
virtual bool DoSendBlockingMessage(JSContext* aCx,
const nsAString& aMessage,
StructuredCloneData& aData,
JS::Handle<JSObject *> aCpows,
nsIPrincipal* aPrincipal,
nsTArray<StructuredCloneData>* aRetVal,
bool aIsSync) override;
virtual PDocAccessibleChild* AllocPDocAccessibleChild(PDocAccessibleChild*, virtual nsresult DoSendAsyncMessage(JSContext* aCx,
const uint64_t&) const nsAString& aMessage,
override; StructuredCloneData& aData,
virtual bool DeallocPDocAccessibleChild(PDocAccessibleChild*) override; JS::Handle<JSObject *> aCpows,
virtual PDocumentRendererChild* nsIPrincipal* aPrincipal) override;
AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform,
const nsString& bgcolor,
const uint32_t& renderFlags, const bool& flushLayout,
const nsIntSize& renderSize) override;
virtual bool DeallocPDocumentRendererChild(PDocumentRendererChild* actor) override;
virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
const nsRect& documentRect,
const gfx::Matrix& transform,
const nsString& bgcolor,
const uint32_t& renderFlags,
const bool& flushLayout,
const nsIntSize& renderSize) override;
virtual PColorPickerChild* virtual bool
AllocPColorPickerChild(const nsString& title, const nsString& initialColor) override; DoUpdateZoomConstraints(const uint32_t& aPresShellId,
virtual bool DeallocPColorPickerChild(PColorPickerChild* actor) override; const ViewID& aViewId,
const Maybe<ZoomConstraints>& aConstraints) override;
virtual PFilePickerChild* virtual bool RecvLoadURL(const nsCString& aURI,
AllocPFilePickerChild(const nsString& aTitle, const int16_t& aMode) override; const BrowserConfiguration& aConfiguration,
virtual bool const ShowInfo& aInfo) override;
DeallocPFilePickerChild(PFilePickerChild* actor) override;
virtual PIndexedDBPermissionRequestChild* virtual bool RecvOpenURI(const URIParams& aURI,
AllocPIndexedDBPermissionRequestChild(const Principal& aPrincipal) const uint32_t& aFlags) override;
override;
virtual bool virtual bool RecvCacheFileDescriptor(const nsString& aPath,
DeallocPIndexedDBPermissionRequestChild( const FileDescriptor& aFileDescriptor)
PIndexedDBPermissionRequestChild* aActor)
override; override;
virtual nsIWebNavigation* WebNavigation() const override { return mWebNav; } virtual bool
virtual PuppetWidget* WebWidget() override { return mPuppetWidget; } RecvShow(const ScreenIntSize& aSize,
const ShowInfo& aInfo,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const bool& aParentIsActive) override;
/** Return the DPI of the widget this TabChild draws to. */ virtual bool
void GetDPI(float* aDPI); RecvUpdateDimensions(const CSSRect& aRect,
void GetDefaultScale(double *aScale); const CSSSize& aSize,
const nsSizeMode& aSizeMode,
const ScreenOrientationInternal& aOrientation,
const LayoutDeviceIntPoint& aChromeDisp) override;
void GetMaxTouchPoints(uint32_t* aTouchPoints); virtual bool
RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
ScreenOrientationInternal GetOrientation() const { return mOrientation; } virtual bool
RecvRequestFlingSnap(const ViewID& aScrollId,
const CSSPoint& aDestination) override;
void SetBackgroundColor(const nscolor& aColor); virtual bool
RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
const uint32_t& aScrollGeneration) override;
void NotifyPainted(); virtual bool
RecvHandleDoubleTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) override;
void RequestNativeKeyBindings(mozilla::widget::AutoCacheNativeKeyCommands* aAutoCache, virtual bool
WidgetKeyboardEvent* aEvent); RecvHandleSingleTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid) override;
/** virtual bool
* Signal to this TabChild that it should be made visible: RecvHandleLongTap(const CSSPoint& aPoint,
* activated widget, retained layer tree, etc. (Respectively, const Modifiers& aModifiers,
* made not visible.) const mozilla::layers::ScrollableLayerGuid& aGuid,
*/ const uint64_t& aInputBlockId) override;
void MakeVisible();
void MakeHidden();
// Returns true if the file descriptor was found in the cache, false virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
// otherwise. const APZStateChange& aChange,
bool GetCachedFileDescriptor(const nsAString& aPath, const int& aArg) override;
nsICachedFileDescriptorListener* aCallback);
void CancelCachedFileDescriptorCallback( virtual bool RecvNotifyFlushComplete() override;
const nsAString& aPath,
nsICachedFileDescriptorListener* aCallback);
nsIContentChild* Manager() { return mManager; } virtual bool RecvActivate() override;
bool GetUpdateHitRegion() { return mUpdateHitRegion; } virtual bool RecvDeactivate() override;
void UpdateHitRegion(const nsRegion& aRegion); virtual bool RecvMouseEvent(const nsString& aType,
const float& aX,
const float& aY,
const int32_t& aButton,
const int32_t& aClickCount,
const int32_t& aModifiers,
const bool& aIgnoreRootScrollFrame) override;
static inline TabChild* virtual bool RecvRealMouseMoveEvent(const mozilla::WidgetMouseEvent& aEvent,
GetFrom(nsIDocShell* aDocShell) const ScrollableLayerGuid& aGuid,
{ const uint64_t& aInputBlockId) override;
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
return static_cast<TabChild*>(tc.get());
}
static TabChild* GetFrom(nsIPresShell* aPresShell); virtual bool RecvSynthMouseMoveEvent(const mozilla::WidgetMouseEvent& aEvent,
static TabChild* GetFrom(uint64_t aLayersId); const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
void DidComposite(uint64_t aTransactionId, virtual bool RecvRealMouseButtonEvent(const mozilla::WidgetMouseEvent& aEvent,
const TimeStamp& aCompositeStart, const ScrollableLayerGuid& aGuid,
const TimeStamp& aCompositeEnd); const uint64_t& aInputBlockId) override;
void DidRequestComposite(const TimeStamp& aCompositeReqStart,
const TimeStamp& aCompositeReqEnd);
void ClearCachedResources(); virtual bool RecvRealDragEvent(const WidgetDragEvent& aEvent,
const uint32_t& aDragAction,
const uint32_t& aDropEffect) override;
static inline TabChild* virtual bool
GetFrom(nsIDOMWindow* aWindow) RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& aEvent,
{ const MaybeNativeKeyBinding& aBindings) override;
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
return GetFrom(docShell);
}
virtual bool RecvUIResolutionChanged(const float& aDpi, const double& aScale) override; virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
virtual bool RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override; virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvHandleAccessKey(nsTArray<uint32_t>&& aCharCodes, virtual bool
const bool& aIsTrusted, RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const int32_t& aModifierMask) override; const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel, virtual bool RecvKeyEvent(const nsString& aType,
const float& aVolume, const int32_t& aKeyCode,
const bool& aMuted) override; const int32_t& aCharCode,
const int32_t& aModifiers,
const bool& aPreventDefault) override;
/** virtual bool RecvMouseScrollTestEvent(const FrameMetrics::ViewID& aScrollId,
* Native widget remoting protocol for use with windowed plugins with e10s. const nsString& aEvent) override;
*/
PPluginWidgetChild* AllocPPluginWidgetChild() override;
bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
LayoutDeviceIntPoint GetChromeDisplacement() { return mChromeDisp; }; virtual bool RecvNativeSynthesisResponse(const uint64_t& aObserverId,
const nsCString& aResponse) override;
bool IPCOpen() { return mIPCOpen; } virtual bool RecvPluginEvent(const WidgetPluginEvent& aEvent) override;
bool ParentIsActive() virtual bool
{ RecvCompositionEvent(const mozilla::WidgetCompositionEvent& aEvent) override;
return mParentIsActive;
}
bool AsyncPanZoomEnabled() { return mAsyncPanZoomEnabled; }
virtual ScreenIntSize GetInnerSize() override; virtual bool
RecvSelectionEvent(const mozilla::WidgetSelectionEvent& aEvent) override;
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow(). virtual bool
void DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier, RecvActivateFrameEvent(const nsString& aType, const bool& aCapture) override;
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame, virtual bool RecvLoadRemoteScript(const nsString& aURL,
const ShowInfo& aShowInfo); const bool& aRunInGlobalScope) override;
virtual bool RecvAsyncMessage(const nsString& aMessage,
const ClonedMessageData& aData,
InfallibleTArray<CpowEntry>&& aCpows,
const IPC::Principal& aPrincipal) override;
virtual bool RecvAppOfflineStatus(const uint32_t& aId,
const bool& aOffline) override;
virtual bool RecvSwappedWithOtherRemoteLoader() override;
virtual PDocAccessibleChild*
AllocPDocAccessibleChild(PDocAccessibleChild*, const uint64_t&) override;
virtual bool DeallocPDocAccessibleChild(PDocAccessibleChild*) override;
virtual PDocumentRendererChild*
AllocPDocumentRendererChild(const nsRect& aDocumentRect,
const gfx::Matrix& aTransform,
const nsString& aBggcolor,
const uint32_t& aRenderFlags,
const bool& aFlushLayout,
const nsIntSize& arenderSize) override;
virtual bool
DeallocPDocumentRendererChild(PDocumentRendererChild* aCctor) override;
virtual bool
RecvPDocumentRendererConstructor(PDocumentRendererChild* aActor,
const nsRect& aDocumentRect,
const gfx::Matrix& aTransform,
const nsString& aBgcolor,
const uint32_t& aRenderFlags,
const bool& aFlushLayout,
const nsIntSize& aRenderSize) override;
virtual PColorPickerChild*
AllocPColorPickerChild(const nsString& aTitle,
const nsString& aInitialColor) override;
virtual bool DeallocPColorPickerChild(PColorPickerChild* aActor) override;
virtual PFilePickerChild*
AllocPFilePickerChild(const nsString& aTitle, const int16_t& aMode) override;
virtual bool
DeallocPFilePickerChild(PFilePickerChild* aActor) override;
virtual PIndexedDBPermissionRequestChild*
AllocPIndexedDBPermissionRequestChild(const Principal& aPrincipal) override;
virtual bool
DeallocPIndexedDBPermissionRequestChild(PIndexedDBPermissionRequestChild* aActor) override;
virtual nsIWebNavigation* WebNavigation() const override
{
return mWebNav;
}
virtual PuppetWidget* WebWidget() override { return mPuppetWidget; }
/** Return the DPI of the widget this TabChild draws to. */
void GetDPI(float* aDPI);
void GetDefaultScale(double *aScale);
void GetMaxTouchPoints(uint32_t* aTouchPoints);
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
void SetBackgroundColor(const nscolor& aColor);
void NotifyPainted();
void RequestNativeKeyBindings(mozilla::widget::AutoCacheNativeKeyCommands* aAutoCache,
WidgetKeyboardEvent* aEvent);
/**
* Signal to this TabChild that it should be made visible:
* activated widget, retained layer tree, etc. (Respectively,
* made not visible.)
*/
void MakeVisible();
void MakeHidden();
// Returns true if the file descriptor was found in the cache, false
// otherwise.
bool GetCachedFileDescriptor(const nsAString& aPath,
nsICachedFileDescriptorListener* aCallback);
void CancelCachedFileDescriptorCallback(
const nsAString& aPath,
nsICachedFileDescriptorListener* aCallback);
nsIContentChild* Manager() const { return mManager; }
bool GetUpdateHitRegion() const { return mUpdateHitRegion; }
void UpdateHitRegion(const nsRegion& aRegion);
static inline TabChild*
GetFrom(nsIDocShell* aDocShell)
{
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
return static_cast<TabChild*>(tc.get());
}
static TabChild* GetFrom(nsIPresShell* aPresShell);
static TabChild* GetFrom(uint64_t aLayersId);
void DidComposite(uint64_t aTransactionId,
const TimeStamp& aCompositeStart,
const TimeStamp& aCompositeEnd);
void DidRequestComposite(const TimeStamp& aCompositeReqStart,
const TimeStamp& aCompositeReqEnd);
void ClearCachedResources();
static inline TabChild* GetFrom(nsIDOMWindow* aWindow)
{
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
return GetFrom(docShell);
}
virtual bool RecvUIResolutionChanged(const float& aDpi,
const double& aScale) override;
virtual bool
RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override;
virtual bool RecvHandleAccessKey(nsTArray<uint32_t>&& aCharCodes,
const bool& aIsTrusted,
const int32_t& aModifierMask) override;
virtual bool RecvAudioChannelChangeNotification(const uint32_t& aAudioChannel,
const float& aVolume,
const bool& aMuted) override;
/**
* Native widget remoting protocol for use with windowed plugins with e10s.
*/
PPluginWidgetChild* AllocPPluginWidgetChild() override;
bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; };
bool IPCOpen() const { return mIPCOpen; }
bool ParentIsActive() const
{
return mParentIsActive;
}
bool AsyncPanZoomEnabled() const { return mAsyncPanZoomEnabled; }
virtual ScreenIntSize GetInnerSize() override;
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
const ShowInfo& aShowInfo);
protected: protected:
virtual ~TabChild(); virtual ~TabChild();
virtual PRenderFrameChild* AllocPRenderFrameChild() override; virtual PRenderFrameChild* AllocPRenderFrameChild() override;
virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) override;
virtual bool RecvDestroy() override;
virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) override;
virtual bool RecvSetDocShellIsActive(const bool& aIsActive, const bool& aIsHidden) override;
virtual bool RecvNavigateByKey(const bool& aForward, const bool& aForDocumentNavigation) override;
virtual bool RecvRequestNotifyAfterRemotePaint() override; virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) override;
virtual bool RecvSuppressDisplayport(const bool& aEnabled) override; virtual bool RecvDestroy() override;
virtual bool RecvParentActivated(const bool& aActivated) override; virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) override;
virtual bool RecvStopIMEStateManagement() override; virtual bool RecvSetDocShellIsActive(const bool& aIsActive,
virtual bool RecvMenuKeyboardListenerInstalled( const bool& aIsHidden) override;
const bool& aInstalled) override;
virtual bool RecvNavigateByKey(const bool& aForward,
const bool& aForDocumentNavigation) override;
virtual bool RecvRequestNotifyAfterRemotePaint() override;
virtual bool RecvSuppressDisplayport(const bool& aEnabled) override;
virtual bool RecvParentActivated(const bool& aActivated) override;
virtual bool RecvStopIMEStateManagement() override;
virtual bool RecvMenuKeyboardListenerInstalled(
const bool& aInstalled) override;
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
void MaybeRequestPreinitCamera(); void MaybeRequestPreinitCamera();
#endif #endif
private: private:
// Notify others that our TabContext has been updated. (At the moment, this // Notify others that our TabContext has been updated. (At the moment, this
// sets the appropriate app-id and is-browser flags on our docshell.) // sets the appropriate app-id and is-browser flags on our docshell.)
// //
// You should call this after calling TabContext::SetTabContext(). We also // You should call this after calling TabContext::SetTabContext(). We also
// call this during Init(). // call this during Init().
void NotifyTabContextUpdated(); void NotifyTabContextUpdated();
void ActorDestroy(ActorDestroyReason why) override; void ActorDestroy(ActorDestroyReason why) override;
enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS }; enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };
bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
bool InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame);
void DestroyWindow();
void SetProcessNameToAppName();
void ApplyShowInfo(const ShowInfo& aInfo); bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
bool HasValidInnerSize(); bool InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame);
void SetTabId(const TabId& aTabId); void DestroyWindow();
ScreenIntRect GetOuterRect(); void SetProcessNameToAppName();
void SetUnscaledInnerSize(const CSSSize& aSize) { void ApplyShowInfo(const ShowInfo& aInfo);
mUnscaledInnerSize = aSize;
}
class CachedFileDescriptorInfo; bool HasValidInnerSize();
class CachedFileDescriptorCallbackRunnable;
class DelayedDeleteRunnable;
TextureFactoryIdentifier mTextureFactoryIdentifier; void SetTabId(const TabId& aTabId);
nsCOMPtr<nsIWebNavigation> mWebNav;
RefPtr<PuppetWidget> mPuppetWidget;
nsCOMPtr<nsIURI> mLastURI;
RenderFrameChild* mRemoteFrame;
RefPtr<nsIContentChild> mManager;
uint32_t mChromeFlags;
int32_t mActiveSuppressDisplayport;
uint64_t mLayersId;
CSSRect mUnscaledOuterRect;
// Whether we have already received a FileDescriptor for the app package.
bool mAppPackageFileDescriptorRecved;
// At present only 1 of these is really expected.
nsAutoTArray<nsAutoPtr<CachedFileDescriptorInfo>, 1>
mCachedFileDescriptorInfos;
nscolor mLastBackgroundColor;
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
ScreenOrientationInternal mOrientation;
bool mUpdateHitRegion;
bool mIgnoreKeyPressEvent; ScreenIntRect GetOuterRect();
RefPtr<APZEventState> mAPZEventState;
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
bool mHasValidInnerSize;
bool mDestroyed;
// Position of tab, relative to parent widget (typically the window)
LayoutDeviceIntPoint mChromeDisp;
TabId mUniqueId;
friend class ContentChild; void SetUnscaledInnerSize(const CSSSize& aSize)
float mDPI; {
double mDefaultScale; mUnscaledInnerSize = aSize;
}
bool mIPCOpen; class CachedFileDescriptorInfo;
bool mParentIsActive; class CachedFileDescriptorCallbackRunnable;
bool mAsyncPanZoomEnabled; class DelayedDeleteRunnable;
CSSSize mUnscaledInnerSize;
bool mDidSetRealShowInfo;
nsAutoTArray<bool, NUMBER_OF_AUDIO_CHANNELS> mAudioChannelsActive; TextureFactoryIdentifier mTextureFactoryIdentifier;
nsCOMPtr<nsIWebNavigation> mWebNav;
RefPtr<PuppetWidget> mPuppetWidget;
nsCOMPtr<nsIURI> mLastURI;
RenderFrameChild* mRemoteFrame;
RefPtr<nsIContentChild> mManager;
uint32_t mChromeFlags;
int32_t mActiveSuppressDisplayport;
uint64_t mLayersId;
CSSRect mUnscaledOuterRect;
// Whether we have already received a FileDescriptor for the app package.
bool mAppPackageFileDescriptorRecved;
// At present only 1 of these is really expected.
nsAutoTArray<nsAutoPtr<CachedFileDescriptorInfo>, 1>
mCachedFileDescriptorInfos;
nscolor mLastBackgroundColor;
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
ScreenOrientationInternal mOrientation;
bool mUpdateHitRegion;
DISALLOW_EVIL_CONSTRUCTORS(TabChild); bool mIgnoreKeyPressEvent;
RefPtr<APZEventState> mAPZEventState;
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
bool mHasValidInnerSize;
bool mDestroyed;
// Position of tab, relative to parent widget (typically the window)
LayoutDeviceIntPoint mChromeDisp;
TabId mUniqueId;
friend class ContentChild;
float mDPI;
double mDefaultScale;
bool mIPCOpen;
bool mParentIsActive;
bool mAsyncPanZoomEnabled;
CSSSize mUnscaledInnerSize;
bool mDidSetRealShowInfo;
nsAutoTArray<bool, NUMBER_OF_AUDIO_CHANNELS> mAudioChannelsActive;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
}; };
} // namespace dom } // namespace dom

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

@ -104,8 +104,8 @@ public:
bool HasOwnOrContainingApp() const; bool HasOwnOrContainingApp() const;
/** /**
* OriginAttributesRef() returns the DocShellOriginAttributes of this frame to the * OriginAttributesRef() returns the DocShellOriginAttributes of this frame to
* caller. This is used to store any attribute associated with the frame's * the caller. This is used to store any attribute associated with the frame's
* docshell, such as the AppId. * docshell, such as the AppId.
*/ */
const DocShellOriginAttributes& OriginAttributesRef() const; const DocShellOriginAttributes& OriginAttributesRef() const;
@ -196,10 +196,11 @@ public:
return TabContext::SetTabContext(aContext); return TabContext::SetTabContext(aContext);
} }
bool SetTabContext(mozIApplication* aOwnApp, bool
mozIApplication* aAppFrameOwnerApp, SetTabContext(mozIApplication* aOwnApp,
const DocShellOriginAttributes& aOriginAttributes, mozIApplication* aAppFrameOwnerApp,
const nsACString& aSignedPkgOriginNoSuffix = EmptyCString()) const DocShellOriginAttributes& aOriginAttributes,
const nsACString& aSignedPkgOriginNoSuffix = EmptyCString())
{ {
return TabContext::SetTabContext(aOwnApp, return TabContext::SetTabContext(aOwnApp,
aAppFrameOwnerApp, aAppFrameOwnerApp,

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

@ -64,16 +64,19 @@ struct ParamTraits<mozilla::dom::AudioChannel>
{ {
typedef mozilla::dom::AudioChannel paramType; typedef mozilla::dom::AudioChannel paramType;
static bool IsLegalValue(const paramType &aValue) { static bool IsLegalValue(const paramType &aValue)
{
return aValue <= mozilla::dom::AudioChannel::Publicnotification; return aValue <= mozilla::dom::AudioChannel::Publicnotification;
} }
static void Write(Message* aMsg, const paramType& aValue) { static void Write(Message* aMsg, const paramType& aValue)
{
MOZ_ASSERT(IsLegalValue(aValue)); MOZ_ASSERT(IsLegalValue(aValue));
WriteParam(aMsg, (uint32_t)aValue); WriteParam(aMsg, (uint32_t)aValue);
} }
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) { static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
uint32_t value; uint32_t value;
if(!ReadParam(aMsg, aIter, &value) || if(!ReadParam(aMsg, aIter, &value) ||
!IsLegalValue(paramType(value))) { !IsLegalValue(paramType(value))) {
@ -84,8 +87,7 @@ struct ParamTraits<mozilla::dom::AudioChannel>
} }
static void Log(const paramType& aParam, std::wstring* aLog) static void Log(const paramType& aParam, std::wstring* aLog)
{ {}
}
}; };
template <> template <>
@ -93,15 +95,15 @@ struct ParamTraits<nsEventStatus>
: public ContiguousEnumSerializer<nsEventStatus, : public ContiguousEnumSerializer<nsEventStatus,
nsEventStatus_eIgnore, nsEventStatus_eIgnore,
nsEventStatus_eSentinel> nsEventStatus_eSentinel>
{ }; {};
template<> template<>
struct ParamTraits<nsSizeMode> struct ParamTraits<nsSizeMode>
: public ContiguousEnumSerializer<nsSizeMode, : public ContiguousEnumSerializer<nsSizeMode,
nsSizeMode_Normal, nsSizeMode_Normal,
nsSizeMode_Invalid> nsSizeMode_Invalid>
{ }; {};
} // namespace IPC } // namespace IPC
#endif #endif // TABMESSAGE_UTILS_H

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

@ -438,7 +438,7 @@ TabParent::GetAppType(nsAString& aOut)
} }
bool bool
TabParent::IsVisible() TabParent::IsVisible() const
{ {
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(); RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) { if (!frameLoader) {

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

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

@ -51,9 +51,9 @@ public:
BlobChild* GetOrCreateActorForBlob(Blob* aBlob); BlobChild* GetOrCreateActorForBlob(Blob* aBlob);
BlobChild* GetOrCreateActorForBlobImpl(BlobImpl* aImpl); BlobChild* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
virtual PBlobChild* SendPBlobConstructor( virtual PBlobChild*
PBlobChild* aActor, SendPBlobConstructor(PBlobChild* aActor,
const BlobConstructorParams& aParams) = 0; const BlobConstructorParams& aParams) = 0;
virtual bool virtual bool
SendPBrowserConstructor(PBrowserChild* aActor, SendPBrowserConstructor(PBrowserChild* aActor,

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

@ -55,28 +55,29 @@ public:
BlobParent* GetOrCreateActorForBlob(Blob* aBlob); BlobParent* GetOrCreateActorForBlob(Blob* aBlob);
BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl); BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
virtual ContentParentId ChildID() = 0; virtual ContentParentId ChildID() const = 0;
virtual bool IsForApp() = 0; virtual bool IsForApp() const = 0;
virtual bool IsForBrowser() = 0; virtual bool IsForBrowser() const = 0;
MOZ_WARN_UNUSED_RESULT MOZ_WARN_UNUSED_RESULT virtual PBlobParent*
virtual PBlobParent* SendPBlobConstructor( SendPBlobConstructor(PBlobParent* aActor,
PBlobParent* aActor, const BlobConstructorParams& aParams) = 0;
const BlobConstructorParams& aParams) = 0;
MOZ_WARN_UNUSED_RESULT MOZ_WARN_UNUSED_RESULT virtual PBrowserParent*
virtual PBrowserParent* SendPBrowserConstructor( SendPBrowserConstructor(PBrowserParent* actor,
PBrowserParent* actor, const TabId& aTabId,
const TabId& aTabId, const IPCTabContext& context,
const IPCTabContext& context, const uint32_t& chromeFlags,
const uint32_t& chromeFlags, const ContentParentId& aCpId,
const ContentParentId& aCpId, const bool& aIsForApp,
const bool& aIsForApp, const bool& aIsForBrowser) = 0;
const bool& aIsForBrowser) = 0;
virtual bool IsContentParent() const { return false; }
virtual bool IsContentParent() { return false; }
ContentParent* AsContentParent(); ContentParent* AsContentParent();
virtual bool IsContentBridgeParent() { return false; }
virtual bool IsContentBridgeParent() const { return false; }
ContentBridgeParent* AsContentBridgeParent(); ContentBridgeParent* AsContentBridgeParent();
protected: // methods protected: // methods