зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland
This commit is contained in:
Коммит
f6792d74fc
|
@ -1163,7 +1163,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gleam"
|
name = "gleam"
|
||||||
version = "0.6.11"
|
version = "0.6.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3107,7 +3107,7 @@ dependencies = [
|
||||||
"dwrote 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dwrote 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3158,7 +3158,7 @@ dependencies = [
|
||||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nsstring 0.1.0",
|
"nsstring 0.1.0",
|
||||||
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3412,7 +3412,7 @@ dependencies = [
|
||||||
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
|
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
|
||||||
"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
|
"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
|
||||||
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
||||||
"checksum gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b93018064928ec67c429c9c9416affd93660419dbf84767fff6b8a99fbe9c277"
|
"checksum gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f1519ca611d230e1deadbedfb79044b921ac4a961ab8823fef10e37271e2c38e"
|
||||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||||
"checksum goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5911d7df7b8f65ab676c5327b50acea29d3c6a1a4ad05e444cf5dce321b26db2"
|
"checksum goblin 0.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5911d7df7b8f65ab676c5327b50acea29d3c6a1a4ad05e444cf5dce321b26db2"
|
||||||
"checksum h2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a27e7ed946e8335bdf9a191bc1b9b14a03ba822d013d2f58437f4fabcbd7fc2c"
|
"checksum h2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a27e7ed946e8335bdf9a191bc1b9b14a03ba822d013d2f58437f4fabcbd7fc2c"
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
#include "mozilla/dom/IPCBlobUtils.h"
|
#include "mozilla/dom/IPCBlobUtils.h"
|
||||||
#include "mozilla/dom/NodeBinding.h"
|
#include "mozilla/dom/NodeBinding.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/dom/Text.h"
|
#include "mozilla/dom/Text.h"
|
||||||
|
@ -6199,7 +6199,7 @@ bool nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent) {
|
||||||
// If the subdocument lives in another process, the frame is
|
// If the subdocument lives in another process, the frame is
|
||||||
// tabbable.
|
// tabbable.
|
||||||
if (EventStateManager::IsRemoteTarget(aContent) ||
|
if (EventStateManager::IsRemoteTarget(aContent) ||
|
||||||
RemoteFrameChild::GetFrom(aContent)) {
|
BrowserBridgeChild::GetFrom(aContent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#include "mozilla/dom/HTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "mozilla/dom/HTMLInputElement.h"
|
#include "mozilla/dom/HTMLInputElement.h"
|
||||||
#include "mozilla/dom/HTMLSlotElement.h"
|
#include "mozilla/dom/HTMLSlotElement.h"
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||||
#include "mozilla/dom/Text.h"
|
#include "mozilla/dom/Text.h"
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/EventStateManager.h"
|
#include "mozilla/EventStateManager.h"
|
||||||
|
@ -1854,8 +1854,8 @@ void nsFocusManager::Focus(nsPIDOMWindowOuter* aWindow, Element* aElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as above but for out-of-process iframes
|
// Same as above but for out-of-process iframes
|
||||||
if (RemoteFrameChild* rfc = RemoteFrameChild::GetFrom(aElement)) {
|
if (BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(aElement)) {
|
||||||
rfc->Activate();
|
bbc->Activate();
|
||||||
LOGFOCUS(("Out-of-process iframe activated"));
|
LOGFOCUS(("Out-of-process iframe activated"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3475,9 +3475,9 @@ nsresult nsFocusManager::GetNextTabbableContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as above but for out-of-process iframes
|
// Same as above but for out-of-process iframes
|
||||||
RemoteFrameChild* rfc = RemoteFrameChild::GetFrom(currentContent);
|
BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(currentContent);
|
||||||
if (rfc) {
|
if (bbc) {
|
||||||
rfc->NavigateByKey(aForward, aForDocumentNavigation);
|
bbc->NavigateByKey(aForward, aForDocumentNavigation);
|
||||||
return NS_SUCCESS_DOM_NO_OPERATION;
|
return NS_SUCCESS_DOM_NO_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
#include "mozilla/dom/ChildSHistory.h"
|
#include "mozilla/dom/ChildSHistory.h"
|
||||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||||
#include "mozilla/dom/ContentChild.h"
|
#include "mozilla/dom/ContentChild.h"
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||||
|
|
||||||
#include "mozilla/dom/HTMLBodyElement.h"
|
#include "mozilla/dom/HTMLBodyElement.h"
|
||||||
|
|
||||||
|
@ -344,15 +344,15 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
||||||
AUTO_PROFILER_LABEL("nsFrameLoader::ReallyStartLoadingInternal", OTHER);
|
AUTO_PROFILER_LABEL("nsFrameLoader::ReallyStartLoadingInternal", OTHER);
|
||||||
|
|
||||||
if (IsRemoteFrame()) {
|
if (IsRemoteFrame()) {
|
||||||
if (!mRemoteBrowser && !mRemoteFrameChild && !TryRemoteBrowser()) {
|
if (!mRemoteBrowser && !mBrowserBridgeChild && !TryRemoteBrowser()) {
|
||||||
NS_WARNING("Couldn't create child process for iframe.");
|
NS_WARNING("Couldn't create child process for iframe.");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
nsAutoCString spec;
|
nsAutoCString spec;
|
||||||
mURIToLoad->GetSpec(spec);
|
mURIToLoad->GetSpec(spec);
|
||||||
Unused << mRemoteFrameChild->SendLoadURL(spec);
|
Unused << mBrowserBridgeChild->SendLoadURL(spec);
|
||||||
} else {
|
} else {
|
||||||
// FIXME get error codes from child
|
// FIXME get error codes from child
|
||||||
mRemoteBrowser->LoadURL(mURIToLoad);
|
mRemoteBrowser->LoadURL(mURIToLoad);
|
||||||
|
@ -806,7 +806,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
||||||
NS_ASSERTION(IsRemoteFrame(),
|
NS_ASSERTION(IsRemoteFrame(),
|
||||||
"ShowRemote only makes sense on remote frames.");
|
"ShowRemote only makes sense on remote frames.");
|
||||||
|
|
||||||
if (!mRemoteBrowser && !mRemoteFrameChild && !TryRemoteBrowser()) {
|
if (!mRemoteBrowser && !mBrowserBridgeChild && !TryRemoteBrowser()) {
|
||||||
NS_ERROR("Couldn't create child process.");
|
NS_ERROR("Couldn't create child process.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -825,7 +825,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
nsCOMPtr<nsISupports> container =
|
nsCOMPtr<nsISupports> container =
|
||||||
mOwnerContent->OwnerDoc()->GetContainer();
|
mOwnerContent->OwnerDoc()->GetContainer();
|
||||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
|
||||||
|
@ -834,7 +834,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
||||||
nsSizeMode sizeMode =
|
nsSizeMode sizeMode =
|
||||||
mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
|
mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
|
||||||
|
|
||||||
Unused << mRemoteFrameChild->SendShow(
|
Unused << mBrowserBridgeChild->SendShow(
|
||||||
size, ParentWindowIsActive(mOwnerContent->OwnerDoc()), sizeMode);
|
size, ParentWindowIsActive(mOwnerContent->OwnerDoc()), sizeMode);
|
||||||
mRemoteBrowserShown = true;
|
mRemoteBrowserShown = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -863,8 +863,8 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
||||||
if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||||
if (mRemoteBrowser) {
|
if (mRemoteBrowser) {
|
||||||
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
||||||
} else if (mRemoteFrameChild) {
|
} else if (mBrowserBridgeChild) {
|
||||||
mRemoteFrameChild->UpdateDimensions(dimensions, size);
|
mBrowserBridgeChild->UpdateDimensions(dimensions, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -955,7 +955,7 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Consider supporting FrameLoader swapping for remote sub frames.
|
// FIXME: Consider supporting FrameLoader swapping for remote sub frames.
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1686,9 +1686,9 @@ void nsFrameLoader::DestroyDocShell() {
|
||||||
mRemoteBrowser->Destroy();
|
mRemoteBrowser->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
Unused << mRemoteFrameChild->Send__delete__(mRemoteFrameChild);
|
Unused << mBrowserBridgeChild->Send__delete__(mBrowserBridgeChild);
|
||||||
mRemoteFrameChild = nullptr;
|
mBrowserBridgeChild = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire the "unload" event if we're in-process.
|
// Fire the "unload" event if we're in-process.
|
||||||
|
@ -1732,9 +1732,9 @@ void nsFrameLoader::DestroyComplete() {
|
||||||
mRemoteBrowser = nullptr;
|
mRemoteBrowser = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
Unused << mRemoteFrameChild->Send__delete__(mRemoteFrameChild);
|
Unused << mBrowserBridgeChild->Send__delete__(mBrowserBridgeChild);
|
||||||
mRemoteFrameChild = nullptr;
|
mBrowserBridgeChild = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMessageManager) {
|
if (mMessageManager) {
|
||||||
|
@ -2298,7 +2298,7 @@ nsresult nsFrameLoader::GetWindowDimensions(nsIntRect& aRect) {
|
||||||
|
|
||||||
nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) {
|
nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) {
|
||||||
if (IsRemoteFrame()) {
|
if (IsRemoteFrame()) {
|
||||||
if (mRemoteBrowser || mRemoteFrameChild) {
|
if (mRemoteBrowser || mBrowserBridgeChild) {
|
||||||
ScreenIntSize size = aIFrame->GetSubdocumentSize();
|
ScreenIntSize size = aIFrame->GetSubdocumentSize();
|
||||||
// If we were not able to show remote frame before, we should probably
|
// If we were not able to show remote frame before, we should probably
|
||||||
// retry now to send correct showInfo.
|
// retry now to send correct showInfo.
|
||||||
|
@ -2310,8 +2310,8 @@ nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) {
|
||||||
mLazySize = size;
|
mLazySize = size;
|
||||||
if (mRemoteBrowser) {
|
if (mRemoteBrowser) {
|
||||||
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
||||||
} else if (mRemoteFrameChild) {
|
} else if (mBrowserBridgeChild) {
|
||||||
mRemoteFrameChild->UpdateDimensions(dimensions, size);
|
mBrowserBridgeChild->UpdateDimensions(dimensions, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2391,7 +2391,7 @@ static Tuple<ContentParent*, TabParent*> GetContentParent(Element* aBrowser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsFrameLoader::TryRemoteBrowser() {
|
bool nsFrameLoader::TryRemoteBrowser() {
|
||||||
NS_ASSERTION(!mRemoteBrowser && !mRemoteFrameChild,
|
NS_ASSERTION(!mRemoteBrowser && !mBrowserBridgeChild,
|
||||||
"TryRemoteBrowser called with a remote browser already?");
|
"TryRemoteBrowser called with a remote browser already?");
|
||||||
|
|
||||||
if (!mOwnerContent) {
|
if (!mOwnerContent) {
|
||||||
|
@ -2508,11 +2508,11 @@ bool nsFrameLoader::TryRemoteBrowser() {
|
||||||
|
|
||||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||||
|
|
||||||
// If we're in a content process, create a RemoteFrameChild actor.
|
// If we're in a content process, create a BrowserBridgeChild actor.
|
||||||
if (XRE_IsContentProcess()) {
|
if (XRE_IsContentProcess()) {
|
||||||
mRemoteFrameChild = RemoteFrameChild::Create(
|
mBrowserBridgeChild = BrowserBridgeChild::Create(
|
||||||
this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
|
this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
|
||||||
return !!mRemoteFrameChild;
|
return !!mBrowserBridgeChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRemoteBrowser =
|
mRemoteBrowser =
|
||||||
|
@ -2586,8 +2586,8 @@ mozilla::dom::PBrowserParent* nsFrameLoader::GetRemoteBrowser() const {
|
||||||
return mRemoteBrowser;
|
return mRemoteBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::dom::RemoteFrameChild* nsFrameLoader::GetRemoteFrameChild() const {
|
mozilla::dom::BrowserBridgeChild* nsFrameLoader::GetBrowserBridgeChild() const {
|
||||||
return mRemoteFrameChild;
|
return mBrowserBridgeChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::layers::LayersId nsFrameLoader::GetLayersId() const {
|
mozilla::layers::LayersId nsFrameLoader::GetLayersId() const {
|
||||||
|
@ -2595,8 +2595,8 @@ mozilla::layers::LayersId nsFrameLoader::GetLayersId() const {
|
||||||
if (mRemoteBrowser) {
|
if (mRemoteBrowser) {
|
||||||
return mRemoteBrowser->GetRenderFrame()->GetLayersId();
|
return mRemoteBrowser->GetRenderFrame()->GetLayersId();
|
||||||
}
|
}
|
||||||
if (mRemoteFrameChild) {
|
if (mBrowserBridgeChild) {
|
||||||
return mRemoteFrameChild->GetLayersId();
|
return mBrowserBridgeChild->GetLayersId();
|
||||||
}
|
}
|
||||||
return mozilla::layers::LayersId{};
|
return mozilla::layers::LayersId{};
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ProcessMessageManager;
|
||||||
class Promise;
|
class Promise;
|
||||||
class TabParent;
|
class TabParent;
|
||||||
class MutableTabContext;
|
class MutableTabContext;
|
||||||
class RemoteFrameChild;
|
class BrowserBridgeChild;
|
||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
class StructuredCloneData;
|
class StructuredCloneData;
|
||||||
|
@ -283,10 +283,10 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||||
PBrowserParent* GetRemoteBrowser() const;
|
PBrowserParent* GetRemoteBrowser() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the RemoteFrameChild if this is an out-of-process iframe, or null
|
* Returns the BrowserBridgeChild if this is an out-of-process iframe, or null
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
mozilla::dom::RemoteFrameChild* GetRemoteFrameChild() const;
|
mozilla::dom::BrowserBridgeChild* GetBrowserBridgeChild() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the layers ID that this remote frame is using to render.
|
* Returns the layers ID that this remote frame is using to render.
|
||||||
|
@ -455,7 +455,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||||
uint64_t mChildID;
|
uint64_t mChildID;
|
||||||
|
|
||||||
// This is used when this refers to a remote sub frame
|
// This is used when this refers to a remote sub frame
|
||||||
RefPtr<mozilla::dom::RemoteFrameChild> mRemoteFrameChild;
|
RefPtr<mozilla::dom::BrowserBridgeChild> mBrowserBridgeChild;
|
||||||
|
|
||||||
// Holds the last known size of the frame.
|
// Holds the last known size of the frame.
|
||||||
mozilla::ScreenIntSize mLazySize;
|
mozilla::ScreenIntSize mLazySize;
|
||||||
|
|
|
@ -4,21 +4,22 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||||
|
#include "nsFrameLoader.h"
|
||||||
#include "nsFrameLoaderOwner.h"
|
#include "nsFrameLoaderOwner.h"
|
||||||
|
#include "nsQueryObject.h"
|
||||||
|
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
RemoteFrameChild::RemoteFrameChild(nsFrameLoader* aFrameLoader)
|
BrowserBridgeChild::BrowserBridgeChild(nsFrameLoader* aFrameLoader)
|
||||||
: mLayersId{0}, mIPCOpen(true), mFrameLoader(aFrameLoader) {}
|
: mLayersId{0}, mIPCOpen(true), mFrameLoader(aFrameLoader) {}
|
||||||
|
|
||||||
RemoteFrameChild::~RemoteFrameChild() {}
|
BrowserBridgeChild::~BrowserBridgeChild() {}
|
||||||
|
|
||||||
already_AddRefed<RemoteFrameChild> RemoteFrameChild::Create(
|
already_AddRefed<BrowserBridgeChild> BrowserBridgeChild::Create(
|
||||||
nsFrameLoader* aFrameLoader, const TabContext& aContext,
|
nsFrameLoader* aFrameLoader, const TabContext& aContext,
|
||||||
const nsString& aRemoteType) {
|
const nsString& aRemoteType) {
|
||||||
MOZ_ASSERT(XRE_IsContentProcess());
|
MOZ_ASSERT(XRE_IsContentProcess());
|
||||||
|
@ -33,18 +34,19 @@ already_AddRefed<RemoteFrameChild> RemoteFrameChild::Create(
|
||||||
RefPtr<TabChild> tabChild = TabChild::GetFrom(docShell);
|
RefPtr<TabChild> tabChild = TabChild::GetFrom(docShell);
|
||||||
MOZ_DIAGNOSTIC_ASSERT(tabChild);
|
MOZ_DIAGNOSTIC_ASSERT(tabChild);
|
||||||
|
|
||||||
RefPtr<RemoteFrameChild> remoteFrame = new RemoteFrameChild(aFrameLoader);
|
RefPtr<BrowserBridgeChild> browserBridge =
|
||||||
// Reference is freed in TabChild::DeallocPRemoteFrameChild.
|
new BrowserBridgeChild(aFrameLoader);
|
||||||
tabChild->SendPRemoteFrameConstructor(
|
// Reference is freed in TabChild::DeallocPBrowserBridgeChild.
|
||||||
do_AddRef(remoteFrame).take(),
|
tabChild->SendPBrowserBridgeConstructor(
|
||||||
|
do_AddRef(browserBridge).take(),
|
||||||
PromiseFlatString(aContext.PresentationURL()), aRemoteType);
|
PromiseFlatString(aContext.PresentationURL()), aRemoteType);
|
||||||
remoteFrame->mIPCOpen = true;
|
browserBridge->mIPCOpen = true;
|
||||||
|
|
||||||
return remoteFrame.forget();
|
return browserBridge.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteFrameChild::UpdateDimensions(const nsIntRect& aRect,
|
void BrowserBridgeChild::UpdateDimensions(const nsIntRect& aRect,
|
||||||
const mozilla::ScreenIntSize& aSize) {
|
const mozilla::ScreenIntSize& aSize) {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(mIPCOpen);
|
MOZ_DIAGNOSTIC_ASSERT(mIPCOpen);
|
||||||
|
|
||||||
RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
|
RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
|
||||||
|
@ -75,23 +77,23 @@ void RemoteFrameChild::UpdateDimensions(const nsIntRect& aRect,
|
||||||
Unused << SendUpdateDimensions(di);
|
Unused << SendUpdateDimensions(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteFrameChild::NavigateByKey(bool aForward,
|
void BrowserBridgeChild::NavigateByKey(bool aForward,
|
||||||
bool aForDocumentNavigation) {
|
bool aForDocumentNavigation) {
|
||||||
Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
|
Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteFrameChild::Activate() { Unused << SendActivate(); }
|
void BrowserBridgeChild::Activate() { Unused << SendActivate(); }
|
||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
RemoteFrameChild* RemoteFrameChild::GetFrom(nsFrameLoader* aFrameLoader) {
|
BrowserBridgeChild* BrowserBridgeChild::GetFrom(nsFrameLoader* aFrameLoader) {
|
||||||
if (!aFrameLoader) {
|
if (!aFrameLoader) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return aFrameLoader->GetRemoteFrameChild();
|
return aFrameLoader->GetBrowserBridgeChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
RemoteFrameChild* RemoteFrameChild::GetFrom(nsIContent* aContent) {
|
BrowserBridgeChild* BrowserBridgeChild::GetFrom(nsIContent* aContent) {
|
||||||
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(aContent);
|
RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(aContent);
|
||||||
if (!loaderOwner) {
|
if (!loaderOwner) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -100,14 +102,14 @@ RemoteFrameChild* RemoteFrameChild::GetFrom(nsIContent* aContent) {
|
||||||
return GetFrom(frameLoader);
|
return GetFrom(frameLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameChild::RecvSetLayersId(
|
IPCResult BrowserBridgeChild::RecvSetLayersId(
|
||||||
const mozilla::layers::LayersId& aLayersId) {
|
const mozilla::layers::LayersId& aLayersId) {
|
||||||
MOZ_ASSERT(!mLayersId.IsValid() && aLayersId.IsValid());
|
MOZ_ASSERT(!mLayersId.IsValid() && aLayersId.IsValid());
|
||||||
mLayersId = aLayersId;
|
mLayersId = aLayersId;
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteFrameChild::ActorDestroy(ActorDestroyReason aWhy) {
|
void BrowserBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
|
||||||
mIPCOpen = false;
|
mIPCOpen = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_RemoteFrameChild_h
|
#ifndef mozilla_dom_BrowserBridgeChild_h
|
||||||
#define mozilla_dom_RemoteFrameChild_h
|
#define mozilla_dom_BrowserBridgeChild_h
|
||||||
|
|
||||||
#include "mozilla/dom/PRemoteFrameChild.h"
|
#include "mozilla/dom/PBrowserBridgeChild.h"
|
||||||
#include "mozilla/dom/TabChild.h"
|
#include "mozilla/dom/TabChild.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
@ -16,20 +16,20 @@ namespace dom {
|
||||||
/**
|
/**
|
||||||
* Child side for a remote frame.
|
* Child side for a remote frame.
|
||||||
*/
|
*/
|
||||||
class RemoteFrameChild : public PRemoteFrameChild {
|
class BrowserBridgeChild : public PBrowserBridgeChild {
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_REFCOUNTING(RemoteFrameChild);
|
NS_INLINE_DECL_REFCOUNTING(BrowserBridgeChild);
|
||||||
|
|
||||||
TabChild* Manager() {
|
TabChild* Manager() {
|
||||||
MOZ_ASSERT(mIPCOpen);
|
MOZ_ASSERT(mIPCOpen);
|
||||||
return static_cast<TabChild*>(PRemoteFrameChild::Manager());
|
return static_cast<TabChild*>(PBrowserBridgeChild::Manager());
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::layers::LayersId GetLayersId() { return mLayersId; }
|
mozilla::layers::LayersId GetLayersId() { return mLayersId; }
|
||||||
|
|
||||||
static already_AddRefed<RemoteFrameChild> Create(nsFrameLoader* aFrameLoader,
|
static already_AddRefed<BrowserBridgeChild> Create(
|
||||||
const TabContext& aContext,
|
nsFrameLoader* aFrameLoader, const TabContext& aContext,
|
||||||
const nsString& aRemoteType);
|
const nsString& aRemoteType);
|
||||||
|
|
||||||
void UpdateDimensions(const nsIntRect& aRect,
|
void UpdateDimensions(const nsIntRect& aRect,
|
||||||
const mozilla::ScreenIntSize& aSize);
|
const mozilla::ScreenIntSize& aSize);
|
||||||
|
@ -38,12 +38,12 @@ class RemoteFrameChild : public PRemoteFrameChild {
|
||||||
|
|
||||||
void Activate();
|
void Activate();
|
||||||
|
|
||||||
static RemoteFrameChild* GetFrom(nsFrameLoader* aFrameLoader);
|
static BrowserBridgeChild* GetFrom(nsFrameLoader* aFrameLoader);
|
||||||
|
|
||||||
static RemoteFrameChild* GetFrom(nsIContent* aContent);
|
static BrowserBridgeChild* GetFrom(nsIContent* aContent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class PRemoteFrameChild;
|
friend class PBrowserBridgeChild;
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvSetLayersId(
|
mozilla::ipc::IPCResult RecvSetLayersId(
|
||||||
const mozilla::layers::LayersId& aLayersId);
|
const mozilla::layers::LayersId& aLayersId);
|
||||||
|
@ -51,8 +51,8 @@ class RemoteFrameChild : public PRemoteFrameChild {
|
||||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit RemoteFrameChild(nsFrameLoader* aFrameLoader);
|
explicit BrowserBridgeChild(nsFrameLoader* aFrameLoader);
|
||||||
~RemoteFrameChild();
|
~BrowserBridgeChild();
|
||||||
|
|
||||||
mozilla::layers::LayersId mLayersId;
|
mozilla::layers::LayersId mLayersId;
|
||||||
bool mIPCOpen;
|
bool mIPCOpen;
|
||||||
|
@ -62,4 +62,4 @@ class RemoteFrameChild : public PRemoteFrameChild {
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // !defined(mozilla_dom_RemoteFrameParent_h)
|
#endif // !defined(mozilla_dom_BrowserBridgeParent_h)
|
|
@ -4,22 +4,23 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/dom/RemoteFrameParent.h"
|
#include "mozilla/dom/BrowserBridgeParent.h"
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
#include "mozilla/dom/ContentProcessManager.h"
|
#include "mozilla/dom/ContentProcessManager.h"
|
||||||
|
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
using namespace mozilla::layout;
|
using namespace mozilla::layout;
|
||||||
|
using namespace mozilla::hal;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
RemoteFrameParent::RemoteFrameParent() : mIPCOpen(false) {}
|
BrowserBridgeParent::BrowserBridgeParent() : mIPCOpen(false) {}
|
||||||
|
|
||||||
RemoteFrameParent::~RemoteFrameParent() {}
|
BrowserBridgeParent::~BrowserBridgeParent() {}
|
||||||
|
|
||||||
nsresult RemoteFrameParent::Init(const nsString& aPresentationURL,
|
nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
|
||||||
const nsString& aRemoteType) {
|
const nsString& aRemoteType) {
|
||||||
mIPCOpen = true;
|
mIPCOpen = true;
|
||||||
|
|
||||||
// FIXME: This should actually use a non-bogus TabContext, probably inherited
|
// FIXME: This should actually use a non-bogus TabContext, probably inherited
|
||||||
|
@ -80,9 +81,9 @@ nsresult RemoteFrameParent::Init(const nsString& aPresentationURL,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvShow(const ScreenIntSize& aSize,
|
IPCResult BrowserBridgeParent::RecvShow(const ScreenIntSize& aSize,
|
||||||
const bool& aParentIsActive,
|
const bool& aParentIsActive,
|
||||||
const nsSizeMode& aSizeMode) {
|
const nsSizeMode& aSizeMode) {
|
||||||
RenderFrame* rf = mTabParent->GetRenderFrame();
|
RenderFrame* rf = mTabParent->GetRenderFrame();
|
||||||
if (!rf->AttachLayerManager()) {
|
if (!rf->AttachLayerManager()) {
|
||||||
MOZ_CRASH();
|
MOZ_CRASH();
|
||||||
|
@ -93,36 +94,36 @@ IPCResult RemoteFrameParent::RecvShow(const ScreenIntSize& aSize,
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvLoadURL(const nsCString& aUrl) {
|
IPCResult BrowserBridgeParent::RecvLoadURL(const nsCString& aUrl) {
|
||||||
Unused << mTabParent->SendLoadURL(aUrl, mTabParent->GetShowInfo());
|
Unused << mTabParent->SendLoadURL(aUrl, mTabParent->GetShowInfo());
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvUpdateDimensions(
|
IPCResult BrowserBridgeParent::RecvUpdateDimensions(
|
||||||
const DimensionInfo& aDimensions) {
|
const DimensionInfo& aDimensions) {
|
||||||
Unused << mTabParent->SendUpdateDimensions(aDimensions);
|
Unused << mTabParent->SendUpdateDimensions(aDimensions);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvRenderLayers(
|
IPCResult BrowserBridgeParent::RecvRenderLayers(
|
||||||
const bool& aEnabled, const bool& aForceRepaint,
|
const bool& aEnabled, const bool& aForceRepaint,
|
||||||
const layers::LayersObserverEpoch& aEpoch) {
|
const layers::LayersObserverEpoch& aEpoch) {
|
||||||
Unused << mTabParent->SendRenderLayers(aEnabled, aForceRepaint, aEpoch);
|
Unused << mTabParent->SendRenderLayers(aEnabled, aForceRepaint, aEpoch);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvNavigateByKey(
|
IPCResult BrowserBridgeParent::RecvNavigateByKey(
|
||||||
const bool& aForward, const bool& aForDocumentNavigation) {
|
const bool& aForward, const bool& aForDocumentNavigation) {
|
||||||
Unused << mTabParent->SendNavigateByKey(aForward, aForDocumentNavigation);
|
Unused << mTabParent->SendNavigateByKey(aForward, aForDocumentNavigation);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult RemoteFrameParent::RecvActivate() {
|
IPCResult BrowserBridgeParent::RecvActivate() {
|
||||||
mTabParent->Activate();
|
mTabParent->Activate();
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteFrameParent::ActorDestroy(ActorDestroyReason aWhy) {
|
void BrowserBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||||
mIPCOpen = false;
|
mIPCOpen = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_RemoteFrameParent_h
|
#ifndef mozilla_dom_BrowserBridgeParent_h
|
||||||
#define mozilla_dom_RemoteFrameParent_h
|
#define mozilla_dom_BrowserBridgeParent_h
|
||||||
|
|
||||||
#include "mozilla/dom/PRemoteFrameParent.h"
|
#include "mozilla/dom/PBrowserBridgeParent.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class RemoteFrameParent : public PRemoteFrameParent {
|
class BrowserBridgeParent : public PBrowserBridgeParent {
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_REFCOUNTING(RemoteFrameParent);
|
NS_INLINE_DECL_REFCOUNTING(BrowserBridgeParent);
|
||||||
|
|
||||||
RemoteFrameParent();
|
BrowserBridgeParent();
|
||||||
|
|
||||||
// Initialize this actor after performing startup.
|
// Initialize this actor after performing startup.
|
||||||
nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType);
|
nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType);
|
||||||
|
@ -27,11 +27,11 @@ class RemoteFrameParent : public PRemoteFrameParent {
|
||||||
// Get our manager actor.
|
// Get our manager actor.
|
||||||
TabParent* Manager() {
|
TabParent* Manager() {
|
||||||
MOZ_ASSERT(mIPCOpen);
|
MOZ_ASSERT(mIPCOpen);
|
||||||
return static_cast<TabParent*>(PRemoteFrameParent::Manager());
|
return static_cast<TabParent*>(PBrowserBridgeParent::Manager());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class PRemoteFrameParent;
|
friend class PBrowserBridgeParent;
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvShow(const ScreenIntSize& aSize,
|
mozilla::ipc::IPCResult RecvShow(const ScreenIntSize& aSize,
|
||||||
const bool& aParentIsActive,
|
const bool& aParentIsActive,
|
||||||
|
@ -51,7 +51,7 @@ class RemoteFrameParent : public PRemoteFrameParent {
|
||||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~RemoteFrameParent();
|
~BrowserBridgeParent();
|
||||||
|
|
||||||
RefPtr<TabParent> mTabParent;
|
RefPtr<TabParent> mTabParent;
|
||||||
bool mIPCOpen;
|
bool mIPCOpen;
|
||||||
|
@ -60,4 +60,4 @@ class RemoteFrameParent : public PRemoteFrameParent {
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // !defined(mozilla_dom_RemoteFrameParent_h)
|
#endif // !defined(mozilla_dom_BrowserBridgeParent_h)
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
#include "nsMemoryReporterManager.h"
|
#include "nsMemoryReporterManager.h"
|
||||||
#include "MemoryReportRequest.h"
|
#include "MemoryReportRequest.h"
|
||||||
|
#include "mozilla/ipc/FileDescriptor.h"
|
||||||
#include "mozilla/ipc/FileDescriptorUtils.h"
|
#include "mozilla/ipc/FileDescriptorUtils.h"
|
||||||
|
|
||||||
|
using namespace mozilla::ipc;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ include protocol PFileDescriptorSet;
|
||||||
include protocol PIPCBlobInputStream;
|
include protocol PIPCBlobInputStream;
|
||||||
include protocol PPaymentRequest;
|
include protocol PPaymentRequest;
|
||||||
include protocol PWindowGlobal;
|
include protocol PWindowGlobal;
|
||||||
include protocol PRemoteFrame;
|
include protocol PBrowserBridge;
|
||||||
|
|
||||||
include DOMTypes;
|
include DOMTypes;
|
||||||
include IPCBlob;
|
include IPCBlob;
|
||||||
|
@ -142,7 +142,7 @@ nested(upto inside_cpow) sync protocol PBrowser
|
||||||
manages PPluginWidget;
|
manages PPluginWidget;
|
||||||
manages PPaymentRequest;
|
manages PPaymentRequest;
|
||||||
manages PWindowGlobal;
|
manages PWindowGlobal;
|
||||||
manages PRemoteFrame;
|
manages PBrowserBridge;
|
||||||
|
|
||||||
both:
|
both:
|
||||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||||
|
@ -178,7 +178,7 @@ parent:
|
||||||
/**
|
/**
|
||||||
* Construct a new Remote iframe actor.
|
* Construct a new Remote iframe actor.
|
||||||
*/
|
*/
|
||||||
async PRemoteFrame(nsString aPresentationURL, nsString aRemoteType);
|
async PBrowserBridge(nsString aPresentationURL, nsString aRemoteType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
|
* Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
|
||||||
|
|
|
@ -17,9 +17,9 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PRemoteFrame corresponds to a remote iframe.
|
* PBrowserBridge corresponds to a remote iframe.
|
||||||
*/
|
*/
|
||||||
async protocol PRemoteFrame {
|
async protocol PBrowserBridge {
|
||||||
manager PBrowser;
|
manager PBrowser;
|
||||||
|
|
||||||
child:
|
child:
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||||
#include "mozilla/ipc/BackgroundUtils.h"
|
#include "mozilla/ipc/BackgroundUtils.h"
|
||||||
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "mozilla/dom/PaymentRequestChild.h"
|
#include "mozilla/dom/PaymentRequestChild.h"
|
||||||
#include "mozilla/dom/PBrowser.h"
|
#include "mozilla/dom/PBrowser.h"
|
||||||
#include "mozilla/dom/WindowProxyHolder.h"
|
#include "mozilla/dom/WindowProxyHolder.h"
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
#include "mozilla/dom/BrowserBridgeChild.h"
|
||||||
#include "mozilla/gfx/CrossProcessPaint.h"
|
#include "mozilla/gfx/CrossProcessPaint.h"
|
||||||
#include "mozilla/IMEStateManager.h"
|
#include "mozilla/IMEStateManager.h"
|
||||||
#include "mozilla/ipc/URIUtils.h"
|
#include "mozilla/ipc/URIUtils.h"
|
||||||
|
@ -1246,6 +1246,10 @@ mozilla::ipc::IPCResult TabChild::RecvHandleTap(
|
||||||
const GeckoContentController::TapType& aType,
|
const GeckoContentController::TapType& aType,
|
||||||
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
||||||
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) {
|
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) {
|
||||||
|
// IPDL doesn't hold a strong reference to protocols as they're not required
|
||||||
|
// to be refcounted. This function can run script, which may trigger a nested
|
||||||
|
// event loop, which may release this, so we hold a strong reference here.
|
||||||
|
RefPtr<TabChild> kungFuDeathGrip(this);
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||||
if (!presShell) {
|
if (!presShell) {
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
|
@ -1291,6 +1295,10 @@ mozilla::ipc::IPCResult TabChild::RecvNormalPriorityHandleTap(
|
||||||
const GeckoContentController::TapType& aType,
|
const GeckoContentController::TapType& aType,
|
||||||
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
||||||
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) {
|
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) {
|
||||||
|
// IPDL doesn't hold a strong reference to protocols as they're not required
|
||||||
|
// to be refcounted. This function can run script, which may trigger a nested
|
||||||
|
// event loop, which may release this, so we hold a strong reference here.
|
||||||
|
RefPtr<TabChild> kungFuDeathGrip(this);
|
||||||
return RecvHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
|
return RecvHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1378,6 +1386,10 @@ mozilla::ipc::IPCResult TabChild::RecvMouseEvent(
|
||||||
const nsString& aType, const float& aX, const float& aY,
|
const nsString& aType, const float& aX, const float& aY,
|
||||||
const int32_t& aButton, const int32_t& aClickCount,
|
const int32_t& aButton, const int32_t& aClickCount,
|
||||||
const int32_t& aModifiers, const bool& aIgnoreRootScrollFrame) {
|
const int32_t& aModifiers, const bool& aIgnoreRootScrollFrame) {
|
||||||
|
// IPDL doesn't hold a strong reference to protocols as they're not required
|
||||||
|
// to be refcounted. This function can run script, which may trigger a nested
|
||||||
|
// event loop, which may release this, so we hold a strong reference here.
|
||||||
|
RefPtr<TabChild> kungFuDeathGrip(this);
|
||||||
APZCCallbackHelper::DispatchMouseEvent(
|
APZCCallbackHelper::DispatchMouseEvent(
|
||||||
GetPresShell(), aType, CSSPoint(aX, aY), aButton, aClickCount, aModifiers,
|
GetPresShell(), aType, CSSPoint(aX, aY), aButton, aClickCount, aModifiers,
|
||||||
aIgnoreRootScrollFrame, MouseEvent_Binding::MOZ_SOURCE_UNKNOWN,
|
aIgnoreRootScrollFrame, MouseEvent_Binding::MOZ_SOURCE_UNKNOWN,
|
||||||
|
@ -3183,15 +3195,16 @@ bool TabChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRemoteFrameChild* TabChild::AllocPRemoteFrameChild(const nsString&,
|
PBrowserBridgeChild* TabChild::AllocPBrowserBridgeChild(const nsString&,
|
||||||
const nsString&) {
|
const nsString&) {
|
||||||
MOZ_CRASH("We should never be manually allocating PRemoteFrameChild actors");
|
MOZ_CRASH(
|
||||||
|
"We should never be manually allocating PBrowserBridgeChild actors");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabChild::DeallocPRemoteFrameChild(PRemoteFrameChild* aActor) {
|
bool TabChild::DeallocPBrowserBridgeChild(PBrowserBridgeChild* aActor) {
|
||||||
// This reference was added in RemoteFrameChild::Create.
|
// This reference was added in BrowserBridgeChild::Create.
|
||||||
static_cast<RemoteFrameChild*>(aActor)->Release();
|
static_cast<BrowserBridgeChild*>(aActor)->Release();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ class TabChild final : public TabChildBase,
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvDeactivate();
|
mozilla::ipc::IPCResult RecvDeactivate();
|
||||||
|
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||||
virtual mozilla::ipc::IPCResult RecvMouseEvent(
|
virtual mozilla::ipc::IPCResult RecvMouseEvent(
|
||||||
const nsString& aType, const float& aX, const float& aY,
|
const nsString& aType, const float& aX, const float& aY,
|
||||||
const int32_t& aButton, const int32_t& aClickCount,
|
const int32_t& aButton, const int32_t& aClickCount,
|
||||||
|
@ -576,13 +576,13 @@ class TabChild final : public TabChildBase,
|
||||||
bool aPreventDefault) const;
|
bool aPreventDefault) const;
|
||||||
void SetTargetAPZC(uint64_t aInputBlockId,
|
void SetTargetAPZC(uint64_t aInputBlockId,
|
||||||
const nsTArray<ScrollableLayerGuid>& aTargets) const;
|
const nsTArray<ScrollableLayerGuid>& aTargets) const;
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||||
mozilla::ipc::IPCResult RecvHandleTap(
|
mozilla::ipc::IPCResult RecvHandleTap(
|
||||||
const layers::GeckoContentController::TapType& aType,
|
const layers::GeckoContentController::TapType& aType,
|
||||||
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
||||||
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) override;
|
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) override;
|
||||||
|
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||||
mozilla::ipc::IPCResult RecvNormalPriorityHandleTap(
|
mozilla::ipc::IPCResult RecvNormalPriorityHandleTap(
|
||||||
const layers::GeckoContentController::TapType& aType,
|
const layers::GeckoContentController::TapType& aType,
|
||||||
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
|
||||||
|
@ -670,10 +670,10 @@ class TabChild final : public TabChildBase,
|
||||||
|
|
||||||
virtual bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) override;
|
virtual bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) override;
|
||||||
|
|
||||||
virtual PRemoteFrameChild* AllocPRemoteFrameChild(
|
virtual PBrowserBridgeChild* AllocPBrowserBridgeChild(
|
||||||
const nsString& aName, const nsString& aRemoteType) override;
|
const nsString& aName, const nsString& aRemoteType) override;
|
||||||
|
|
||||||
virtual bool DeallocPRemoteFrameChild(PRemoteFrameChild* aActor) override;
|
virtual bool DeallocPBrowserBridgeChild(PBrowserBridgeChild* aActor) override;
|
||||||
|
|
||||||
virtual mozilla::ipc::IPCResult RecvDestroy() override;
|
virtual mozilla::ipc::IPCResult RecvDestroy() override;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "mozilla/dom/indexedDB/ActorsParent.h"
|
#include "mozilla/dom/indexedDB/ActorsParent.h"
|
||||||
#include "mozilla/dom/IPCBlobUtils.h"
|
#include "mozilla/dom/IPCBlobUtils.h"
|
||||||
#include "mozilla/dom/PaymentRequestParent.h"
|
#include "mozilla/dom/PaymentRequestParent.h"
|
||||||
#include "mozilla/dom/RemoteFrameParent.h"
|
#include "mozilla/dom/BrowserBridgeParent.h"
|
||||||
#include "mozilla/EventStateManager.h"
|
#include "mozilla/EventStateManager.h"
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||||
|
@ -998,22 +998,22 @@ bool TabParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult TabParent::RecvPRemoteFrameConstructor(PRemoteFrameParent* aActor,
|
IPCResult TabParent::RecvPBrowserBridgeConstructor(
|
||||||
const nsString& aName,
|
PBrowserBridgeParent* aActor, const nsString& aName,
|
||||||
const nsString& aRemoteType) {
|
const nsString& aRemoteType) {
|
||||||
static_cast<RemoteFrameParent*>(aActor)->Init(aName, aRemoteType);
|
static_cast<BrowserBridgeParent*>(aActor)->Init(aName, aRemoteType);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRemoteFrameParent* TabParent::AllocPRemoteFrameParent(
|
PBrowserBridgeParent* TabParent::AllocPBrowserBridgeParent(
|
||||||
const nsString& aName, const nsString& aRemoteType) {
|
const nsString& aName, const nsString& aRemoteType) {
|
||||||
// Reference freed in DeallocPRemoteFrameParent.
|
// Reference freed in DeallocPBrowserBridgeParent.
|
||||||
return do_AddRef(new RemoteFrameParent()).take();
|
return do_AddRef(new BrowserBridgeParent()).take();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabParent::DeallocPRemoteFrameParent(PRemoteFrameParent* aActor) {
|
bool TabParent::DeallocPBrowserBridgeParent(PBrowserBridgeParent* aActor) {
|
||||||
// Free reference from AllocPRemoteFrameParent.
|
// Free reference from AllocPBrowserBridgeParent.
|
||||||
static_cast<RemoteFrameParent*>(aActor)->Release();
|
static_cast<BrowserBridgeParent*>(aActor)->Release();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,13 +315,13 @@ class TabParent final : public PBrowserParent,
|
||||||
virtual mozilla::ipc::IPCResult RecvPWindowGlobalConstructor(
|
virtual mozilla::ipc::IPCResult RecvPWindowGlobalConstructor(
|
||||||
PWindowGlobalParent* aActor, const WindowGlobalInit& aInit) override;
|
PWindowGlobalParent* aActor, const WindowGlobalInit& aInit) override;
|
||||||
|
|
||||||
PRemoteFrameParent* AllocPRemoteFrameParent(const nsString& aPresentationURL,
|
PBrowserBridgeParent* AllocPBrowserBridgeParent(
|
||||||
const nsString& aRemoteType);
|
const nsString& aPresentationURL, const nsString& aRemoteType);
|
||||||
|
|
||||||
bool DeallocPRemoteFrameParent(PRemoteFrameParent* aActor);
|
bool DeallocPBrowserBridgeParent(PBrowserBridgeParent* aActor);
|
||||||
|
|
||||||
virtual mozilla::ipc::IPCResult RecvPRemoteFrameConstructor(
|
virtual mozilla::ipc::IPCResult RecvPBrowserBridgeConstructor(
|
||||||
PRemoteFrameParent* aActor, const nsString& aPresentationURL,
|
PBrowserBridgeParent* aActor, const nsString& aPresentationURL,
|
||||||
const nsString& aRemoteType) override;
|
const nsString& aRemoteType) override;
|
||||||
|
|
||||||
void LoadURL(nsIURI* aURI);
|
void LoadURL(nsIURI* aURI);
|
||||||
|
|
|
@ -28,6 +28,8 @@ EXPORTS.mozilla.dom.ipc += [
|
||||||
]
|
]
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
|
'BrowserBridgeChild.h',
|
||||||
|
'BrowserBridgeParent.h',
|
||||||
'CoalescedInputData.h',
|
'CoalescedInputData.h',
|
||||||
'CoalescedMouseData.h',
|
'CoalescedMouseData.h',
|
||||||
'CoalescedWheelData.h',
|
'CoalescedWheelData.h',
|
||||||
|
@ -44,8 +46,6 @@ EXPORTS.mozilla.dom += [
|
||||||
'JSWindowActorService.h',
|
'JSWindowActorService.h',
|
||||||
'MemoryReportRequest.h',
|
'MemoryReportRequest.h',
|
||||||
'PermissionMessageUtils.h',
|
'PermissionMessageUtils.h',
|
||||||
'RemoteFrameChild.h',
|
|
||||||
'RemoteFrameParent.h',
|
|
||||||
'TabChild.h',
|
'TabChild.h',
|
||||||
'TabContext.h',
|
'TabContext.h',
|
||||||
'TabMessageUtils.h',
|
'TabMessageUtils.h',
|
||||||
|
@ -64,6 +64,8 @@ EXPORTS.mozilla += [
|
||||||
]
|
]
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
|
'BrowserBridgeChild.cpp',
|
||||||
|
'BrowserBridgeParent.cpp',
|
||||||
'CoalescedMouseData.cpp',
|
'CoalescedMouseData.cpp',
|
||||||
'CoalescedWheelData.cpp',
|
'CoalescedWheelData.cpp',
|
||||||
'ColorPickerParent.cpp',
|
'ColorPickerParent.cpp',
|
||||||
|
@ -82,8 +84,6 @@ UNIFIED_SOURCES += [
|
||||||
'PermissionMessageUtils.cpp',
|
'PermissionMessageUtils.cpp',
|
||||||
'PreallocatedProcessManager.cpp',
|
'PreallocatedProcessManager.cpp',
|
||||||
'ProcessPriorityManager.cpp',
|
'ProcessPriorityManager.cpp',
|
||||||
'RemoteFrameChild.cpp',
|
|
||||||
'RemoteFrameParent.cpp',
|
|
||||||
'SharedMap.cpp',
|
'SharedMap.cpp',
|
||||||
'SharedStringMap.cpp',
|
'SharedStringMap.cpp',
|
||||||
'StructuredCloneData.cpp',
|
'StructuredCloneData.cpp',
|
||||||
|
@ -106,6 +106,7 @@ IPDL_SOURCES += [
|
||||||
'DOMTypes.ipdlh',
|
'DOMTypes.ipdlh',
|
||||||
'MemoryReportTypes.ipdlh',
|
'MemoryReportTypes.ipdlh',
|
||||||
'PBrowser.ipdl',
|
'PBrowser.ipdl',
|
||||||
|
'PBrowserBridge.ipdl',
|
||||||
'PBrowserOrId.ipdlh',
|
'PBrowserOrId.ipdlh',
|
||||||
'PColorPicker.ipdl',
|
'PColorPicker.ipdl',
|
||||||
'PContent.ipdl',
|
'PContent.ipdl',
|
||||||
|
@ -117,7 +118,6 @@ IPDL_SOURCES += [
|
||||||
'PPluginWidget.ipdl',
|
'PPluginWidget.ipdl',
|
||||||
'PProcessHangMonitor.ipdl',
|
'PProcessHangMonitor.ipdl',
|
||||||
'PrefsTypes.ipdlh',
|
'PrefsTypes.ipdlh',
|
||||||
'PRemoteFrame.ipdl',
|
|
||||||
'PTabContext.ipdlh',
|
'PTabContext.ipdlh',
|
||||||
'PURLClassifier.ipdl',
|
'PURLClassifier.ipdl',
|
||||||
'PURLClassifierInfo.ipdlh',
|
'PURLClassifierInfo.ipdlh',
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "GLContextProvider.h"
|
#include "GLContextProvider.h"
|
||||||
#include "nsExceptionHandler.h"
|
#include "nsExceptionHandler.h"
|
||||||
#include "mozilla/Range.h"
|
#include "mozilla/Range.h"
|
||||||
|
#include "mozilla/UniquePtr.h"
|
||||||
#include "mozilla/layers/AnimationHelper.h"
|
#include "mozilla/layers/AnimationHelper.h"
|
||||||
#include "mozilla/layers/APZSampler.h"
|
#include "mozilla/layers/APZSampler.h"
|
||||||
#include "mozilla/layers/APZUpdater.h"
|
#include "mozilla/layers/APZUpdater.h"
|
||||||
|
@ -64,6 +65,25 @@ void gecko_profiler_end_marker(const char* name) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gecko_profiler_add_text_marker(const char* name, const char* text_bytes, size_t text_len, uint64_t microseconds) {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
|
if (profiler_thread_is_being_profiled()) {
|
||||||
|
auto now = mozilla::TimeStamp::Now();
|
||||||
|
auto start = now - mozilla::TimeDuration::FromMicroseconds(microseconds);
|
||||||
|
profiler_add_text_marker(
|
||||||
|
name, nsDependentCString(text_bytes, text_len), JS::ProfilingCategoryPair::GRAPHICS, start, now);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gecko_profiler_thread_is_being_profiled() {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
|
return profiler_thread_is_being_profiled();
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool is_glcontext_egl(void* glcontext_ptr) {
|
bool is_glcontext_egl(void* glcontext_ptr) {
|
||||||
MOZ_ASSERT(glcontext_ptr);
|
MOZ_ASSERT(glcontext_ptr);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ use std::ops::Range;
|
||||||
use std::os::raw::{c_void, c_char, c_float};
|
use std::os::raw::{c_void, c_char, c_float};
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use std::os::raw::{c_int};
|
use std::os::raw::{c_int};
|
||||||
|
use std::time::Duration;
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
|
|
||||||
use webrender::api::*;
|
use webrender::api::*;
|
||||||
|
@ -757,6 +758,9 @@ pub unsafe extern "C" fn wr_pipeline_info_delete(_info: WrPipelineInfo) {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn gecko_profiler_start_marker(name: *const c_char);
|
pub fn gecko_profiler_start_marker(name: *const c_char);
|
||||||
pub fn gecko_profiler_end_marker(name: *const c_char);
|
pub fn gecko_profiler_end_marker(name: *const c_char);
|
||||||
|
pub fn gecko_profiler_add_text_marker(
|
||||||
|
name: *const c_char, text_bytes: *const c_char, text_len: usize, microseconds: u64);
|
||||||
|
pub fn gecko_profiler_thread_is_being_profiled() -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Simple implementation of the WR ProfilerHooks trait to allow profile
|
/// Simple implementation of the WR ProfilerHooks trait to allow profile
|
||||||
|
@ -775,6 +779,19 @@ impl ProfilerHooks for GeckoProfilerHooks {
|
||||||
gecko_profiler_end_marker(label.as_ptr());
|
gecko_profiler_end_marker(label.as_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_text_marker(&self, label: &CStr, text: &str, duration: Duration) {
|
||||||
|
unsafe {
|
||||||
|
// NB: This can be as_micros() once we require Rust 1.33.
|
||||||
|
let micros = duration.subsec_micros() as u64 + duration.as_secs() * 1000 * 1000;
|
||||||
|
let text_bytes = text.as_bytes();
|
||||||
|
gecko_profiler_add_text_marker(label.as_ptr(), text_bytes.as_ptr() as *const c_char, text_bytes.len(), micros);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn thread_is_being_profiled(&self) -> bool {
|
||||||
|
unsafe { gecko_profiler_thread_is_being_profiled() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PROFILER_HOOKS: GeckoProfilerHooks = GeckoProfilerHooks {};
|
static PROFILER_HOOKS: GeckoProfilerHooks = GeckoProfilerHooks {};
|
||||||
|
|
|
@ -33,6 +33,9 @@ void gecko_profiler_unregister_thread();
|
||||||
|
|
||||||
void gecko_profiler_start_marker(const char* name);
|
void gecko_profiler_start_marker(const char* name);
|
||||||
void gecko_profiler_end_marker(const char* name);
|
void gecko_profiler_end_marker(const char* name);
|
||||||
|
void gecko_profiler_add_text_marker(
|
||||||
|
const char* name, const char* text_ptr, size_t text_len, uint64_t microseconds);
|
||||||
|
bool gecko_profiler_thread_is_being_profiled();
|
||||||
|
|
||||||
// IMPORTANT: Keep this synchronized with enumerate_interners in
|
// IMPORTANT: Keep this synchronized with enumerate_interners in
|
||||||
// gfx/wr/webrender_api
|
// gfx/wr/webrender_api
|
||||||
|
|
|
@ -143,7 +143,7 @@ name = "cgl"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ name = "direct-composition"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mozangle 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"webrender 0.60.0",
|
"webrender 0.60.0",
|
||||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -569,7 +569,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gleam"
|
name = "gleam"
|
||||||
version = "0.6.11"
|
version = "0.6.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1645,7 +1645,7 @@ dependencies = [
|
||||||
"dwrote 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dwrote 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1681,7 +1681,7 @@ dependencies = [
|
||||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"webrender 0.60.0",
|
"webrender 0.60.0",
|
||||||
|
@ -1799,7 +1799,7 @@ dependencies = [
|
||||||
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1946,7 +1946,7 @@ dependencies = [
|
||||||
"checksum gif 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3414b424657317e708489d2857d9575f4403698428b040b609b9d1c1a84a2c"
|
"checksum gif 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3414b424657317e708489d2857d9575f4403698428b040b609b9d1c1a84a2c"
|
||||||
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
|
||||||
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
||||||
"checksum gleam 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b93018064928ec67c429c9c9416affd93660419dbf84767fff6b8a99fbe9c277"
|
"checksum gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f1519ca611d230e1deadbedfb79044b921ac4a961ab8823fef10e37271e2c38e"
|
||||||
"checksum glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70c5fe78efbd5a3b243a804ea1032053c584510f8822819f94cfb29b2100317"
|
"checksum glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70c5fe78efbd5a3b243a804ea1032053c584510f8822819f94cfb29b2100317"
|
||||||
"checksum half 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d5c5f71a723d10dfc58927cbed37c3071a50afc7f073d86fd7d3e5727db890f"
|
"checksum half 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d5c5f71a723d10dfc58927cbed37c3071a50afc7f073d86fd7d3e5727db890f"
|
||||||
"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37"
|
"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37"
|
||||||
|
|
|
@ -30,7 +30,7 @@ byteorder = "1.0"
|
||||||
cfg-if = "0.1.2"
|
cfg-if = "0.1.2"
|
||||||
cstr = "0.1.2"
|
cstr = "0.1.2"
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
gleam = "0.6.11"
|
gleam = "0.6.12"
|
||||||
image = { optional = true, version = "0.21" }
|
image = { optional = true, version = "0.21" }
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
@ -10,6 +10,7 @@ use euclid::Transform3D;
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
use internal_types::{FastHashMap, LayerIndex, RenderTargetInfo};
|
use internal_types::{FastHashMap, LayerIndex, RenderTargetInfo};
|
||||||
use log::Level;
|
use log::Level;
|
||||||
|
use profiler;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -28,6 +29,7 @@ use std::slice;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
use std::time::Duration;
|
||||||
use webrender_build::shader::ProgramSourceDigest;
|
use webrender_build::shader::ProgramSourceDigest;
|
||||||
use webrender_build::shader::{parse_shader_source, shader_source_from_file};
|
use webrender_build::shader::{parse_shader_source, shader_source_from_file};
|
||||||
|
|
||||||
|
@ -919,6 +921,11 @@ enum TexStorageUsage {
|
||||||
|
|
||||||
pub struct Device {
|
pub struct Device {
|
||||||
gl: Rc<gl::Gl>,
|
gl: Rc<gl::Gl>,
|
||||||
|
|
||||||
|
/// If non-None, |gl| points to a profiling wrapper, and this points to the
|
||||||
|
/// underling Gl instance.
|
||||||
|
base_gl: Option<Rc<gl::Gl>>,
|
||||||
|
|
||||||
// device state
|
// device state
|
||||||
bound_textures: [gl::GLuint; 16],
|
bound_textures: [gl::GLuint; 16],
|
||||||
bound_program: gl::GLuint,
|
bound_program: gl::GLuint,
|
||||||
|
@ -1235,6 +1242,7 @@ impl Device {
|
||||||
|
|
||||||
Device {
|
Device {
|
||||||
gl,
|
gl,
|
||||||
|
base_gl: None,
|
||||||
resource_override_path,
|
resource_override_path,
|
||||||
upload_method,
|
upload_method,
|
||||||
inside_frame: false,
|
inside_frame: false,
|
||||||
|
@ -1363,6 +1371,22 @@ impl Device {
|
||||||
debug_assert!(!self.inside_frame);
|
debug_assert!(!self.inside_frame);
|
||||||
self.inside_frame = true;
|
self.inside_frame = true;
|
||||||
|
|
||||||
|
// If our profiler state has changed, apply or remove the profiling
|
||||||
|
// wrapper from our GL context.
|
||||||
|
let being_profiled = profiler::thread_is_being_profiled();
|
||||||
|
let using_wrapper = self.base_gl.is_some();
|
||||||
|
if being_profiled && !using_wrapper {
|
||||||
|
fn note(name: &str, duration: Duration) {
|
||||||
|
profiler::add_text_marker(cstr!("OpenGL Calls"), name, duration);
|
||||||
|
}
|
||||||
|
let threshold = Duration::from_millis(1);
|
||||||
|
let wrapped = gl::ProfilingGl::wrap(self.gl.clone(), threshold, note);
|
||||||
|
let base = mem::replace(&mut self.gl, wrapped);
|
||||||
|
self.base_gl = Some(base);
|
||||||
|
} else if !being_profiled && using_wrapper {
|
||||||
|
self.gl = self.base_gl.take().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve the currently set FBO.
|
// Retrieve the currently set FBO.
|
||||||
let mut default_read_fbo = [0];
|
let mut default_read_fbo = [0];
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -485,6 +485,89 @@ pub struct RasterizedGlyph {
|
||||||
pub bytes: Vec<u8>,
|
pub bytes: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RasterizedGlyph {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn downscale_bitmap_if_required(&mut self, font: &FontInstance) {
|
||||||
|
// Check if the glyph is going to be downscaled in the shader. If the scaling is
|
||||||
|
// less than 0.5, that means bilinear filtering can't effectively filter the glyph
|
||||||
|
// without aliasing artifacts.
|
||||||
|
//
|
||||||
|
// Instead of fixing this by mipmapping the glyph cache texture, rather manually
|
||||||
|
// produce the appropriate mip level for individual glyphs where bilinear filtering
|
||||||
|
// will still produce acceptable results.
|
||||||
|
match self.format {
|
||||||
|
GlyphFormat::Bitmap | GlyphFormat::ColorBitmap => {},
|
||||||
|
_ => return,
|
||||||
|
}
|
||||||
|
let (x_scale, y_scale) = font.transform.compute_scale().unwrap_or((1.0, 1.0));
|
||||||
|
let upscaled = x_scale.max(y_scale) as f32;
|
||||||
|
let mut new_scale = self.scale;
|
||||||
|
if new_scale * upscaled <= 0.0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let mut steps = 0;
|
||||||
|
while new_scale * upscaled <= 0.5 {
|
||||||
|
new_scale *= 2.0;
|
||||||
|
steps += 1;
|
||||||
|
}
|
||||||
|
// If no mipping is necessary, just bail.
|
||||||
|
if steps == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the actual size of the mip level.
|
||||||
|
let new_width = (self.width as usize + (1 << steps) - 1) >> steps;
|
||||||
|
let new_height = (self.height as usize + (1 << steps) - 1) >> steps;
|
||||||
|
let mut new_bytes: Vec<u8> = Vec::with_capacity(new_width * new_height * 4);
|
||||||
|
|
||||||
|
// Produce destination pixels by applying a box filter to the source pixels.
|
||||||
|
// The box filter corresponds to how graphics drivers may generate mipmaps.
|
||||||
|
for y in 0 .. new_height {
|
||||||
|
for x in 0 .. new_width {
|
||||||
|
// Calculate the number of source samples that contribute to the destination pixel.
|
||||||
|
let src_y = y << steps;
|
||||||
|
let src_x = x << steps;
|
||||||
|
let y_samples = (1 << steps).min(self.height as usize - src_y);
|
||||||
|
let x_samples = (1 << steps).min(self.width as usize - src_x);
|
||||||
|
let num_samples = (x_samples * y_samples) as u32;
|
||||||
|
|
||||||
|
let mut src_idx = (src_y * self.width as usize + src_x) * 4;
|
||||||
|
// Initialize the accumulator with half an increment so that when later divided
|
||||||
|
// by the sample count, it will effectively round the accumulator to the nearest
|
||||||
|
// increment.
|
||||||
|
let mut accum = [num_samples / 2; 4];
|
||||||
|
// Accumulate all the contributing source sampless.
|
||||||
|
for _ in 0 .. y_samples {
|
||||||
|
for _ in 0 .. x_samples {
|
||||||
|
accum[0] += self.bytes[src_idx + 0] as u32;
|
||||||
|
accum[1] += self.bytes[src_idx + 1] as u32;
|
||||||
|
accum[2] += self.bytes[src_idx + 2] as u32;
|
||||||
|
accum[3] += self.bytes[src_idx + 3] as u32;
|
||||||
|
src_idx += 4;
|
||||||
|
}
|
||||||
|
src_idx += (self.width as usize - x_samples) * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally, divide by the sample count to get the mean value for the new pixel.
|
||||||
|
new_bytes.extend_from_slice(&[
|
||||||
|
(accum[0] / num_samples) as u8,
|
||||||
|
(accum[1] / num_samples) as u8,
|
||||||
|
(accum[2] / num_samples) as u8,
|
||||||
|
(accum[3] / num_samples) as u8,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix the bounds for the new glyph data.
|
||||||
|
self.top /= (1 << steps) as f32;
|
||||||
|
self.left /= (1 << steps) as f32;
|
||||||
|
self.width = new_width as i32;
|
||||||
|
self.height = new_height as i32;
|
||||||
|
self.scale = new_scale;
|
||||||
|
self.bytes = new_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct FontContexts {
|
pub struct FontContexts {
|
||||||
// These worker are mostly accessed from their corresponding worker threads.
|
// These worker are mostly accessed from their corresponding worker threads.
|
||||||
// The goal is that there should be no noticeable contention on the mutexes.
|
// The goal is that there should be no noticeable contention on the mutexes.
|
||||||
|
|
|
@ -107,18 +107,22 @@ impl GlyphRasterizer {
|
||||||
.map(|key: &GlyphKey| {
|
.map(|key: &GlyphKey| {
|
||||||
profile_scope!("glyph-raster");
|
profile_scope!("glyph-raster");
|
||||||
let mut context = font_contexts.lock_current_context();
|
let mut context = font_contexts.lock_current_context();
|
||||||
let job = GlyphRasterJob {
|
let mut job = GlyphRasterJob {
|
||||||
key: key.clone(),
|
key: key.clone(),
|
||||||
result: context.rasterize_glyph(&font, key),
|
result: context.rasterize_glyph(&font, key),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sanity check.
|
if let Ok(ref mut glyph) = job.result {
|
||||||
if let Ok(ref glyph) = job.result {
|
// Sanity check.
|
||||||
let bpp = 4; // We always render glyphs in 32 bits RGBA format.
|
let bpp = 4; // We always render glyphs in 32 bits RGBA format.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
glyph.bytes.len(),
|
glyph.bytes.len(),
|
||||||
bpp * (glyph.width * glyph.height) as usize
|
bpp * (glyph.width * glyph.height) as usize
|
||||||
);
|
);
|
||||||
|
assert_eq!((glyph.left.fract(), glyph.top.fract()), (0.0, 0.0));
|
||||||
|
|
||||||
|
// Check if the glyph has a bitmap that needs to be downscaled.
|
||||||
|
glyph.downscale_bitmap_if_required(&font);
|
||||||
}
|
}
|
||||||
|
|
||||||
job
|
job
|
||||||
|
@ -166,7 +170,6 @@ impl GlyphRasterizer {
|
||||||
GlyphCacheEntry::Blank
|
GlyphCacheEntry::Blank
|
||||||
}
|
}
|
||||||
Ok(glyph) => {
|
Ok(glyph) => {
|
||||||
assert_eq!((glyph.left.fract(), glyph.top.fract()), (0.0, 0.0));
|
|
||||||
let mut texture_cache_handle = TextureCacheHandle::invalid();
|
let mut texture_cache_handle = TextureCacheHandle::invalid();
|
||||||
texture_cache.request(&texture_cache_handle, gpu_cache);
|
texture_cache.request(&texture_cache_handle, gpu_cache);
|
||||||
texture_cache.update(
|
texture_cache.update(
|
||||||
|
|
|
@ -11,6 +11,7 @@ use renderer::{MAX_VERTEX_TEXTURE_WIDTH, wr_has_been_initialized};
|
||||||
use std::collections::vec_deque::VecDeque;
|
use std::collections::vec_deque::VecDeque;
|
||||||
use std::{f32, mem};
|
use std::{f32, mem};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
use std::time::Duration;
|
||||||
use time::precise_time_ns;
|
use time::precise_time_ns;
|
||||||
|
|
||||||
const GRAPH_WIDTH: f32 = 1024.0;
|
const GRAPH_WIDTH: f32 = 1024.0;
|
||||||
|
@ -30,10 +31,22 @@ pub trait ProfilerHooks : Send + Sync {
|
||||||
/// Called at the end of a profile scope. The label must
|
/// Called at the end of a profile scope. The label must
|
||||||
/// be a C string (null terminated).
|
/// be a C string (null terminated).
|
||||||
fn end_marker(&self, label: &CStr);
|
fn end_marker(&self, label: &CStr);
|
||||||
|
|
||||||
|
/// Called with a duration to indicate a text marker that just ended. Text
|
||||||
|
/// markers allow different types of entries to be recorded on the same row
|
||||||
|
/// in the timeline, by adding labels to the entry.
|
||||||
|
///
|
||||||
|
/// This variant is also useful when the caller only wants to record events
|
||||||
|
/// longer than a certain threshold, and thus they don't know in advance
|
||||||
|
/// whether the event will qualify.
|
||||||
|
fn add_text_marker(&self, label: &CStr, text: &str, duration: Duration);
|
||||||
|
|
||||||
|
/// Returns true if the current thread is being profiled.
|
||||||
|
fn thread_is_being_profiled(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The current global profiler callbacks, if set by embedder.
|
/// The current global profiler callbacks, if set by embedder.
|
||||||
static mut PROFILER_HOOKS: Option<&'static ProfilerHooks> = None;
|
pub static mut PROFILER_HOOKS: Option<&'static ProfilerHooks> = None;
|
||||||
|
|
||||||
/// Set the profiler callbacks, or None to disable the profiler.
|
/// Set the profiler callbacks, or None to disable the profiler.
|
||||||
/// This function must only ever be called before any WR instances
|
/// This function must only ever be called before any WR instances
|
||||||
|
@ -51,6 +64,22 @@ pub struct ProfileScope {
|
||||||
name: &'static CStr,
|
name: &'static CStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Records a marker of the given duration that just ended.
|
||||||
|
pub fn add_text_marker(label: &CStr, text: &str, duration: Duration) {
|
||||||
|
unsafe {
|
||||||
|
if let Some(ref hooks) = PROFILER_HOOKS {
|
||||||
|
hooks.add_text_marker(label, text, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if the current thread is being profiled.
|
||||||
|
pub fn thread_is_being_profiled() -> bool {
|
||||||
|
unsafe {
|
||||||
|
PROFILER_HOOKS.map_or(false, |h| h.thread_is_being_profiled())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ProfileScope {
|
impl ProfileScope {
|
||||||
/// Begin a new profile scope
|
/// Begin a new profile scope
|
||||||
pub fn new(name: &'static CStr) -> Self {
|
pub fn new(name: &'static CStr) -> Self {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/dom/RemoteFrameChild.h"
|
|
||||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||||
#include "mozilla/layers/CompositorTypes.h"
|
#include "mozilla/layers/CompositorTypes.h"
|
||||||
#include "mozilla/layers/LayerTransactionParent.h"
|
#include "mozilla/layers/LayerTransactionParent.h"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
a306d84e4c70
|
NSS_3_43_BETA1
|
||||||
|
|
|
@ -10,4 +10,3 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#error "Do not include this header file."
|
#error "Do not include this header file."
|
||||||
|
|
||||||
|
|
|
@ -1683,8 +1683,8 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue)
|
||||||
SECStatus rv;
|
SECStatus rv;
|
||||||
SECKEYPublicKey pubKey;
|
SECKEYPublicKey pubKey;
|
||||||
PLArenaPool *arena;
|
PLArenaPool *arena;
|
||||||
PK11SlotInfo *slot = privKey->pkcs11Slot;
|
PK11SlotInfo *slot;
|
||||||
CK_OBJECT_HANDLE privKeyID = privKey->pkcs11ID;
|
CK_OBJECT_HANDLE privKeyID;
|
||||||
|
|
||||||
if (privKey == NULL || publicValue == NULL ||
|
if (privKey == NULL || publicValue == NULL ||
|
||||||
publicValue->data == NULL || publicValue->len == 0) {
|
publicValue->data == NULL || publicValue->len == 0) {
|
||||||
|
@ -1704,6 +1704,9 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue)
|
||||||
if (arena == NULL) {
|
if (arena == NULL) {
|
||||||
return SECFailure;
|
return SECFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slot = privKey->pkcs11Slot;
|
||||||
|
privKeyID = privKey->pkcs11ID;
|
||||||
rv = SECFailure;
|
rv = SECFailure;
|
||||||
switch (privKey->keyType) {
|
switch (privKey->keyType) {
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -331,7 +331,6 @@ class MarionetteParentProcess {
|
||||||
case "profile-after-change":
|
case "profile-after-change":
|
||||||
Services.obs.addObserver(this, "command-line-startup");
|
Services.obs.addObserver(this, "command-line-startup");
|
||||||
Services.obs.addObserver(this, "sessionstore-windows-restored");
|
Services.obs.addObserver(this, "sessionstore-windows-restored");
|
||||||
Services.obs.addObserver(this, "mail-startup-done");
|
|
||||||
Services.obs.addObserver(this, "toplevel-window-ready");
|
Services.obs.addObserver(this, "toplevel-window-ready");
|
||||||
Services.obs.addObserver(this, "marionette-startup-requested");
|
Services.obs.addObserver(this, "marionette-startup-requested");
|
||||||
|
|
||||||
|
@ -386,11 +385,6 @@ class MarionetteParentProcess {
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Thunderbird only, instead of sessionstore-windows-restored.
|
|
||||||
case "mail-startup-done":
|
|
||||||
Services.obs.notifyObservers(this, "marionette-startup-requested");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "sessionstore-windows-restored":
|
case "sessionstore-windows-restored":
|
||||||
Services.obs.removeObserver(this, topic);
|
Services.obs.removeObserver(this, topic);
|
||||||
Services.obs.removeObserver(this, "toplevel-window-ready");
|
Services.obs.removeObserver(this, "toplevel-window-ready");
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"files":{"COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"21b5a3688fbbf5754800451efbdf5ee78c259657b70ecb7334c3ef91524ddba4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"1acb12040be43a3582d5897f11870b3ffdcd7ce0f4f32de158175bb6b33ec0b7","build.rs":"9881de207dd6a0347e66df9190ad0a095a2d7f0f32eff567f9ae7eb7de04c59b","rustfmt.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/gl.rs":"6bb2e2bb78982e3de6ad4f0d4ac9b9026042c727e39c10c9d2f8e886eefbc0f2","src/gl_fns.rs":"fc4c8898788c19f61b9e053475f122fb74370c1fecece978f276d6d59c487f99","src/gles_fns.rs":"7abaeed120d24414a4ed38e4fa2b81aa68de1d72e0e378e087b8a231593a3c23","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"b93018064928ec67c429c9c9416affd93660419dbf84767fff6b8a99fbe9c277"}
|
{"files":{"COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"278158d345365c00bddd760e0684f94a3e057713bdd30492e0cf308fa2d9afcd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"1acb12040be43a3582d5897f11870b3ffdcd7ce0f4f32de158175bb6b33ec0b7","build.rs":"9881de207dd6a0347e66df9190ad0a095a2d7f0f32eff567f9ae7eb7de04c59b","rustfmt.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/gl.rs":"ce511d167611653621bac2d3c31e569312ccdff7c954ed80c790972d37519425","src/gl_fns.rs":"fc4c8898788c19f61b9e053475f122fb74370c1fecece978f276d6d59c487f99","src/gles_fns.rs":"7abaeed120d24414a4ed38e4fa2b81aa68de1d72e0e378e087b8a231593a3c23","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"f1519ca611d230e1deadbedfb79044b921ac4a961ab8823fef10e37271e2c38e"}
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "gleam"
|
name = "gleam"
|
||||||
version = "0.6.11"
|
version = "0.6.12"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
description = "Generated OpenGL bindings and wrapper for Servo."
|
description = "Generated OpenGL bindings and wrapper for Servo."
|
||||||
|
|
|
@ -15,6 +15,7 @@ use std::os::raw::{c_char, c_int, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
pub use ffi::types::*;
|
pub use ffi::types::*;
|
||||||
pub use ffi::*;
|
pub use ffi::*;
|
||||||
|
@ -98,6 +99,18 @@ macro_rules! declare_gl_apis {
|
||||||
rv
|
rv
|
||||||
})+
|
})+
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<F: Fn(&str, Duration)> Gl for ProfilingGl<F> {
|
||||||
|
$($(unsafe $($garbo)*)* fn $name(&self $(, $arg:$t)*) $(-> $retty)* {
|
||||||
|
let start = Instant::now();
|
||||||
|
let rv = self.gl.$name($($arg,)*);
|
||||||
|
let duration = Instant::now() - start;
|
||||||
|
if duration > self.threshold {
|
||||||
|
(self.callback)(stringify!($name), duration);
|
||||||
|
}
|
||||||
|
rv
|
||||||
|
})+
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,6 +597,20 @@ impl<F: 'static + Fn(&Gl, &str, GLenum)> ErrorReactingGl<F> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A wrapper around GL context that times each call and invokes the callback
|
||||||
|
/// if the call takes longer than the threshold.
|
||||||
|
pub struct ProfilingGl<F> {
|
||||||
|
gl: Rc<Gl>,
|
||||||
|
threshold: Duration,
|
||||||
|
callback: F,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<F: 'static + Fn(&str, Duration)> ProfilingGl<F> {
|
||||||
|
pub fn wrap(fns: Rc<Gl>, threshold: Duration, callback: F) -> Rc<Gl> {
|
||||||
|
Rc::new(ProfilingGl { gl: fns, threshold, callback }) as Rc<Gl>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn buffer_data<T>(gl_: &Gl, target: GLenum, data: &[T], usage: GLenum) {
|
pub fn buffer_data<T>(gl_: &Gl, target: GLenum, data: &[T], usage: GLenum) {
|
||||||
gl_.buffer_data_untyped(
|
gl_.buffer_data_untyped(
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
var REGEXPS = {
|
var REGEXPS = {
|
||||||
// NOTE: These two regular expressions are duplicated in
|
// NOTE: These two regular expressions are duplicated in
|
||||||
// Readability.js. Please keep both copies in sync.
|
// Readability.js. Please keep both copies in sync.
|
||||||
unlikelyCandidates: /-ad-|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
||||||
okMaybeItsACandidate: /and|article|body|column|main|shadow/i,
|
okMaybeItsACandidate: /and|article|body|column|main|shadow/i,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,11 @@ Readability.prototype = {
|
||||||
REGEXPS: {
|
REGEXPS: {
|
||||||
// NOTE: These two regular expressions are duplicated in
|
// NOTE: These two regular expressions are duplicated in
|
||||||
// Readability-readerable.js. Please keep both copies in sync.
|
// Readability-readerable.js. Please keep both copies in sync.
|
||||||
unlikelyCandidates: /-ad-|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
|
||||||
okMaybeItsACandidate: /and|article|body|column|main|shadow/i,
|
okMaybeItsACandidate: /and|article|body|column|main|shadow/i,
|
||||||
|
|
||||||
positive: /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,
|
positive: /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,
|
||||||
negative: /hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,
|
negative: /hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,
|
||||||
extraneous: /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,
|
extraneous: /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,
|
||||||
byline: /byline|author|dateline|writtenby|p-author/i,
|
byline: /byline|author|dateline|writtenby|p-author/i,
|
||||||
replaceFonts: /<(\/?)font[^>]*>/gi,
|
replaceFonts: /<(\/?)font[^>]*>/gi,
|
||||||
|
@ -584,10 +584,15 @@ Readability.prototype = {
|
||||||
this._clean(articleContent, "link");
|
this._clean(articleContent, "link");
|
||||||
this._clean(articleContent, "aside");
|
this._clean(articleContent, "aside");
|
||||||
|
|
||||||
// Clean out elements have "share" in their id/class combinations from final top candidates,
|
// Clean out elements with little content that have "share" in their id/class combinations from final top candidates,
|
||||||
// which means we don't remove the top candidates even they have "share".
|
// which means we don't remove the top candidates even they have "share".
|
||||||
this._forEachNode(articleContent.children, function(topCandidate) {
|
|
||||||
this._cleanMatchedNodes(topCandidate, /share/);
|
var shareElementThreshold = this.DEFAULT_CHAR_THRESHOLD;
|
||||||
|
|
||||||
|
this._forEachNode(articleContent.children, function (topCandidate) {
|
||||||
|
this._cleanMatchedNodes(topCandidate, function (node, matchString) {
|
||||||
|
return /share/.test(matchString) && node.textContent.length < shareElementThreshold;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// If there is only one h2 and its text content substantially equals article title,
|
// If there is only one h2 and its text content substantially equals article title,
|
||||||
|
@ -738,9 +743,10 @@ Readability.prototype = {
|
||||||
|
|
||||||
if (node.getAttribute !== undefined) {
|
if (node.getAttribute !== undefined) {
|
||||||
var rel = node.getAttribute("rel");
|
var rel = node.getAttribute("rel");
|
||||||
|
var itemprop = node.getAttribute("itemprop");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rel === "author" || this.REGEXPS.byline.test(matchString)) && this._isValidByline(node.textContent)) {
|
if ((rel === "author" || (itemprop && itemprop.indexOf("author") !== -1) || this.REGEXPS.byline.test(matchString)) && this._isValidByline(node.textContent)) {
|
||||||
this._articleByline = node.textContent.trim();
|
this._articleByline = node.textContent.trim();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -809,6 +815,7 @@ Readability.prototype = {
|
||||||
if (stripUnlikelyCandidates) {
|
if (stripUnlikelyCandidates) {
|
||||||
if (this.REGEXPS.unlikelyCandidates.test(matchString) &&
|
if (this.REGEXPS.unlikelyCandidates.test(matchString) &&
|
||||||
!this.REGEXPS.okMaybeItsACandidate.test(matchString) &&
|
!this.REGEXPS.okMaybeItsACandidate.test(matchString) &&
|
||||||
|
!this._hasAncestorTag(node, "table") &&
|
||||||
node.tagName !== "BODY" &&
|
node.tagName !== "BODY" &&
|
||||||
node.tagName !== "A") {
|
node.tagName !== "A") {
|
||||||
this.log("Removing unlikely candidate - " + matchString);
|
this.log("Removing unlikely candidate - " + matchString);
|
||||||
|
@ -1488,17 +1495,17 @@ Readability.prototype = {
|
||||||
this._removeNodes(e.getElementsByTagName(tag), function(element) {
|
this._removeNodes(e.getElementsByTagName(tag), function(element) {
|
||||||
// Allow youtube and vimeo videos through as people usually want to see those.
|
// Allow youtube and vimeo videos through as people usually want to see those.
|
||||||
if (isEmbed) {
|
if (isEmbed) {
|
||||||
var attributeValues = [].map.call(element.attributes, function(attr) {
|
|
||||||
return attr.value;
|
|
||||||
}).join("|");
|
|
||||||
|
|
||||||
// First, check the elements attributes to see if any of them contain youtube or vimeo
|
// First, check the elements attributes to see if any of them contain youtube or vimeo
|
||||||
if (this.REGEXPS.videos.test(attributeValues))
|
for (var i = 0; i < element.attributes.length; i++) {
|
||||||
return false;
|
if (this.REGEXPS.videos.test(element.attributes[i].value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Then check the elements inside this element for the same.
|
// For embed with <object> tag, check inner HTML as well.
|
||||||
if (this.REGEXPS.videos.test(element.innerHTML))
|
if (element.tagName === "object" && this.REGEXPS.videos.test(element.innerHTML)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1634,11 +1641,16 @@ Readability.prototype = {
|
||||||
//
|
//
|
||||||
// TODO: Consider taking into account original contentScore here.
|
// TODO: Consider taking into account original contentScore here.
|
||||||
this._removeNodes(e.getElementsByTagName(tag), function(node) {
|
this._removeNodes(e.getElementsByTagName(tag), function(node) {
|
||||||
// First check if we're in a data table, in which case don't remove us.
|
// First check if this node IS data table, in which case don't remove it.
|
||||||
var isDataTable = function(t) {
|
var isDataTable = function(t) {
|
||||||
return t._readabilityDataTable;
|
return t._readabilityDataTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (tag === "table" && isDataTable(node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next check if we're inside a data table, in which case don't remove it as well.
|
||||||
if (this._hasAncestorTag(node, "table", -1, isDataTable)) {
|
if (this._hasAncestorTag(node, "table", -1, isDataTable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1662,10 +1674,25 @@ Readability.prototype = {
|
||||||
var input = node.getElementsByTagName("input").length;
|
var input = node.getElementsByTagName("input").length;
|
||||||
|
|
||||||
var embedCount = 0;
|
var embedCount = 0;
|
||||||
var embeds = node.getElementsByTagName("embed");
|
var embeds = this._concatNodeLists(
|
||||||
for (var ei = 0, il = embeds.length; ei < il; ei += 1) {
|
node.getElementsByTagName("object"),
|
||||||
if (!this.REGEXPS.videos.test(embeds[ei].src))
|
node.getElementsByTagName("embed"),
|
||||||
embedCount += 1;
|
node.getElementsByTagName("iframe"));
|
||||||
|
|
||||||
|
for (var i = 0; i < embeds.length; i++) {
|
||||||
|
// If this embed has attribute that matches video regex, don't delete it.
|
||||||
|
for (var j = 0; j < embeds[i].attributes.length; j++) {
|
||||||
|
if (this.REGEXPS.videos.test(embeds[i].attributes[j].value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For embed with <object> tag, check inner HTML as well.
|
||||||
|
if (embeds[i].tagName === "object" && this.REGEXPS.videos.test(embeds[i].innerHTML)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
embedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var linkDensity = this._getLinkDensity(node);
|
var linkDensity = this._getLinkDensity(node);
|
||||||
|
@ -1686,17 +1713,17 @@ Readability.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean out elements whose id/class combinations match specific string.
|
* Clean out elements that match the specified conditions
|
||||||
*
|
*
|
||||||
* @param Element
|
* @param Element
|
||||||
* @param RegExp match id/class combination.
|
* @param Function determines whether a node should be removed
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
_cleanMatchedNodes: function(e, regex) {
|
_cleanMatchedNodes: function(e, filter) {
|
||||||
var endOfSearchMarkerNode = this._getNextNode(e, true);
|
var endOfSearchMarkerNode = this._getNextNode(e, true);
|
||||||
var next = this._getNextNode(e);
|
var next = this._getNextNode(e);
|
||||||
while (next && next != endOfSearchMarkerNode) {
|
while (next && next != endOfSearchMarkerNode) {
|
||||||
if (regex.test(next.className + " " + next.id)) {
|
if (filter(next, next.className + " " + next.id)) {
|
||||||
next = this._removeAndGetNext(next);
|
next = this._removeAndGetNext(next);
|
||||||
} else {
|
} else {
|
||||||
next = this._getNextNode(next);
|
next = this._getNextNode(next);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче