mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1751071 - Correctly forward-declare/import included but unused types in ipdlh headers, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D137164
This commit is contained in:
parent
85715645b0
commit
486c5fc2c4
@ -12,7 +12,7 @@ include "mozilla/dom/BindingIPCUtils.h";
|
||||
include "mozilla/dom/ClientIPCUtils.h";
|
||||
include "ipc/ErrorIPCUtils.h";
|
||||
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using ClientType from "mozilla/dom/ClientsBinding.h";
|
||||
using FrameType from "mozilla/dom/ClientBinding.h";
|
||||
using mozilla::StorageAccess from "mozilla/StorageAccess.h";
|
||||
|
@ -24,7 +24,7 @@ using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
|
||||
[MoveOnly=data] using struct mozilla::SerializedStructuredCloneBuffer
|
||||
from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
|
||||
|
||||
using class mozilla::dom::LoadingSessionHistoryInfo
|
||||
using struct mozilla::dom::LoadingSessionHistoryInfo
|
||||
from "mozilla/dom/SessionHistoryEntry.h";
|
||||
|
||||
using LayoutDeviceIntRect from "Units.h";
|
||||
@ -45,7 +45,7 @@ using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingCont
|
||||
[RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
[RefCounted] using class nsIVariant from "nsIVariant.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
[RefCounted] using class mozilla::dom::BrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -10,7 +10,7 @@ include FetchTypes;
|
||||
include "mozilla/dom/ServiceWorkerIPCUtils.h";
|
||||
|
||||
using ServiceWorkerState from "mozilla/dom/ServiceWorkerBinding.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -15,16 +15,16 @@ include "mozilla/GfxMessageUtils.h";
|
||||
using mozilla::gfx::Glyph from "mozilla/gfx/2D.h";
|
||||
using mozilla::gfx::SamplingFilter from "mozilla/gfx/2D.h";
|
||||
using struct mozilla::gfx::DeviceColor from "mozilla/gfx/2D.h";
|
||||
using struct mozilla::gfx::Point from "mozilla/gfx/Point.h";
|
||||
using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::Point from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
|
||||
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
|
||||
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||
using class mozilla::SideBits from "mozilla/gfx/Types.h";
|
||||
using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||
using mozilla::SideBits from "mozilla/gfx/Types.h";
|
||||
using nscolor from "nsColor.h";
|
||||
using nscoord from "nsCoord.h";
|
||||
using struct nsRect from "nsRect.h";
|
||||
using struct nsPoint from "nsPoint.h";
|
||||
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
|
||||
using nsCSSPropertyID from "nsCSSPropertyID.h";
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
include "gfxipc/ShadowLayerUtils.h";
|
||||
|
||||
using struct gfxPoint from "gfxPoint.h";
|
||||
using gfxPoint from "gfxPoint.h";
|
||||
using nsIntRegion from "nsRegion.h";
|
||||
using mozilla::StereoMode from "ImageTypes.h";
|
||||
using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
|
||||
|
@ -31,7 +31,7 @@ using mozilla::LayoutDeviceSize from "Units.h";
|
||||
using mozilla::ImageIntRect from "Units.h";
|
||||
using mozilla::gfx::Rect from "mozilla/gfx/Rect.h";
|
||||
using mozilla::VideoInfo::Rotation from "MediaInfo.h";
|
||||
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||
using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
|
||||
using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -60,6 +60,7 @@ HeaderIncludes = (
|
||||
|
||||
CppIncludes = (
|
||||
"ipc/IPCMessageUtils.h",
|
||||
"ipc/IPCMessageUtilsSpecializations.h",
|
||||
"nsIFile.h",
|
||||
"mozilla/ipc/Endpoint.h",
|
||||
"mozilla/ipc/ProtocolMessageUtils.h",
|
||||
|
@ -1646,6 +1646,10 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
|
||||
self.hdrfile.addthing(
|
||||
CppDirective("include", '"' + _ipdlhHeaderName(inc.tu) + '.h"')
|
||||
)
|
||||
# Inherit cpp includes defined by imported header files, as they may
|
||||
# be required to serialize an imported `using` type.
|
||||
for cxxinc in inc.tu.cxxIncludes:
|
||||
cxxinc.accept(self)
|
||||
else:
|
||||
self.cppIncludeHeaders += [
|
||||
_protocolHeaderName(inc.tu.protocol, "parent") + ".h",
|
||||
@ -3573,33 +3577,46 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
self.externalIncludes.add(inc.file)
|
||||
|
||||
def visitInclude(self, inc):
|
||||
ip = inc.tu.protocol
|
||||
if not ip:
|
||||
return
|
||||
if inc.tu.filetype == "header":
|
||||
# Including a header will declare any globals defined by "using"
|
||||
# statements into our scope. To serialize these, we also may need
|
||||
# cxx include statements, so visit them as well.
|
||||
for cxxinc in inc.tu.cxxIncludes:
|
||||
cxxinc.accept(self)
|
||||
for using in inc.tu.using:
|
||||
using.accept(self)
|
||||
else:
|
||||
# Includes for protocols only include types explicitly exported by
|
||||
# those protocols.
|
||||
ip = inc.tu.protocol
|
||||
if ip == self.protocol:
|
||||
return
|
||||
|
||||
self.actorForwardDecls.extend(
|
||||
[
|
||||
_makeForwardDeclForActor(ip.decl.type, self.side),
|
||||
_makeForwardDeclForActor(ip.decl.type, _otherSide(self.side)),
|
||||
Whitespace.NL,
|
||||
]
|
||||
)
|
||||
self.protocolCxxIncludes.append(_protocolHeaderName(ip, self.side))
|
||||
|
||||
if ip.decl.fullname is not None:
|
||||
self.includedActorTypedefs.append(
|
||||
Typedef(
|
||||
Type(_actorName(ip.decl.fullname, self.side.title())),
|
||||
_actorName(ip.decl.shortname, self.side.title()),
|
||||
)
|
||||
self.actorForwardDecls.extend(
|
||||
[
|
||||
_makeForwardDeclForActor(ip.decl.type, self.side),
|
||||
_makeForwardDeclForActor(ip.decl.type, _otherSide(self.side)),
|
||||
Whitespace.NL,
|
||||
]
|
||||
)
|
||||
self.protocolCxxIncludes.append(_protocolHeaderName(ip, self.side))
|
||||
|
||||
self.includedActorTypedefs.append(
|
||||
Typedef(
|
||||
Type(_actorName(ip.decl.fullname, _otherSide(self.side).title())),
|
||||
_actorName(ip.decl.shortname, _otherSide(self.side).title()),
|
||||
if ip.decl.fullname is not None:
|
||||
self.includedActorTypedefs.append(
|
||||
Typedef(
|
||||
Type(_actorName(ip.decl.fullname, self.side.title())),
|
||||
_actorName(ip.decl.shortname, self.side.title()),
|
||||
)
|
||||
)
|
||||
|
||||
self.includedActorTypedefs.append(
|
||||
Typedef(
|
||||
Type(
|
||||
_actorName(ip.decl.fullname, _otherSide(self.side).title())
|
||||
),
|
||||
_actorName(ip.decl.shortname, _otherSide(self.side).title()),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def visitProtocol(self, p):
|
||||
self.hdrfile.addcode(
|
||||
|
@ -33,7 +33,7 @@ using nsContentPolicyType from "nsIContentPolicy.h";
|
||||
using mozilla::net::PreferredAlternativeDataDeliveryTypeIPC from "nsICacheInfoChannel.h";
|
||||
using nsILoadInfo::CrossOriginEmbedderPolicy from "nsILoadInfo.h";
|
||||
using nsILoadInfo::StoragePermissionState from "nsILoadInfo.h";
|
||||
using class mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
|
||||
using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 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/. */
|
||||
|
||||
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
using mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -92,4 +92,4 @@ struct HangDetails
|
||||
HangAnnotation[] annotations;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla
|
||||
|
Loading…
Reference in New Issue
Block a user