author Mike Shal <>
Thu, 24 Aug 2017 22:52:01 -0400
changeset 434519 cb773c661e0ca0bf297e977343076bef34411523
parent 395704 cce5031e6ac46ae4a9b91a2a7667a7a0ad922c3b
child 479926 be11a32900298eb6fd4d18ad21b9a699995254c3
permissions -rw-r--r--
Bug 1402012 - Update to use PartialConfigEnvironment; r=glandium By using the PartialConfigEnvironment, the clients of buildconfig will depend on config.statusd/ files instead of config.status directly. Clients can access substs and defines using buildconfig.substs['FOO'] or buildconfig.defines['BAR'], and then collect file-level dependencies for make using buildconfig.get_dependencies(). All GENERATED_FILES rules already make use of this because automatically includes these dependencies (along with all python modules loaded). As a result of this commit, re-running configure will no longer cause the world to be rebuilt. Although config.status is updated, no build steps use config.status directly and instead depend on values in config.statusd/, which are written with FileAvoidWrite. Since those files are not official targets according to the make backend, make won't try to continually rebuild the backend when those files are out of date. And since they are FileAvoidWrite, make will only re-run dependent steps if the actual configure value has changed. As a result of using JSON to load data from the config.statusd directory, substs can be unicode (instead of a bare string type). converts the subst manually to a string so the value can be exported to the environment without issue on Windows. Additionally, patching the buildconfig.substs dict no longer works, so the test was modified to patch the underlying buildconfig.substs._dict instead. The other files that needed to be modified make use of all the defines for the preprocessor. Those that are used during 'mach build' now use buildconfig.defines['ALLDEFINES'], which maps to a special FileAvoidWrite file generated for the PartialConfigEnvironment. MozReview-Commit-ID: 2pJ4s3TVeS8

/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

include protocol PContent;
include protocol PWebBrowserPersistResources;
include protocol PWebBrowserPersistSerialize;
include protocol PFileDescriptorSet;
include protocol PChildToParentStream; //FIXME: bug #792908
include protocol PParentToChildStream; //FIXME: bug #792908

include IPCStream;

namespace mozilla {

// nsIWebBrowserPersistDocument has attributes which can be read
// synchronously.  To avoid using sync IPC for them, the actor sends
// this structure from the child to the parent before the parent actor
// is exposed to XPCOM.
struct WebBrowserPersistDocumentAttrs {
  bool isPrivate;
  nsCString documentURI;
  nsCString baseURI;
  nsCString contentType;
  nsCString characterSet;
  nsString title;
  nsString referrer;
  nsString contentDisposition;
  uint32_t cacheKey;
  uint32_t persistFlags;

// IPDL doesn't have tuples, so this gives the pair of strings from
// nsIWebBrowserPersistURIMap::getURIMapping a name.
struct WebBrowserPersistURIMapEntry {
  nsCString mapFrom;
  nsCString mapTo;

// nsIWebBrowserPersistURIMap is just copied over IPC as one of these,
// not proxied, to simplify the protocol.
struct WebBrowserPersistURIMap {
  WebBrowserPersistURIMapEntry[] mapURIs;
  nsCString targetBaseURI;

// This remotes nsIWebBrowserPersistDocument and its visitors.  The
// lifecycle is a little complicated: the initial document is
// constructed parent->child, but subdocuments are constructed
// child->parent and then passed back.  Subdocuments aren't subactors,
// because that would impose a lifetime relationship that doesn't
// exist in the XPIDL; instead they're all managed by the enclosing
// PContent.
protocol PWebBrowserPersistDocument {
  manager PContent;
  manages PWebBrowserPersistResources;
  manages PWebBrowserPersistSerialize;

  // The actor isn't exposed to XPCOM until after it gets one of these
  // two messages; see also the state transition rules.  The message
  // is either a response to the constructor (if it was parent->child)
  // or sent after it (if it was child->parent).
  async Attributes(WebBrowserPersistDocumentAttrs aAttrs,
                   OptionalIPCStream stream);
  async InitFailure(nsresult aStatus);

  async SetPersistFlags(uint32_t aNewFlags);
  async PWebBrowserPersistResources();
  async PWebBrowserPersistSerialize(WebBrowserPersistURIMap aMap,
                                    nsCString aRequestedContentType,
                                    uint32_t aEncoderFlags,
                                    uint32_t aWrapColumn);
  async __delete__();

state START:
  recv Attributes goto MAIN;
  recv InitFailure goto FAILED;

state MAIN:
  send SetPersistFlags goto MAIN;
  send PWebBrowserPersistResources goto MAIN;
  send PWebBrowserPersistSerialize goto MAIN;
  send __delete__;

state FAILED:
  send __delete__;

} // namespace mozilla