From 278fe39848b0110ac4ad4b0976ae06075c7a5b25 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Fri, 8 Mar 2019 18:17:11 +0000 Subject: [PATCH 1/8] Bug 1531712 - update readability to 9009f64f9ce8b7d593c1ef90864843f72e193cba from github, rs=already-reviewed --HG-- extra : rebase_source : 3ef0ad66be0c257d8c73f9a196b6c0033c7f0069 --- .../reader/Readability-readerable.js | 2 +- toolkit/components/reader/Readability.js | 73 +++++++++++++------ 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/toolkit/components/reader/Readability-readerable.js b/toolkit/components/reader/Readability-readerable.js index d0e1b8164acd..27daec4cb266 100644 --- a/toolkit/components/reader/Readability-readerable.js +++ b/toolkit/components/reader/Readability-readerable.js @@ -31,7 +31,7 @@ var REGEXPS = { // NOTE: These two regular expressions are duplicated in // 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, }; diff --git a/toolkit/components/reader/Readability.js b/toolkit/components/reader/Readability.js index d4fdc127383e..f3ff6f07e9f5 100644 --- a/toolkit/components/reader/Readability.js +++ b/toolkit/components/reader/Readability.js @@ -121,11 +121,11 @@ Readability.prototype = { REGEXPS: { // NOTE: These two regular expressions are duplicated in // 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, 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, byline: /byline|author|dateline|writtenby|p-author/i, replaceFonts: /<(\/?)font[^>]*>/gi, @@ -584,10 +584,15 @@ Readability.prototype = { this._clean(articleContent, "link"); 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". - 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, @@ -738,9 +743,10 @@ Readability.prototype = { if (node.getAttribute !== undefined) { 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(); return true; } @@ -809,6 +815,7 @@ Readability.prototype = { if (stripUnlikelyCandidates) { if (this.REGEXPS.unlikelyCandidates.test(matchString) && !this.REGEXPS.okMaybeItsACandidate.test(matchString) && + !this._hasAncestorTag(node, "table") && node.tagName !== "BODY" && node.tagName !== "A") { this.log("Removing unlikely candidate - " + matchString); @@ -1488,17 +1495,17 @@ Readability.prototype = { this._removeNodes(e.getElementsByTagName(tag), function(element) { // Allow youtube and vimeo videos through as people usually want to see those. 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 - if (this.REGEXPS.videos.test(attributeValues)) - return false; + for (var i = 0; i < element.attributes.length; i++) { + if (this.REGEXPS.videos.test(element.attributes[i].value)) { + return false; + } + } - // Then check the elements inside this element for the same. - if (this.REGEXPS.videos.test(element.innerHTML)) + // For embed with tag, check inner HTML as well. + if (element.tagName === "object" && this.REGEXPS.videos.test(element.innerHTML)) { return false; + } } return true; @@ -1634,11 +1641,16 @@ Readability.prototype = { // // TODO: Consider taking into account original contentScore here. 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) { 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)) { return false; } @@ -1662,10 +1674,25 @@ Readability.prototype = { var input = node.getElementsByTagName("input").length; var embedCount = 0; - var embeds = node.getElementsByTagName("embed"); - for (var ei = 0, il = embeds.length; ei < il; ei += 1) { - if (!this.REGEXPS.videos.test(embeds[ei].src)) - embedCount += 1; + var embeds = this._concatNodeLists( + node.getElementsByTagName("object"), + node.getElementsByTagName("embed"), + 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 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); @@ -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 RegExp match id/class combination. + * @param Function determines whether a node should be removed * @return void **/ - _cleanMatchedNodes: function(e, regex) { + _cleanMatchedNodes: function(e, filter) { var endOfSearchMarkerNode = this._getNextNode(e, true); var next = this._getNextNode(e); while (next && next != endOfSearchMarkerNode) { - if (regex.test(next.className + " " + next.id)) { + if (filter(next, next.className + " " + next.id)) { next = this._removeAndGetNext(next); } else { next = this._getNextNode(next); From 18932c1c7f10b236dc7346a0e9fd70afa0a6729e Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 8 Mar 2019 08:48:38 -0500 Subject: [PATCH 2/8] Bug 1522787 - downscale bitmap glyphs to avoid filtering artifacts r=gw Differential Revision: https://phabricator.services.mozilla.com/D22704 --- gfx/wr/webrender/src/glyph_rasterizer/mod.rs | 83 +++++++++++++++++++ .../src/glyph_rasterizer/no_pathfinder.rs | 11 ++- 2 files changed, 90 insertions(+), 4 deletions(-) diff --git a/gfx/wr/webrender/src/glyph_rasterizer/mod.rs b/gfx/wr/webrender/src/glyph_rasterizer/mod.rs index be083e1c961d..2dfab9b6559c 100644 --- a/gfx/wr/webrender/src/glyph_rasterizer/mod.rs +++ b/gfx/wr/webrender/src/glyph_rasterizer/mod.rs @@ -485,6 +485,89 @@ pub struct RasterizedGlyph { pub bytes: Vec, } +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 = 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 { // These worker are mostly accessed from their corresponding worker threads. // The goal is that there should be no noticeable contention on the mutexes. diff --git a/gfx/wr/webrender/src/glyph_rasterizer/no_pathfinder.rs b/gfx/wr/webrender/src/glyph_rasterizer/no_pathfinder.rs index 18b944090a8e..ec44f41700e6 100644 --- a/gfx/wr/webrender/src/glyph_rasterizer/no_pathfinder.rs +++ b/gfx/wr/webrender/src/glyph_rasterizer/no_pathfinder.rs @@ -107,18 +107,22 @@ impl GlyphRasterizer { .map(|key: &GlyphKey| { profile_scope!("glyph-raster"); let mut context = font_contexts.lock_current_context(); - let job = GlyphRasterJob { + let mut job = GlyphRasterJob { key: key.clone(), result: context.rasterize_glyph(&font, key), }; - // Sanity check. - if let Ok(ref glyph) = job.result { + if let Ok(ref mut glyph) = job.result { + // Sanity check. let bpp = 4; // We always render glyphs in 32 bits RGBA format. assert_eq!( glyph.bytes.len(), 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 @@ -166,7 +170,6 @@ impl GlyphRasterizer { GlyphCacheEntry::Blank } Ok(glyph) => { - assert_eq!((glyph.left.fract(), glyph.top.fract()), (0.0, 0.0)); let mut texture_cache_handle = TextureCacheHandle::invalid(); texture_cache.request(&texture_cache_handle, gpu_cache); texture_cache.update( From 67120bc4e10c89a489aa91915892499235a4f24b Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Wed, 6 Mar 2019 16:54:58 -0600 Subject: [PATCH 3/8] Bug 1532725 - Make TabParent::Recv{MouseEvent, HandleTap, ..} a script boundary and hold a strong reference. r=bzbarsky These message handlers are currently marked as MOZ_CAN_RUN_SCRIPT, but are called from PBrowserChild::OnMessageReceived which is not marked to run script. For some reason this is not currently an issue on tip. I suspect it has something to do with unified builds as renaming files caused this issue to happen. I haven't looked into it enough to say for certain. This commit changes the message handlers to be script boundaries so that the analysis is satisified. This seemed like an easier change than modifying IPDL to emit the script boundary around PBrowserChild::OnMessageReceived. Additionally, Nika pointed out that IPDL doesn't hold a strong reference when calling message handlers. If the script enters a nested event loop, it may be possible for the protocol to be freed before control returns to it. This commit adds strong references to prevent this. Differential Revision: https://phabricator.services.mozilla.com/D22450 --HG-- extra : rebase_source : 0d756e5a921be8154e5fb3715304a8588700e079 --- dom/ipc/TabChild.cpp | 12 ++++++++++++ dom/ipc/TabChild.h | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 5d81d698f70c..71b0acfc988f 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1246,6 +1246,10 @@ mozilla::ipc::IPCResult TabChild::RecvHandleTap( const GeckoContentController::TapType& aType, const LayoutDevicePoint& aPoint, const Modifiers& aModifiers, 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 kungFuDeathGrip(this); nsCOMPtr presShell = GetPresShell(); if (!presShell) { return IPC_OK(); @@ -1291,6 +1295,10 @@ mozilla::ipc::IPCResult TabChild::RecvNormalPriorityHandleTap( const GeckoContentController::TapType& aType, const LayoutDevicePoint& aPoint, const Modifiers& aModifiers, 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 kungFuDeathGrip(this); 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 int32_t& aButton, const int32_t& aClickCount, 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 kungFuDeathGrip(this); APZCCallbackHelper::DispatchMouseEvent( GetPresShell(), aType, CSSPoint(aX, aY), aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, MouseEvent_Binding::MOZ_SOURCE_UNKNOWN, diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 1fb65db5d74f..b0a79dc9a40d 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -311,7 +311,7 @@ class TabChild final : public TabChildBase, mozilla::ipc::IPCResult RecvDeactivate(); - MOZ_CAN_RUN_SCRIPT + MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual mozilla::ipc::IPCResult RecvMouseEvent( const nsString& aType, const float& aX, const float& aY, const int32_t& aButton, const int32_t& aClickCount, @@ -576,13 +576,13 @@ class TabChild final : public TabChildBase, bool aPreventDefault) const; void SetTargetAPZC(uint64_t aInputBlockId, const nsTArray& aTargets) const; - MOZ_CAN_RUN_SCRIPT + MOZ_CAN_RUN_SCRIPT_BOUNDARY mozilla::ipc::IPCResult RecvHandleTap( const layers::GeckoContentController::TapType& aType, const LayoutDevicePoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) override; - MOZ_CAN_RUN_SCRIPT + MOZ_CAN_RUN_SCRIPT_BOUNDARY mozilla::ipc::IPCResult RecvNormalPriorityHandleTap( const layers::GeckoContentController::TapType& aType, const LayoutDevicePoint& aPoint, const Modifiers& aModifiers, From c39b1f89d0a6337c43a6300e00152a10a8e718e0 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Mon, 4 Mar 2019 20:15:58 -0600 Subject: [PATCH 4/8] Bug 1532725 - Rename PRemoteFrame to PBrowserBridge. r=nika Differential Revision: https://phabricator.services.mozilla.com/D22132 --HG-- rename : dom/ipc/RemoteFrameChild.cpp => dom/ipc/BrowserBridgeChild.cpp rename : dom/ipc/RemoteFrameChild.h => dom/ipc/BrowserBridgeChild.h rename : dom/ipc/RemoteFrameParent.cpp => dom/ipc/BrowserBridgeParent.cpp rename : dom/ipc/RemoteFrameParent.h => dom/ipc/BrowserBridgeParent.h rename : dom/ipc/PRemoteFrame.ipdl => dom/ipc/PBrowserBridge.ipdl extra : rebase_source : d5ca117b96c0d266041d23d80f0f4ab9b0471fb6 --- dom/base/nsContentUtils.cpp | 4 +- dom/base/nsFocusManager.cpp | 12 ++--- dom/base/nsFrameLoader.cpp | 54 +++++++++---------- dom/base/nsFrameLoader.h | 8 +-- ...eFrameChild.cpp => BrowserBridgeChild.cpp} | 44 +++++++-------- ...emoteFrameChild.h => BrowserBridgeChild.h} | 30 +++++------ ...rameParent.cpp => BrowserBridgeParent.cpp} | 29 +++++----- ...oteFrameParent.h => BrowserBridgeParent.h} | 20 +++---- dom/ipc/MemoryReportRequest.cpp | 3 ++ dom/ipc/PBrowser.ipdl | 6 +-- ...{PRemoteFrame.ipdl => PBrowserBridge.ipdl} | 4 +- dom/ipc/PermissionMessageUtils.cpp | 1 + dom/ipc/TabChild.cpp | 15 +++--- dom/ipc/TabChild.h | 4 +- dom/ipc/TabParent.cpp | 22 ++++---- dom/ipc/TabParent.h | 10 ++-- dom/ipc/moz.build | 10 ++-- layout/ipc/RenderFrame.cpp | 1 - 18 files changed, 142 insertions(+), 135 deletions(-) rename dom/ipc/{RemoteFrameChild.cpp => BrowserBridgeChild.cpp} (69%) rename dom/ipc/{RemoteFrameChild.h => BrowserBridgeChild.h} (57%) rename dom/ipc/{RemoteFrameParent.cpp => BrowserBridgeParent.cpp} (81%) rename dom/ipc/{RemoteFrameParent.h => BrowserBridgeParent.h} (78%) rename dom/ipc/{PRemoteFrame.ipdl => PBrowserBridge.ipdl} (94%) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index d1da207af2ae..0f228a31cefe 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -70,7 +70,7 @@ #include "mozilla/dom/IPCBlobUtils.h" #include "mozilla/dom/NodeBinding.h" #include "mozilla/dom/Promise.h" -#include "mozilla/dom/RemoteFrameChild.h" +#include "mozilla/dom/BrowserBridgeChild.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/TabParent.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 // tabbable. if (EventStateManager::IsRemoteTarget(aContent) || - RemoteFrameChild::GetFrom(aContent)) { + BrowserBridgeChild::GetFrom(aContent)) { return true; } diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 83343a06b5ec..91400a81bd12 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -51,7 +51,7 @@ #include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/HTMLSlotElement.h" -#include "mozilla/dom/RemoteFrameChild.h" +#include "mozilla/dom/BrowserBridgeChild.h" #include "mozilla/dom/Text.h" #include "mozilla/EventDispatcher.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 - if (RemoteFrameChild* rfc = RemoteFrameChild::GetFrom(aElement)) { - rfc->Activate(); + if (BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(aElement)) { + bbc->Activate(); LOGFOCUS(("Out-of-process iframe activated")); } } @@ -3475,9 +3475,9 @@ nsresult nsFocusManager::GetNextTabbableContent( } // Same as above but for out-of-process iframes - RemoteFrameChild* rfc = RemoteFrameChild::GetFrom(currentContent); - if (rfc) { - rfc->NavigateByKey(aForward, aForDocumentNavigation); + BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(currentContent); + if (bbc) { + bbc->NavigateByKey(aForward, aForDocumentNavigation); return NS_SUCCESS_DOM_NO_OPERATION; } diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index f15e600c5ce8..171c9b6da0bf 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -104,7 +104,7 @@ #include "mozilla/dom/ChildSHistory.h" #include "mozilla/dom/CanonicalBrowsingContext.h" #include "mozilla/dom/ContentChild.h" -#include "mozilla/dom/RemoteFrameChild.h" +#include "mozilla/dom/BrowserBridgeChild.h" #include "mozilla/dom/HTMLBodyElement.h" @@ -344,15 +344,15 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() { AUTO_PROFILER_LABEL("nsFrameLoader::ReallyStartLoadingInternal", OTHER); if (IsRemoteFrame()) { - if (!mRemoteBrowser && !mRemoteFrameChild && !TryRemoteBrowser()) { + if (!mRemoteBrowser && !mBrowserBridgeChild && !TryRemoteBrowser()) { NS_WARNING("Couldn't create child process for iframe."); return NS_ERROR_FAILURE; } - if (mRemoteFrameChild) { + if (mBrowserBridgeChild) { nsAutoCString spec; mURIToLoad->GetSpec(spec); - Unused << mRemoteFrameChild->SendLoadURL(spec); + Unused << mBrowserBridgeChild->SendLoadURL(spec); } else { // FIXME get error codes from child mRemoteBrowser->LoadURL(mURIToLoad); @@ -806,7 +806,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size, NS_ASSERTION(IsRemoteFrame(), "ShowRemote only makes sense on remote frames."); - if (!mRemoteBrowser && !mRemoteFrameChild && !TryRemoteBrowser()) { + if (!mRemoteBrowser && !mBrowserBridgeChild && !TryRemoteBrowser()) { NS_ERROR("Couldn't create child process."); return false; } @@ -825,7 +825,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size, return false; } - if (mRemoteFrameChild) { + if (mBrowserBridgeChild) { nsCOMPtr container = mOwnerContent->OwnerDoc()->GetContainer(); nsCOMPtr baseWindow = do_QueryInterface(container); @@ -834,7 +834,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size, nsSizeMode sizeMode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal; - Unused << mRemoteFrameChild->SendShow( + Unused << mBrowserBridgeChild->SendShow( size, ParentWindowIsActive(mOwnerContent->OwnerDoc()), sizeMode); mRemoteBrowserShown = true; return true; @@ -863,8 +863,8 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size, if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) { if (mRemoteBrowser) { mRemoteBrowser->UpdateDimensions(dimensions, size); - } else if (mRemoteFrameChild) { - mRemoteFrameChild->UpdateDimensions(dimensions, size); + } else if (mBrowserBridgeChild) { + mBrowserBridgeChild->UpdateDimensions(dimensions, size); } } } @@ -955,7 +955,7 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader( } // FIXME: Consider supporting FrameLoader swapping for remote sub frames. - if (mRemoteFrameChild) { + if (mBrowserBridgeChild) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -1686,9 +1686,9 @@ void nsFrameLoader::DestroyDocShell() { mRemoteBrowser->Destroy(); } - if (mRemoteFrameChild) { - Unused << mRemoteFrameChild->Send__delete__(mRemoteFrameChild); - mRemoteFrameChild = nullptr; + if (mBrowserBridgeChild) { + Unused << mBrowserBridgeChild->Send__delete__(mBrowserBridgeChild); + mBrowserBridgeChild = nullptr; } // Fire the "unload" event if we're in-process. @@ -1732,9 +1732,9 @@ void nsFrameLoader::DestroyComplete() { mRemoteBrowser = nullptr; } - if (mRemoteFrameChild) { - Unused << mRemoteFrameChild->Send__delete__(mRemoteFrameChild); - mRemoteFrameChild = nullptr; + if (mBrowserBridgeChild) { + Unused << mBrowserBridgeChild->Send__delete__(mBrowserBridgeChild); + mBrowserBridgeChild = nullptr; } if (mMessageManager) { @@ -2298,7 +2298,7 @@ nsresult nsFrameLoader::GetWindowDimensions(nsIntRect& aRect) { nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) { if (IsRemoteFrame()) { - if (mRemoteBrowser || mRemoteFrameChild) { + if (mRemoteBrowser || mBrowserBridgeChild) { ScreenIntSize size = aIFrame->GetSubdocumentSize(); // If we were not able to show remote frame before, we should probably // retry now to send correct showInfo. @@ -2310,8 +2310,8 @@ nsresult nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame* aIFrame) { mLazySize = size; if (mRemoteBrowser) { mRemoteBrowser->UpdateDimensions(dimensions, size); - } else if (mRemoteFrameChild) { - mRemoteFrameChild->UpdateDimensions(dimensions, size); + } else if (mBrowserBridgeChild) { + mBrowserBridgeChild->UpdateDimensions(dimensions, size); } } return NS_OK; @@ -2391,7 +2391,7 @@ static Tuple GetContentParent(Element* aBrowser) { } bool nsFrameLoader::TryRemoteBrowser() { - NS_ASSERTION(!mRemoteBrowser && !mRemoteFrameChild, + NS_ASSERTION(!mRemoteBrowser && !mBrowserBridgeChild, "TryRemoteBrowser called with a remote browser already?"); if (!mOwnerContent) { @@ -2508,11 +2508,11 @@ bool nsFrameLoader::TryRemoteBrowser() { nsCOMPtr 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()) { - mRemoteFrameChild = RemoteFrameChild::Create( + mBrowserBridgeChild = BrowserBridgeChild::Create( this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE)); - return !!mRemoteFrameChild; + return !!mBrowserBridgeChild; } mRemoteBrowser = @@ -2586,8 +2586,8 @@ mozilla::dom::PBrowserParent* nsFrameLoader::GetRemoteBrowser() const { return mRemoteBrowser; } -mozilla::dom::RemoteFrameChild* nsFrameLoader::GetRemoteFrameChild() const { - return mRemoteFrameChild; +mozilla::dom::BrowserBridgeChild* nsFrameLoader::GetBrowserBridgeChild() const { + return mBrowserBridgeChild; } mozilla::layers::LayersId nsFrameLoader::GetLayersId() const { @@ -2595,8 +2595,8 @@ mozilla::layers::LayersId nsFrameLoader::GetLayersId() const { if (mRemoteBrowser) { return mRemoteBrowser->GetRenderFrame()->GetLayersId(); } - if (mRemoteFrameChild) { - return mRemoteFrameChild->GetLayersId(); + if (mBrowserBridgeChild) { + return mBrowserBridgeChild->GetLayersId(); } return mozilla::layers::LayersId{}; } diff --git a/dom/base/nsFrameLoader.h b/dom/base/nsFrameLoader.h index 93ad673ff0ee..c5108bd31793 100644 --- a/dom/base/nsFrameLoader.h +++ b/dom/base/nsFrameLoader.h @@ -59,7 +59,7 @@ class ProcessMessageManager; class Promise; class TabParent; class MutableTabContext; -class RemoteFrameChild; +class BrowserBridgeChild; namespace ipc { class StructuredCloneData; @@ -283,10 +283,10 @@ class nsFrameLoader final : public nsStubMutationObserver, 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. */ - mozilla::dom::RemoteFrameChild* GetRemoteFrameChild() const; + mozilla::dom::BrowserBridgeChild* GetBrowserBridgeChild() const; /** * Returns the layers ID that this remote frame is using to render. @@ -455,7 +455,7 @@ class nsFrameLoader final : public nsStubMutationObserver, uint64_t mChildID; // This is used when this refers to a remote sub frame - RefPtr mRemoteFrameChild; + RefPtr mBrowserBridgeChild; // Holds the last known size of the frame. mozilla::ScreenIntSize mLazySize; diff --git a/dom/ipc/RemoteFrameChild.cpp b/dom/ipc/BrowserBridgeChild.cpp similarity index 69% rename from dom/ipc/RemoteFrameChild.cpp rename to dom/ipc/BrowserBridgeChild.cpp index 7ee118c0db9b..5be018ad4ddf 100644 --- a/dom/ipc/RemoteFrameChild.cpp +++ b/dom/ipc/BrowserBridgeChild.cpp @@ -4,21 +4,22 @@ * 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/. */ -#include "mozilla/dom/RemoteFrameChild.h" - +#include "mozilla/dom/BrowserBridgeChild.h" +#include "nsFrameLoader.h" #include "nsFrameLoaderOwner.h" +#include "nsQueryObject.h" using namespace mozilla::ipc; namespace mozilla { namespace dom { -RemoteFrameChild::RemoteFrameChild(nsFrameLoader* aFrameLoader) +BrowserBridgeChild::BrowserBridgeChild(nsFrameLoader* aFrameLoader) : mLayersId{0}, mIPCOpen(true), mFrameLoader(aFrameLoader) {} -RemoteFrameChild::~RemoteFrameChild() {} +BrowserBridgeChild::~BrowserBridgeChild() {} -already_AddRefed RemoteFrameChild::Create( +already_AddRefed BrowserBridgeChild::Create( nsFrameLoader* aFrameLoader, const TabContext& aContext, const nsString& aRemoteType) { MOZ_ASSERT(XRE_IsContentProcess()); @@ -33,18 +34,19 @@ already_AddRefed RemoteFrameChild::Create( RefPtr tabChild = TabChild::GetFrom(docShell); MOZ_DIAGNOSTIC_ASSERT(tabChild); - RefPtr remoteFrame = new RemoteFrameChild(aFrameLoader); - // Reference is freed in TabChild::DeallocPRemoteFrameChild. - tabChild->SendPRemoteFrameConstructor( - do_AddRef(remoteFrame).take(), + RefPtr browserBridge = + new BrowserBridgeChild(aFrameLoader); + // Reference is freed in TabChild::DeallocPBrowserBridgeChild. + tabChild->SendPBrowserBridgeConstructor( + do_AddRef(browserBridge).take(), PromiseFlatString(aContext.PresentationURL()), aRemoteType); - remoteFrame->mIPCOpen = true; + browserBridge->mIPCOpen = true; - return remoteFrame.forget(); + return browserBridge.forget(); } -void RemoteFrameChild::UpdateDimensions(const nsIntRect& aRect, - const mozilla::ScreenIntSize& aSize) { +void BrowserBridgeChild::UpdateDimensions(const nsIntRect& aRect, + const mozilla::ScreenIntSize& aSize) { MOZ_DIAGNOSTIC_ASSERT(mIPCOpen); RefPtr owner = mFrameLoader->GetOwnerContent(); @@ -75,23 +77,23 @@ void RemoteFrameChild::UpdateDimensions(const nsIntRect& aRect, Unused << SendUpdateDimensions(di); } -void RemoteFrameChild::NavigateByKey(bool aForward, - bool aForDocumentNavigation) { +void BrowserBridgeChild::NavigateByKey(bool aForward, + bool aForDocumentNavigation) { Unused << SendNavigateByKey(aForward, aForDocumentNavigation); } -void RemoteFrameChild::Activate() { Unused << SendActivate(); } +void BrowserBridgeChild::Activate() { Unused << SendActivate(); } /*static*/ -RemoteFrameChild* RemoteFrameChild::GetFrom(nsFrameLoader* aFrameLoader) { +BrowserBridgeChild* BrowserBridgeChild::GetFrom(nsFrameLoader* aFrameLoader) { if (!aFrameLoader) { return nullptr; } - return aFrameLoader->GetRemoteFrameChild(); + return aFrameLoader->GetBrowserBridgeChild(); } /*static*/ -RemoteFrameChild* RemoteFrameChild::GetFrom(nsIContent* aContent) { +BrowserBridgeChild* BrowserBridgeChild::GetFrom(nsIContent* aContent) { RefPtr loaderOwner = do_QueryObject(aContent); if (!loaderOwner) { return nullptr; @@ -100,14 +102,14 @@ RemoteFrameChild* RemoteFrameChild::GetFrom(nsIContent* aContent) { return GetFrom(frameLoader); } -IPCResult RemoteFrameChild::RecvSetLayersId( +IPCResult BrowserBridgeChild::RecvSetLayersId( const mozilla::layers::LayersId& aLayersId) { MOZ_ASSERT(!mLayersId.IsValid() && aLayersId.IsValid()); mLayersId = aLayersId; return IPC_OK(); } -void RemoteFrameChild::ActorDestroy(ActorDestroyReason aWhy) { +void BrowserBridgeChild::ActorDestroy(ActorDestroyReason aWhy) { mIPCOpen = false; } diff --git a/dom/ipc/RemoteFrameChild.h b/dom/ipc/BrowserBridgeChild.h similarity index 57% rename from dom/ipc/RemoteFrameChild.h rename to dom/ipc/BrowserBridgeChild.h index 0ce4d56a15f3..bd8a7cc10894 100644 --- a/dom/ipc/RemoteFrameChild.h +++ b/dom/ipc/BrowserBridgeChild.h @@ -4,10 +4,10 @@ * 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/. */ -#ifndef mozilla_dom_RemoteFrameChild_h -#define mozilla_dom_RemoteFrameChild_h +#ifndef mozilla_dom_BrowserBridgeChild_h +#define mozilla_dom_BrowserBridgeChild_h -#include "mozilla/dom/PRemoteFrameChild.h" +#include "mozilla/dom/PBrowserBridgeChild.h" #include "mozilla/dom/TabChild.h" namespace mozilla { @@ -16,20 +16,20 @@ namespace dom { /** * Child side for a remote frame. */ -class RemoteFrameChild : public PRemoteFrameChild { +class BrowserBridgeChild : public PBrowserBridgeChild { public: - NS_INLINE_DECL_REFCOUNTING(RemoteFrameChild); + NS_INLINE_DECL_REFCOUNTING(BrowserBridgeChild); TabChild* Manager() { MOZ_ASSERT(mIPCOpen); - return static_cast(PRemoteFrameChild::Manager()); + return static_cast(PBrowserBridgeChild::Manager()); } mozilla::layers::LayersId GetLayersId() { return mLayersId; } - static already_AddRefed Create(nsFrameLoader* aFrameLoader, - const TabContext& aContext, - const nsString& aRemoteType); + static already_AddRefed Create( + nsFrameLoader* aFrameLoader, const TabContext& aContext, + const nsString& aRemoteType); void UpdateDimensions(const nsIntRect& aRect, const mozilla::ScreenIntSize& aSize); @@ -38,12 +38,12 @@ class RemoteFrameChild : public PRemoteFrameChild { void Activate(); - static RemoteFrameChild* GetFrom(nsFrameLoader* aFrameLoader); + static BrowserBridgeChild* GetFrom(nsFrameLoader* aFrameLoader); - static RemoteFrameChild* GetFrom(nsIContent* aContent); + static BrowserBridgeChild* GetFrom(nsIContent* aContent); protected: - friend class PRemoteFrameChild; + friend class PBrowserBridgeChild; mozilla::ipc::IPCResult RecvSetLayersId( const mozilla::layers::LayersId& aLayersId); @@ -51,8 +51,8 @@ class RemoteFrameChild : public PRemoteFrameChild { void ActorDestroy(ActorDestroyReason aWhy) override; private: - explicit RemoteFrameChild(nsFrameLoader* aFrameLoader); - ~RemoteFrameChild(); + explicit BrowserBridgeChild(nsFrameLoader* aFrameLoader); + ~BrowserBridgeChild(); mozilla::layers::LayersId mLayersId; bool mIPCOpen; @@ -62,4 +62,4 @@ class RemoteFrameChild : public PRemoteFrameChild { } // namespace dom } // namespace mozilla -#endif // !defined(mozilla_dom_RemoteFrameParent_h) +#endif // !defined(mozilla_dom_BrowserBridgeParent_h) diff --git a/dom/ipc/RemoteFrameParent.cpp b/dom/ipc/BrowserBridgeParent.cpp similarity index 81% rename from dom/ipc/RemoteFrameParent.cpp rename to dom/ipc/BrowserBridgeParent.cpp index a246b708b8b0..ba5c10325e2c 100644 --- a/dom/ipc/RemoteFrameParent.cpp +++ b/dom/ipc/BrowserBridgeParent.cpp @@ -4,22 +4,23 @@ * 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/. */ -#include "mozilla/dom/RemoteFrameParent.h" +#include "mozilla/dom/BrowserBridgeParent.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentProcessManager.h" using namespace mozilla::ipc; using namespace mozilla::layout; +using namespace mozilla::hal; namespace mozilla { namespace dom { -RemoteFrameParent::RemoteFrameParent() : mIPCOpen(false) {} +BrowserBridgeParent::BrowserBridgeParent() : mIPCOpen(false) {} -RemoteFrameParent::~RemoteFrameParent() {} +BrowserBridgeParent::~BrowserBridgeParent() {} -nsresult RemoteFrameParent::Init(const nsString& aPresentationURL, - const nsString& aRemoteType) { +nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL, + const nsString& aRemoteType) { mIPCOpen = true; // FIXME: This should actually use a non-bogus TabContext, probably inherited @@ -80,9 +81,9 @@ nsresult RemoteFrameParent::Init(const nsString& aPresentationURL, return NS_OK; } -IPCResult RemoteFrameParent::RecvShow(const ScreenIntSize& aSize, - const bool& aParentIsActive, - const nsSizeMode& aSizeMode) { +IPCResult BrowserBridgeParent::RecvShow(const ScreenIntSize& aSize, + const bool& aParentIsActive, + const nsSizeMode& aSizeMode) { RenderFrame* rf = mTabParent->GetRenderFrame(); if (!rf->AttachLayerManager()) { MOZ_CRASH(); @@ -93,36 +94,36 @@ IPCResult RemoteFrameParent::RecvShow(const ScreenIntSize& aSize, return IPC_OK(); } -IPCResult RemoteFrameParent::RecvLoadURL(const nsCString& aUrl) { +IPCResult BrowserBridgeParent::RecvLoadURL(const nsCString& aUrl) { Unused << mTabParent->SendLoadURL(aUrl, mTabParent->GetShowInfo()); return IPC_OK(); } -IPCResult RemoteFrameParent::RecvUpdateDimensions( +IPCResult BrowserBridgeParent::RecvUpdateDimensions( const DimensionInfo& aDimensions) { Unused << mTabParent->SendUpdateDimensions(aDimensions); return IPC_OK(); } -IPCResult RemoteFrameParent::RecvRenderLayers( +IPCResult BrowserBridgeParent::RecvRenderLayers( const bool& aEnabled, const bool& aForceRepaint, const layers::LayersObserverEpoch& aEpoch) { Unused << mTabParent->SendRenderLayers(aEnabled, aForceRepaint, aEpoch); return IPC_OK(); } -IPCResult RemoteFrameParent::RecvNavigateByKey( +IPCResult BrowserBridgeParent::RecvNavigateByKey( const bool& aForward, const bool& aForDocumentNavigation) { Unused << mTabParent->SendNavigateByKey(aForward, aForDocumentNavigation); return IPC_OK(); } -IPCResult RemoteFrameParent::RecvActivate() { +IPCResult BrowserBridgeParent::RecvActivate() { mTabParent->Activate(); return IPC_OK(); } -void RemoteFrameParent::ActorDestroy(ActorDestroyReason aWhy) { +void BrowserBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { mIPCOpen = false; } diff --git a/dom/ipc/RemoteFrameParent.h b/dom/ipc/BrowserBridgeParent.h similarity index 78% rename from dom/ipc/RemoteFrameParent.h rename to dom/ipc/BrowserBridgeParent.h index 0a6d245a5d3f..94c47507316b 100644 --- a/dom/ipc/RemoteFrameParent.h +++ b/dom/ipc/BrowserBridgeParent.h @@ -4,20 +4,20 @@ * 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/. */ -#ifndef mozilla_dom_RemoteFrameParent_h -#define mozilla_dom_RemoteFrameParent_h +#ifndef mozilla_dom_BrowserBridgeParent_h +#define mozilla_dom_BrowserBridgeParent_h -#include "mozilla/dom/PRemoteFrameParent.h" +#include "mozilla/dom/PBrowserBridgeParent.h" #include "mozilla/dom/TabParent.h" namespace mozilla { namespace dom { -class RemoteFrameParent : public PRemoteFrameParent { +class BrowserBridgeParent : public PBrowserBridgeParent { public: - NS_INLINE_DECL_REFCOUNTING(RemoteFrameParent); + NS_INLINE_DECL_REFCOUNTING(BrowserBridgeParent); - RemoteFrameParent(); + BrowserBridgeParent(); // Initialize this actor after performing startup. nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType); @@ -27,11 +27,11 @@ class RemoteFrameParent : public PRemoteFrameParent { // Get our manager actor. TabParent* Manager() { MOZ_ASSERT(mIPCOpen); - return static_cast(PRemoteFrameParent::Manager()); + return static_cast(PBrowserBridgeParent::Manager()); } protected: - friend class PRemoteFrameParent; + friend class PBrowserBridgeParent; mozilla::ipc::IPCResult RecvShow(const ScreenIntSize& aSize, const bool& aParentIsActive, @@ -51,7 +51,7 @@ class RemoteFrameParent : public PRemoteFrameParent { void ActorDestroy(ActorDestroyReason aWhy) override; private: - ~RemoteFrameParent(); + ~BrowserBridgeParent(); RefPtr mTabParent; bool mIPCOpen; @@ -60,4 +60,4 @@ class RemoteFrameParent : public PRemoteFrameParent { } // namespace dom } // namespace mozilla -#endif // !defined(mozilla_dom_RemoteFrameParent_h) +#endif // !defined(mozilla_dom_BrowserBridgeParent_h) diff --git a/dom/ipc/MemoryReportRequest.cpp b/dom/ipc/MemoryReportRequest.cpp index 4d33a6ed13d5..729212c427a8 100644 --- a/dom/ipc/MemoryReportRequest.cpp +++ b/dom/ipc/MemoryReportRequest.cpp @@ -6,8 +6,11 @@ #include "nsMemoryReporterManager.h" #include "MemoryReportRequest.h" +#include "mozilla/ipc/FileDescriptor.h" #include "mozilla/ipc/FileDescriptorUtils.h" +using namespace mozilla::ipc; + namespace mozilla { namespace dom { diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 18daebc50a13..03ae4074a0a0 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -18,7 +18,7 @@ include protocol PFileDescriptorSet; include protocol PIPCBlobInputStream; include protocol PPaymentRequest; include protocol PWindowGlobal; -include protocol PRemoteFrame; +include protocol PBrowserBridge; include DOMTypes; include IPCBlob; @@ -142,7 +142,7 @@ nested(upto inside_cpow) sync protocol PBrowser manages PPluginWidget; manages PPaymentRequest; manages PWindowGlobal; - manages PRemoteFrame; + manages PBrowserBridge; both: async AsyncMessage(nsString aMessage, CpowEntry[] aCpows, @@ -178,7 +178,7 @@ parent: /** * 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 diff --git a/dom/ipc/PRemoteFrame.ipdl b/dom/ipc/PBrowserBridge.ipdl similarity index 94% rename from dom/ipc/PRemoteFrame.ipdl rename to dom/ipc/PBrowserBridge.ipdl index 453ba47f232d..bc2cb3c95a6c 100644 --- a/dom/ipc/PRemoteFrame.ipdl +++ b/dom/ipc/PBrowserBridge.ipdl @@ -17,9 +17,9 @@ namespace mozilla { namespace dom { /** - * PRemoteFrame corresponds to a remote iframe. + * PBrowserBridge corresponds to a remote iframe. */ -async protocol PRemoteFrame { +async protocol PBrowserBridge { manager PBrowser; child: diff --git a/dom/ipc/PermissionMessageUtils.cpp b/dom/ipc/PermissionMessageUtils.cpp index d67eb86ec363..f8d6316890a2 100644 --- a/dom/ipc/PermissionMessageUtils.cpp +++ b/dom/ipc/PermissionMessageUtils.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/PermissionMessageUtils.h" #include "mozilla/ipc/BackgroundUtils.h" +#include "mozilla/ipc/PBackgroundSharedTypes.h" namespace mozilla { namespace ipc { diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 71b0acfc988f..1bb26ea90b25 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -30,7 +30,7 @@ #include "mozilla/dom/PaymentRequestChild.h" #include "mozilla/dom/PBrowser.h" #include "mozilla/dom/WindowProxyHolder.h" -#include "mozilla/dom/RemoteFrameChild.h" +#include "mozilla/dom/BrowserBridgeChild.h" #include "mozilla/gfx/CrossProcessPaint.h" #include "mozilla/IMEStateManager.h" #include "mozilla/ipc/URIUtils.h" @@ -3195,15 +3195,16 @@ bool TabChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) { return true; } -PRemoteFrameChild* TabChild::AllocPRemoteFrameChild(const nsString&, - const nsString&) { - MOZ_CRASH("We should never be manually allocating PRemoteFrameChild actors"); +PBrowserBridgeChild* TabChild::AllocPBrowserBridgeChild(const nsString&, + const nsString&) { + MOZ_CRASH( + "We should never be manually allocating PBrowserBridgeChild actors"); return nullptr; } -bool TabChild::DeallocPRemoteFrameChild(PRemoteFrameChild* aActor) { - // This reference was added in RemoteFrameChild::Create. - static_cast(aActor)->Release(); +bool TabChild::DeallocPBrowserBridgeChild(PBrowserBridgeChild* aActor) { + // This reference was added in BrowserBridgeChild::Create. + static_cast(aActor)->Release(); return true; } diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index b0a79dc9a40d..c01b90c2f407 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -670,10 +670,10 @@ class TabChild final : public TabChildBase, virtual bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) override; - virtual PRemoteFrameChild* AllocPRemoteFrameChild( + virtual PBrowserBridgeChild* AllocPBrowserBridgeChild( 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; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index c02ba8c53e2f..6f3fbbe03b52 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -21,7 +21,7 @@ #include "mozilla/dom/indexedDB/ActorsParent.h" #include "mozilla/dom/IPCBlobUtils.h" #include "mozilla/dom/PaymentRequestParent.h" -#include "mozilla/dom/RemoteFrameParent.h" +#include "mozilla/dom/BrowserBridgeParent.h" #include "mozilla/EventStateManager.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/DataSurfaceHelpers.h" @@ -998,22 +998,22 @@ bool TabParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) { return true; } -IPCResult TabParent::RecvPRemoteFrameConstructor(PRemoteFrameParent* aActor, - const nsString& aName, - const nsString& aRemoteType) { - static_cast(aActor)->Init(aName, aRemoteType); +IPCResult TabParent::RecvPBrowserBridgeConstructor( + PBrowserBridgeParent* aActor, const nsString& aName, + const nsString& aRemoteType) { + static_cast(aActor)->Init(aName, aRemoteType); return IPC_OK(); } -PRemoteFrameParent* TabParent::AllocPRemoteFrameParent( +PBrowserBridgeParent* TabParent::AllocPBrowserBridgeParent( const nsString& aName, const nsString& aRemoteType) { - // Reference freed in DeallocPRemoteFrameParent. - return do_AddRef(new RemoteFrameParent()).take(); + // Reference freed in DeallocPBrowserBridgeParent. + return do_AddRef(new BrowserBridgeParent()).take(); } -bool TabParent::DeallocPRemoteFrameParent(PRemoteFrameParent* aActor) { - // Free reference from AllocPRemoteFrameParent. - static_cast(aActor)->Release(); +bool TabParent::DeallocPBrowserBridgeParent(PBrowserBridgeParent* aActor) { + // Free reference from AllocPBrowserBridgeParent. + static_cast(aActor)->Release(); return true; } diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 1f98d7b0c662..c70017217831 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -315,13 +315,13 @@ class TabParent final : public PBrowserParent, virtual mozilla::ipc::IPCResult RecvPWindowGlobalConstructor( PWindowGlobalParent* aActor, const WindowGlobalInit& aInit) override; - PRemoteFrameParent* AllocPRemoteFrameParent(const nsString& aPresentationURL, - const nsString& aRemoteType); + PBrowserBridgeParent* AllocPBrowserBridgeParent( + const nsString& aPresentationURL, const nsString& aRemoteType); - bool DeallocPRemoteFrameParent(PRemoteFrameParent* aActor); + bool DeallocPBrowserBridgeParent(PBrowserBridgeParent* aActor); - virtual mozilla::ipc::IPCResult RecvPRemoteFrameConstructor( - PRemoteFrameParent* aActor, const nsString& aPresentationURL, + virtual mozilla::ipc::IPCResult RecvPBrowserBridgeConstructor( + PBrowserBridgeParent* aActor, const nsString& aPresentationURL, const nsString& aRemoteType) override; void LoadURL(nsIURI* aURI); diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index b997041fb0a6..8280e94618a3 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -28,6 +28,8 @@ EXPORTS.mozilla.dom.ipc += [ ] EXPORTS.mozilla.dom += [ + 'BrowserBridgeChild.h', + 'BrowserBridgeParent.h', 'CoalescedInputData.h', 'CoalescedMouseData.h', 'CoalescedWheelData.h', @@ -44,8 +46,6 @@ EXPORTS.mozilla.dom += [ 'JSWindowActorService.h', 'MemoryReportRequest.h', 'PermissionMessageUtils.h', - 'RemoteFrameChild.h', - 'RemoteFrameParent.h', 'TabChild.h', 'TabContext.h', 'TabMessageUtils.h', @@ -64,6 +64,8 @@ EXPORTS.mozilla += [ ] UNIFIED_SOURCES += [ + 'BrowserBridgeChild.cpp', + 'BrowserBridgeParent.cpp', 'CoalescedMouseData.cpp', 'CoalescedWheelData.cpp', 'ColorPickerParent.cpp', @@ -82,8 +84,6 @@ UNIFIED_SOURCES += [ 'PermissionMessageUtils.cpp', 'PreallocatedProcessManager.cpp', 'ProcessPriorityManager.cpp', - 'RemoteFrameChild.cpp', - 'RemoteFrameParent.cpp', 'SharedMap.cpp', 'SharedStringMap.cpp', 'StructuredCloneData.cpp', @@ -106,6 +106,7 @@ IPDL_SOURCES += [ 'DOMTypes.ipdlh', 'MemoryReportTypes.ipdlh', 'PBrowser.ipdl', + 'PBrowserBridge.ipdl', 'PBrowserOrId.ipdlh', 'PColorPicker.ipdl', 'PContent.ipdl', @@ -117,7 +118,6 @@ IPDL_SOURCES += [ 'PPluginWidget.ipdl', 'PProcessHangMonitor.ipdl', 'PrefsTypes.ipdlh', - 'PRemoteFrame.ipdl', 'PTabContext.ipdlh', 'PURLClassifier.ipdl', 'PURLClassifierInfo.ipdlh', diff --git a/layout/ipc/RenderFrame.cpp b/layout/ipc/RenderFrame.cpp index c9570f308b6b..337004859f16 100644 --- a/layout/ipc/RenderFrame.cpp +++ b/layout/ipc/RenderFrame.cpp @@ -8,7 +8,6 @@ #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/TabParent.h" -#include "mozilla/dom/RemoteFrameChild.h" #include "mozilla/layers/CompositorBridgeParent.h" #include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/LayerTransactionParent.h" From fa27fe3954291cf6a6eb57ad01bdb8933f322c4d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 1 Mar 2019 15:40:43 -0800 Subject: [PATCH 5/8] Bug 1532810 - Update gleam. r=me --- Cargo.lock | 8 +++--- gfx/wr/Cargo.lock | 14 +++++------ gfx/wr/webrender/Cargo.toml | 2 +- third_party/rust/gleam/.cargo-checksum.json | 2 +- third_party/rust/gleam/COPYING | 0 third_party/rust/gleam/Cargo.toml | 2 +- third_party/rust/gleam/LICENSE-APACHE | 0 third_party/rust/gleam/LICENSE-MIT | 0 third_party/rust/gleam/README.md | 0 third_party/rust/gleam/build.rs | 0 third_party/rust/gleam/rustfmt.toml | 0 third_party/rust/gleam/src/gl.rs | 27 +++++++++++++++++++++ third_party/rust/gleam/src/gl_fns.rs | 0 third_party/rust/gleam/src/gles_fns.rs | 0 third_party/rust/gleam/src/lib.rs | 0 15 files changed, 41 insertions(+), 14 deletions(-) mode change 100755 => 100644 third_party/rust/gleam/COPYING mode change 100755 => 100644 third_party/rust/gleam/LICENSE-APACHE mode change 100755 => 100644 third_party/rust/gleam/LICENSE-MIT mode change 100755 => 100644 third_party/rust/gleam/README.md mode change 100755 => 100644 third_party/rust/gleam/build.rs mode change 100755 => 100644 third_party/rust/gleam/rustfmt.toml mode change 100755 => 100644 third_party/rust/gleam/src/gl.rs mode change 100755 => 100644 third_party/rust/gleam/src/gl_fns.rs mode change 100755 => 100644 third_party/rust/gleam/src/gles_fns.rs mode change 100755 => 100644 third_party/rust/gleam/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index e87b1a84dabb..71d04d1cbb72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1163,7 +1163,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "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)", "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)", - "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)", "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)", @@ -3158,7 +3158,7 @@ dependencies = [ "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)", "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)", "nsstring 0.1.0", "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.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 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 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" diff --git a/gfx/wr/Cargo.lock b/gfx/wr/Cargo.lock index 58c1c7435484..3f694406d904 100644 --- a/gfx/wr/Cargo.lock +++ b/gfx/wr/Cargo.lock @@ -143,7 +143,7 @@ name = "cgl" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" 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)", ] @@ -370,7 +370,7 @@ name = "direct-composition" version = "0.1.0" dependencies = [ "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)", "webrender 0.60.0", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -569,7 +569,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "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)", "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)", - "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)", "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)", @@ -1681,7 +1681,7 @@ dependencies = [ "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)", "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)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.60.0", @@ -1799,7 +1799,7 @@ dependencies = [ "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)", "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)", "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)", @@ -1946,7 +1946,7 @@ dependencies = [ "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.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 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" diff --git a/gfx/wr/webrender/Cargo.toml b/gfx/wr/webrender/Cargo.toml index 93cc85b8faed..5b60645aa3e2 100644 --- a/gfx/wr/webrender/Cargo.toml +++ b/gfx/wr/webrender/Cargo.toml @@ -30,7 +30,7 @@ byteorder = "1.0" cfg-if = "0.1.2" cstr = "0.1.2" fxhash = "0.2.1" -gleam = "0.6.11" +gleam = "0.6.12" image = { optional = true, version = "0.21" } lazy_static = "1" log = "0.4" diff --git a/third_party/rust/gleam/.cargo-checksum.json b/third_party/rust/gleam/.cargo-checksum.json index f31207d2e6fc..44ae54078408 100644 --- a/third_party/rust/gleam/.cargo-checksum.json +++ b/third_party/rust/gleam/.cargo-checksum.json @@ -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"} \ No newline at end of file +{"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"} \ No newline at end of file diff --git a/third_party/rust/gleam/COPYING b/third_party/rust/gleam/COPYING old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/Cargo.toml b/third_party/rust/gleam/Cargo.toml index 365536c0de23..9dc5dc5a1bd7 100644 --- a/third_party/rust/gleam/Cargo.toml +++ b/third_party/rust/gleam/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "gleam" -version = "0.6.11" +version = "0.6.12" authors = ["The Servo Project Developers"] build = "build.rs" description = "Generated OpenGL bindings and wrapper for Servo." diff --git a/third_party/rust/gleam/LICENSE-APACHE b/third_party/rust/gleam/LICENSE-APACHE old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/LICENSE-MIT b/third_party/rust/gleam/LICENSE-MIT old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/README.md b/third_party/rust/gleam/README.md old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/build.rs b/third_party/rust/gleam/build.rs old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/rustfmt.toml b/third_party/rust/gleam/rustfmt.toml old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/src/gl.rs b/third_party/rust/gleam/src/gl.rs old mode 100755 new mode 100644 index 247d9dcfdf68..ebd575e966b1 --- a/third_party/rust/gleam/src/gl.rs +++ b/third_party/rust/gleam/src/gl.rs @@ -15,6 +15,7 @@ use std::os::raw::{c_char, c_int, c_void}; use std::ptr; use std::rc::Rc; use std::str; +use std::time::{Duration, Instant}; pub use ffi::types::*; pub use ffi::*; @@ -98,6 +99,18 @@ macro_rules! declare_gl_apis { rv })+ } + + impl Gl for ProfilingGl { + $($(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 ErrorReactingGl { } } +/// A wrapper around GL context that times each call and invokes the callback +/// if the call takes longer than the threshold. +pub struct ProfilingGl { + gl: Rc, + threshold: Duration, + callback: F, +} + +impl ProfilingGl { + pub fn wrap(fns: Rc, threshold: Duration, callback: F) -> Rc { + Rc::new(ProfilingGl { gl: fns, threshold, callback }) as Rc + } +} + #[inline] pub fn buffer_data(gl_: &Gl, target: GLenum, data: &[T], usage: GLenum) { gl_.buffer_data_untyped( diff --git a/third_party/rust/gleam/src/gl_fns.rs b/third_party/rust/gleam/src/gl_fns.rs old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/src/gles_fns.rs b/third_party/rust/gleam/src/gles_fns.rs old mode 100755 new mode 100644 diff --git a/third_party/rust/gleam/src/lib.rs b/third_party/rust/gleam/src/lib.rs old mode 100755 new mode 100644 From af5a99b2ad31462c7772f834368c29d8a2982725 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 5 Mar 2019 11:31:49 -0800 Subject: [PATCH 6/8] Bug 1532810 - Report long-running GL calls to the profiler. r=gw Differential Revision: https://phabricator.services.mozilla.com/D22202 --- gfx/layers/wr/WebRenderBridgeParent.cpp | 20 ++++++++++++++++ gfx/webrender_bindings/src/bindings.rs | 17 ++++++++++++++ gfx/webrender_bindings/webrender_ffi.h | 3 +++ gfx/wr/webrender/src/device/gl.rs | 24 +++++++++++++++++++ gfx/wr/webrender/src/profiler.rs | 31 ++++++++++++++++++++++++- 5 files changed, 94 insertions(+), 1 deletion(-) diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 3485c2e856bb..2ace24a45d89 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -15,6 +15,7 @@ #include "GLContextProvider.h" #include "nsExceptionHandler.h" #include "mozilla/Range.h" +#include "mozilla/UniquePtr.h" #include "mozilla/layers/AnimationHelper.h" #include "mozilla/layers/APZSampler.h" #include "mozilla/layers/APZUpdater.h" @@ -64,6 +65,25 @@ void gecko_profiler_end_marker(const char* name) { #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) { MOZ_ASSERT(glcontext_ptr); diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 2730fc1eed54..dd66b09f096d 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -16,6 +16,7 @@ use std::ops::Range; use std::os::raw::{c_void, c_char, c_float}; #[cfg(target_os = "android")] use std::os::raw::{c_int}; +use std::time::Duration; use gleam::gl; use webrender::api::*; @@ -757,6 +758,9 @@ pub unsafe extern "C" fn wr_pipeline_info_delete(_info: WrPipelineInfo) { extern "C" { pub fn gecko_profiler_start_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 @@ -775,6 +779,19 @@ impl ProfilerHooks for GeckoProfilerHooks { 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 {}; diff --git a/gfx/webrender_bindings/webrender_ffi.h b/gfx/webrender_bindings/webrender_ffi.h index a2a218e67e5c..0894129fe04f 100644 --- a/gfx/webrender_bindings/webrender_ffi.h +++ b/gfx/webrender_bindings/webrender_ffi.h @@ -33,6 +33,9 @@ void gecko_profiler_unregister_thread(); void gecko_profiler_start_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 // gfx/wr/webrender_api diff --git a/gfx/wr/webrender/src/device/gl.rs b/gfx/wr/webrender/src/device/gl.rs index a8f8d8681292..99385f568a8e 100644 --- a/gfx/wr/webrender/src/device/gl.rs +++ b/gfx/wr/webrender/src/device/gl.rs @@ -10,6 +10,7 @@ use euclid::Transform3D; use gleam::gl; use internal_types::{FastHashMap, LayerIndex, RenderTargetInfo}; use log::Level; +use profiler; use sha2::{Digest, Sha256}; use smallvec::SmallVec; use std::borrow::Cow; @@ -28,6 +29,7 @@ use std::slice; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread; +use std::time::Duration; use webrender_build::shader::ProgramSourceDigest; use webrender_build::shader::{parse_shader_source, shader_source_from_file}; @@ -919,6 +921,11 @@ enum TexStorageUsage { pub struct Device { gl: Rc, + + /// If non-None, |gl| points to a profiling wrapper, and this points to the + /// underling Gl instance. + base_gl: Option>, + // device state bound_textures: [gl::GLuint; 16], bound_program: gl::GLuint, @@ -1235,6 +1242,7 @@ impl Device { Device { gl, + base_gl: None, resource_override_path, upload_method, inside_frame: false, @@ -1363,6 +1371,22 @@ impl Device { debug_assert!(!self.inside_frame); 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. let mut default_read_fbo = [0]; unsafe { diff --git a/gfx/wr/webrender/src/profiler.rs b/gfx/wr/webrender/src/profiler.rs index 7b35341c9664..9a4f019c03e8 100644 --- a/gfx/wr/webrender/src/profiler.rs +++ b/gfx/wr/webrender/src/profiler.rs @@ -11,6 +11,7 @@ use renderer::{MAX_VERTEX_TEXTURE_WIDTH, wr_has_been_initialized}; use std::collections::vec_deque::VecDeque; use std::{f32, mem}; use std::ffi::CStr; +use std::time::Duration; use time::precise_time_ns; 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 /// be a C string (null terminated). 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. -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. /// This function must only ever be called before any WR instances @@ -51,6 +64,22 @@ pub struct ProfileScope { 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 { /// Begin a new profile scope pub fn new(name: &'static CStr) -> Self { From 624e56f66c29b658165ee56f7d9732f726f07556 Mon Sep 17 00:00:00 2001 From: "J.C. Jones" Date: Fri, 8 Mar 2019 22:44:27 +0000 Subject: [PATCH 7/8] Bug 1523175 - land NSS NSS_3_43_BETA1 UPGRADE_NSS_RELEASE, r=me --HG-- extra : rebase_source : eae65b8dc034554ed61a87e2d034ffa8b1d07089 --- security/nss/TAG-INFO | 2 +- security/nss/coreconf/coreconf.dep | 1 - security/nss/lib/pk11wrap/pk11akey.c | 7 +++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO index cf12f5380a54..1c6aab0d5d73 100644 --- a/security/nss/TAG-INFO +++ b/security/nss/TAG-INFO @@ -1 +1 @@ -a306d84e4c70 +NSS_3_43_BETA1 diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep index 590d1bfaeee3..5182f75552c8 100644 --- a/security/nss/coreconf/coreconf.dep +++ b/security/nss/coreconf/coreconf.dep @@ -10,4 +10,3 @@ */ #error "Do not include this header file." - diff --git a/security/nss/lib/pk11wrap/pk11akey.c b/security/nss/lib/pk11wrap/pk11akey.c index 97adabb50443..c36f6ce710f6 100644 --- a/security/nss/lib/pk11wrap/pk11akey.c +++ b/security/nss/lib/pk11wrap/pk11akey.c @@ -1683,8 +1683,8 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue) SECStatus rv; SECKEYPublicKey pubKey; PLArenaPool *arena; - PK11SlotInfo *slot = privKey->pkcs11Slot; - CK_OBJECT_HANDLE privKeyID = privKey->pkcs11ID; + PK11SlotInfo *slot; + CK_OBJECT_HANDLE privKeyID; if (privKey == NULL || publicValue == NULL || publicValue->data == NULL || publicValue->len == 0) { @@ -1704,6 +1704,9 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue) if (arena == NULL) { return SECFailure; } + + slot = privKey->pkcs11Slot; + privKeyID = privKey->pkcs11ID; rv = SECFailure; switch (privKey->keyType) { default: From 08324b7d0f020156bf85ac3b6eaf303ee3602939 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Sat, 9 Mar 2019 15:44:14 +1300 Subject: [PATCH 8/8] Bug 1530980 - Stop listening for mail-startup-done to start Marionette in Thunderbird; r=whimboo --- testing/marionette/components/marionette.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/testing/marionette/components/marionette.js b/testing/marionette/components/marionette.js index 7ee20f4fc56f..e8334333d2b3 100644 --- a/testing/marionette/components/marionette.js +++ b/testing/marionette/components/marionette.js @@ -331,7 +331,6 @@ class MarionetteParentProcess { case "profile-after-change": Services.obs.addObserver(this, "command-line-startup"); 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, "marionette-startup-requested"); @@ -386,11 +385,6 @@ class MarionetteParentProcess { }, {once: true}); break; - // Thunderbird only, instead of sessionstore-windows-restored. - case "mail-startup-done": - Services.obs.notifyObservers(this, "marionette-startup-requested"); - break; - case "sessionstore-windows-restored": Services.obs.removeObserver(this, topic); Services.obs.removeObserver(this, "toplevel-window-ready");