tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsHtml5OplessBuilder.h (1526B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 sw=2 et tw=78: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef nsHtml5OplessBuilder_h
      8 #define nsHtml5OplessBuilder_h
      9 
     10 #include "nsHtml5DocumentBuilder.h"
     11 #include "nsTArray.h"
     12 
     13 class nsParserBase;
     14 
     15 /**
     16 * This class implements a minimal subclass of nsHtml5DocumentBuilder that
     17 * works when tree operation queues that are part of the off-the-main-thread
     18 * parsing machinery are not used and, therefore, nsHtml5TreeOpExecutor is
     19 * not used.
     20 *
     21 * This class is mostly responsible for wrapping tree building in an update
     22 * batch and resetting various fields in nsContentSink upon finishing.
     23 */
     24 class nsHtml5OplessBuilder : public nsHtml5DocumentBuilder {
     25 public:
     26  nsHtml5OplessBuilder();
     27  ~nsHtml5OplessBuilder();
     28  void Start();
     29  void Finish();
     30  void SetParser(nsParserBase* aParser);
     31 
     32 private:
     33  // Speedometer 3.1 first goes to 600 and then
     34  // right at the end of the run to 1461 and 17232.
     35  // Let's round 600 up to the next power of two,
     36  // which results in 1024, but then in order to actually
     37  // get a power-of-two allocation, we need to take
     38  // the size of `nsTArrayHeader` into account.
     39  const size_t kRecyclableLength =
     40      ((1024 * sizeof(size_t)) - sizeof(nsTArrayHeader)) / sizeof(size_t);
     41 };
     42 
     43 #endif  // nsHtml5OplessBuilder_h